Windows Forms Tab Control
-
Hi all, I'm trying to select a tab from the windows form's standard tab control on right clicking of mouse button. The mouse event args gives me the location of the mouse pointer. But the tab control doesn't expose any method or property to get the tab on which my mouse pointer is hovering. Has anyone of you faced similar problem like this ? Or atleast it will be nice if anyone can show me a pointer towards solving this problem. Hoping to hear from you guys... Thanks and regards,
-
Hi all, I'm trying to select a tab from the windows form's standard tab control on right clicking of mouse button. The mouse event args gives me the location of the mouse pointer. But the tab control doesn't expose any method or property to get the tab on which my mouse pointer is hovering. Has anyone of you faced similar problem like this ? Or atleast it will be nice if anyone can show me a pointer towards solving this problem. Hoping to hear from you guys... Thanks and regards,
You might try this approach... You can get the coordinates of each tab on the DrawItem event. If you could save those locations and sizes of each tab every time the tab control is drawn, then in the mousedown event you can identify which tab was clicked on by referring to your saved information. Good Luck! Darryl Borden Principal IT Analyst dborden@eprod.com
-
Hi all, I'm trying to select a tab from the windows form's standard tab control on right clicking of mouse button. The mouse event args gives me the location of the mouse pointer. But the tab control doesn't expose any method or property to get the tab on which my mouse pointer is hovering. Has anyone of you faced similar problem like this ? Or atleast it will be nice if anyone can show me a pointer towards solving this problem. Hoping to hear from you guys... Thanks and regards,
The way to do it is to iterate over the tab pages and for each one call TabControl.GetTabRect. If your mouse coordinate exists inside the returned rectange, set that tab to the selected tab. "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty