| |

VerySource

 Forgot password?
 Register
Search
Author: miracle2121

Novices ask questions about programming ideas. . Winform under C # ~~

[Copy link]

2

Threads

11

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

 Author| Post time: 2020-6-10 10:00:02
| Show all posts
I used textbox_mousedown to solve the above problem, because I have 25 textboxes on it. How can I define a mousedown event as a whole?
Reply

Use magic Report

0

Threads

20

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 LAN

Post time: 2020-6-11 13:15:01
| Show all posts
this.textBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.textBox1_MouseDown);
//this.textBox1_MouseDown The method of this event response, replace all the same with OK
Reply

Use magic Report

0

Threads

27

Posts

21.00

Credits

Newbie

Rank: 1

Credits
21.00

 China

Post time: 2020-6-11 14:45:01
| Show all posts
Write in form_load
this.textBoxXXXX.MouseDown += new System.Windows.Forms.MouseEventHandler(this.textBox_MouseDown);
Where XXXX is 1, 2, 3, 4.... so that all your textBox controls are connected to a mouse event.
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-6-13 16:15:01
| Show all posts
You add the mousedown of another textbox after the Handles of the mousedown event of a textbox
such as
Private Sub textbox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)Handles textbox1.MouseDown, textbox2.MouseDown
'You need to deal
end sub
Write click event is estimated to be the same
Private Sub textbox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles textbox1.Click, textbox2.Click
'You need to deal
end sub
Reply

Use magic Report

2

Threads

11

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

 Author| Post time: 2020-6-13 22:45:01
| Show all posts
Alright, all right, thank you three.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list