Note that there are some explanatory texts on larger screens.

plurals
  1. POTransparency around non-rectangular (owner draw) ToolTip control?
    primarykey
    data
    text
    <p>I'm customizing the appearance of a WinForms ToolTip control by responding to the Draw event. I just want some of the ToolTip's corners to be rounded. I've got everything working such that the first time the ToolTip is displayed, everything looks perfect. On subsequent displays, however, the unfilled areas of my rounded rectangle continue to have what was in the background the first time the ToolTip was displayed.</p> <p>Screen shot of problem (I don't have rights to put inline apparently): <a href="http://tinypic.com/r/30xa3w9/3" rel="nofollow noreferrer">http://tinypic.com/r/30xa3w9/3</a></p> <p>In the picture, you can see the left-over artifacts in the upper-left corner where I would like it to just be transparent (showing the gray background), like this:</p> <p>tinypic.com/r/mvn8eo/3 (nor rights to add more than one link)</p> <p>Here is the drawing code:</p> <pre><code>private void ToolTip_Draw(object sender, DrawToolTipEventArgs args) { args.Graphics.SmoothingMode = SmoothingMode.AntiAlias; var rect = new RectangleF(0, 0, args.Bounds.Width, args.Bounds.Height); using (var backBrush = new LinearGradientBrush(rect, Color.Silver, this.BackColor, 90)) { using (var path = GetRoundedRectangle(rect, 10, 4, 4, 1)) { args.Graphics.FillPath(backBrush, path); args.DrawText(); } } } </code></pre> <p>The GetRoundedRectangle function (not included) just calculates the appropriate GraphicsPath for the rounded geometry that I want.</p> <p>I tried adding a call to args.DrawBackground after setting the BackColor to Color.Transparent, but that just filled in the area with the dark gray of the form's background rather than actually being transparent, which I think is the typical "simulated" transparency of WinForms. </p> <p>As a side note, an non-customized ToolTip with IsBalloon set to true is non-rectangular with correct transparency.</p> <p>Can anyone suggest a fix for this problem?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload