Tooltip back and fore color won't set

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 3 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
DarusDP
Posts: 43
Last visit: Fri Feb 09, 2024 1:02 pm
Been upvoted: 1 time

Tooltip back and fore color won't set

Post by DarusDP »

Product: PowerShell Studio 2020 (64 Bit)
Build: v5.7.175
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.17134.0

The Tooltip control properties BackColor and ForeColor have no affect on the GUI tooltips.
User avatar
brittneyr
Site Admin
Posts: 1654
Last visit: Wed Mar 27, 2024 1:54 pm
Answers: 39
Been upvoted: 30 times

Re: Tooltip back and fore color won't set

Post by brittneyr »

The tooltip control requires that the coloring be handled manually in the control's Draw event. For this event to be triggered, the property OwnerDraw must be set to true and IsBallon must be set to false.

Here is an example of the Draw event setting the ForeColor and BackColor:
  1. $tooltip1_Draw=[System.Windows.Forms.DrawToolTipEventHandler]{
  2. #Event Argument: $_ = [System.Windows.Forms.DrawToolTipEventArgs]
  3.     $font = New-Object System.Drawing.Font("Segoe UI", 9.75)
  4.     $tooltip1.BackColor = [System.Drawing.Color]::Black
  5.     $_.DrawBackground()
  6.     $_.Graphics.DrawString($_.ToolTipText, $font, [System.Drawing.Brushes]::GreenYellow, $_.Bounds.X, $_.Bounds.Y)
  7. }
Brittney
SAPIEN Technologies, Inc.
This topic is 3 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.