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.
Locked
DarusDP
Posts: 20
Joined: Thu Aug 22, 2019 7:45 am

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: 503
Joined: Thu Jun 01, 2017 7:20 am

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.  
  3. #Event Argument: $_ = [System.Windows.Forms.DrawToolTipEventArgs]
  4.  
  5.     $font = New-Object System.Drawing.Font("Segoe UI", 9.75)
  6.  
  7.     $tooltip1.BackColor = [System.Drawing.Color]::Black
  8.  
  9.     $_.DrawBackground()
  10.  
  11.     $_.Graphics.DrawString($_.ToolTipText, $font, [System.Drawing.Brushes]::GreenYellow, $_.Bounds.X, $_.Bounds.Y)
  12.  
  13. }
Brittney Ryn
SAPIEN Technologies, Inc.

Locked