Home > Net >  I ask TabControl TabPage activate the judgment of the control
I ask TabControl TabPage activate the judgment of the control

Time:11-18

Consult TabControl TabPage Click event in the control is how to judge?

Private Sub TabPage3_Click (sender As Object, As EventArgs e) Handles TabPage3. Click
MsgBox (" Tabpage3. Selected ")
End Sub

Click the TabPage3 TAB without any reaction,


I want to perform when TabPage3 TAB to activate a code, how to judge?

Don't want to use the TabControl SelectedIndexChanged

Have a TAB to activate event probably tabpage1. Active this meaning, write each TAB to activate the code event,

CodePudding user response:

TabPage seemed to have the Loaded event

CodePudding user response:

reference 1st floor OrdinaryCoder response:
TabPage seemed to have the Loaded event


no

CodePudding user response:

I clicked on is a reaction, you click on the TABPAGE red areas are, rather than point the location of the TAB,

CodePudding user response:

To capture the user to the operation of the mouse click
Try TabControl GetTabRect methods, can achieve your demand

For example the following code
Private Sub MyTabControl_MouseClick (sender As Object, _
E the As System. Windows. Forms. MouseEventArgs) _
Handles MyTabControl. MouseClick

.

For the tabIndex As Integer=0 To MyTabControl. TabCount - 1
If MyTabControl. GetTabRect (tabIndex). The Contains (e.L ocation) Then
. 'clicked on the TAB with the index tabIndex'
End the If
Next

.

End Sub

CodePudding user response:

Use TabPage Enter events,

CodePudding user response:

Is not a good idea, because every time you switch will perform a, debug will let you be vexed,

CodePudding user response:

Private Sub TabControl1_SelectedIndexChanged (sender As Object, As EventArgs e) Handles TabControl1. SelectedIndexChanged
  • Related