Is there any way to programmatically set a buttontool to have the hottrackappearance (as if the cursor was over it) ?
Thanks for that, I've got it working using ResolveAppearance.
Here's the code in case anyone's interested (where e.Tool is the toolbar item to update):
Dim hotTrackAppData As New AppearanceData e.Tool.ResolveAppearance(hotTrackAppData, AppearancePropFlags.AllRender, True, False) Dim hotTrackApp As New Appearance(hotTrackAppData) e.Tool.InstanceProps.AppearancesSmall.Appearance = hotTrackApp
e.Tool.ResolveAppearance(hotTrackAppData, AppearancePropFlags.AllRender, True, False)
Dim hotTrackApp As New Appearance(hotTrackAppData)
e.Tool.InstanceProps.AppearancesSmall.Appearance = hotTrackApp
Thanks,
John.
The hot track appearance of the button is resolved internally based on many different factors including the current OS, the current theme being used, whether any app styling is used in the application, whats the system colors are, etc. There is no public object that will give you the resolved color information. You would have to call the ButtonTool.ResolveAppearance method and use an overload that allows you to specify the drawAsActive parameter, which you would pass in as True. After the appearance is resolved, set those values on the ButtonTool's normal appearance.
Hi,
I'm trying to do the same thing. In your example it just sets the backcolor but that doesn't look the same as the themed hot track appearance.
What I want to do is something like:
ultraToolbarsManager1.Tools["ButtonToolKey"].SharedProps.AppearancesSmall.Appearance = Me.UltraToolbarsManager1.ToolbarSettings.HotTrackAppearance
However, despite e.UltraToolbarsManager1.ToolbarSettings.HasHotTrackAppearance being true the HottrackAppearance seems to be non-existent (i.e. the backcolor arbg is 0).
Do you know where I can find the HotTrackAppearance object that's actually being used by the toolbar, and can I use it to set the normal appearance of the tool item?
Hello,
Yes, you could do this with following code line:
ultraToolbarsManager1.Tools["ButtonToolKey"].SharedProps.AppearancesSmall.HotTrackAppearance.BackColor = Color.Red;
Let me know if you have any further questions.