Capture MouseDown occasion for.NET TextBox

Is there any kind of means to record the MouseDown also from the.NET 2.0 TextBox control? I recognize the acquired Control class has the occasion, yet it is not revealed in TextBox. Exists a means to bypass the occasion trainer?

I additionally attempted the OpenNETCF TextBox2 control which does have the MouseDown occasion revealed, yet whatever I do, it does not discharge the trainer.

Any kind of pointers?


What sort of insane smart phone do you have that has a computer mouse?

Yes, windows mobile does not have a real computer mouse, yet you are incorrect that Windows Mobile.NET do not sustain the Mouse events. A click or go on the screen is still taken into consideration a "Mouse" occasion. It was done this means to make sure that code can port over from complete Windows conveniently. And also this is not a Windows Mobile details concern. The TextBox control on Windows does not have indigenous computer mouse events either. I simply took place to be making use of Windows Mobile in this instance.

Edit: And on a side note ... as Windows Mobile is constructed of the WindowsCE core which is usually made use of for ingrained desktop computer systems and also Slim Terminal Services customers or "WinTerms" it has assistance for an equipment computer mouse and also has for a long period of time. The majority of tools simply do not have the ports to connect one in.


According to the.Net Framework, the MouseDown Event Handler on a TextBox is sustained. What takes place when you attempt to run the code?

In fact, that is just there due to the fact that it acquires it from "Control", as does every various other Form control. It is, nonetheless, overridden (and also transformed to exclusive I think) in the TextBox class. So it will certainly disappoint up in IntelliSense in Visual Studio.

Nonetheless, you in fact can write the code:

textBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.textBox1_MouseDown);

and also it will certainly compile and also run simply great, the only trouble is that textBox1_MouseDown () will certainly not be discharged when you touch the TextBox control. I think this is as a result of the Event being bypassed inside. I do not also intend to transform what is taking place on the occasion inside, I simply intend to add my very own occasion trainer to that occasion so I can discharge some personalized code as you can with any kind of various other occasion.

0
2019-05-18 21:21:17
Source Share
Answers: 3

Fair sufficient. You possibly recognize greater than I do concerning Windows Mobile. I simply began setting for it. Yet in normal WinForms, you can bypass the OnXxx occasion trainer approaches all you desire. A glance in Reflector with the CF reveals that Control, TextBoxBase and also TextBox do not stop you from bypassing the OnMouseDown occasion trainer.

Have you attempted this?:

public class MyTextBox : TextBox
{
    public MyTextBox()
    {
    }

    protected override void OnMouseDown(MouseEventArgs e)
    {
        //do something specific here
        base.OnMouseDown(e);
    }
}
0
2019-05-19 23:35:08
Source

Looks like you are right. Drag. No MouseOver occasion.

Among the contingencies that constantly functions with.NET, however, is P/Invoke. A person currently put in the time to do this for the.NET CF TextBox. I located this on CodeProject:

http://www.codeproject.com/KB/cs/TextBox_subclassing.aspx

Hope this aids

0
2019-05-19 23:24:50
Source

According to the.Net Framework, the MouseDown Event Handler on a TextBox is sustained. What takes place when you attempt to run the code?

0
2019-05-19 22:46:02
Source