Hello
is it possible to change coloring property for ToolStripMenuItem ? i see that they are using different class - tooltiptext which does not have coloring
Custom Color for Tooltip on Menu Item
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- daniel kusnir
- Posts: 75
- Last visit: Tue May 23, 2023 10:50 am
Re: Custom Color for Tooltip on Menu Item
It i snot possible to understand wat you are asking. Are you asking about a tooltip or a menuitem?
Here are all of the properties of a ToolStripMenuItem: https://docs.microsoft.com/en-us/dotnet ... etcore-3.1
You can only change the global color settings of a tooltip control. You can set "OwnerDraw True" and handle the graphical rendering of the tooltip.
You can change the color of a menu item on the "Paint" event for the item.
Here are all of the properties of a ToolStripMenuItem: https://docs.microsoft.com/en-us/dotnet ... etcore-3.1
You can only change the global color settings of a tooltip control. You can set "OwnerDraw True" and handle the graphical rendering of the tooltip.
You can change the color of a menu item on the "Paint" event for the item.
- daniel kusnir
- Posts: 75
- Last visit: Tue May 23, 2023 10:50 am
Re: Custom Color for Tooltip on Menu Item
sorry i wasnt very specific. I would like to know if there is a way to change Colors of a tooltip for a toolstripmenuitem.
Those are however handled by custom class and for those owner draw does not apply. I can create custom colors for most except menu items : Howevew i would like to change default color of this as well :
Those are however handled by custom class and for those owner draw does not apply. I can create custom colors for most except menu items : Howevew i would like to change default color of this as well :
Re: Custom Color for Tooltip on Menu Item
YOu can set OwnerDraw and use this to set the background:
This sets the color but you will need to add the text you want.
Code: Select all
$tooltip1_Draw=[System.Windows.Forms.DrawToolTipEventHandler]{
#Event Argument: $_ = [System.Windows.Forms.DrawToolTipEventArgs]
$r = [System.Drawing.RectangleF]::new($_.ClipRectangle.Location.X,$_.ClipRectangle.Location.Y,400,400)
$_.Graphics.FillRectangle([System.Drawing.Brushes]::Blue,$r)
}
- daniel kusnir
- Posts: 75
- Last visit: Tue May 23, 2023 10:50 am
Re: Custom Color for Tooltip on Menu Item
Thanks for the replay, however i think its a bit more complicated than that.
As you can see in the pictures, i wanted to change background of a tooltip for menu iteam, when you click Menu - > Item 2.
And unfortunatelly, this is controlled by ToolTipText property.
As you can see in the pictures, i wanted to change background of a tooltip for menu iteam, when you click Menu - > Item 2.
And unfortunatelly, this is controlled by ToolTipText property.