Any way to do HitTest on TabbedMdiWindow.ContextImage

Docking/MDI for Windows Forms Forum

Posted 12 years ago by shark92651
Avatar
I would like to display a different tool-tip and allow a different click action if the user is hovering over or clicking on the tab image rather than the rest of the tab. My first thought was to use the WindowTabToolTipDisplaying and try to do a HitTest of some sort. I cannot find any docs on performing a HitTest on the tab of the TabbedMdiWindow nor do I know if this is the best approach. Do you have any suggestions?

Comments (5)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Here's some code that may help...
Point point = tabStrip.PointToClient(Control.MousePosition);
TabStripTab tab = ((IUIElement)tabStrip).HitTestRecursive(new PointHitTestParameters(point)).Element as TabStripTab;
if (tab != null)
    Console.WriteLine(tab.Bounds + " : " + point);
Basically it determines what tab the mouse is over and prints the bounds and the point. All our renderers should have the context image indented in from the right/bottom side of the tab by the renderer's TabStripTabImageMargin value plus the width/height of the context image. So using that info you can determine the bounds of the context image.


Actipro Software Support

Posted 12 years ago by shark92651
Avatar
I took a look at that for a bit when I found the other post. I am confused though, HitTestRecursive seems to be something that is implemented in .NET 3.0. I was unable to find any way to get HitTestRecursive or IUIElelment to work with the TabbedMdiWindow.
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Sorry, that code above is if you have the TabStrip reference. When a TabbedMdiWindow is in tabbed MDI, its Parent should a TabStripPage. And that control's parent should be a TabStrip. So from that you can use the above code.


Actipro Software Support

Posted 12 years ago by shark92651
Avatar
Ok, I think I have this working now. I was totally confused because when I searched for IUIElement I found that it belonged to an assembly named Microsoft.VisualStudio.Shell.Interop and did not realize that it was in WinUICore.
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Ahh, yes that interface is part of our WinUICore framework.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.