Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15436

VS 2019 [RESOLVED] ToolStrip Split Button - Custom highlight Color not drawing the Arrow

$
0
0
I am using a custom renderer to change the highlilght color dor a ToolStrip Split button (code below). It works and the highlighted color is indeed changed, the problem is when highlighted it does not draw the arrow. I have tried calling MyBase.MyBase.OnRenderArrow() and also MyBase.DrawArrow() but neither seems to draw the arrow. Maybe I am creating the graphics object incorrectly or something.

This works fine, and the arrow is drawn on a plain ToolStrip DropDownButton but just not the Split button for some reason.

Any other suggestions to get the arrow drawn from a custom renderer?
Why is the Arrow not getting drawn in the first place?

vb.net Code:
  1. Private Class MyRenderer : Inherits ToolStripProfessionalRenderer
  2.    Protected Overrides Sub OnRenderSplitButtonBackground(ByVal e As System.Windows.Forms.ToolStripItemRenderEventArgs)
  3.      If e.Item.Selected Then
  4.         Dim rc As New Rectangle(Point.Empty, e.Item.Size)
  5.         'Set the highlight color
  6.         e.Graphics.FillRectangle(Brushes.Gainsboro, rc)
  7.         e.Graphics.DrawRectangle(Pens.Gainsboro, 1, 0, rc.Width - 2, rc.Height - 1)
  8.     Else
  9.        MyBase.OnRenderSplitButtonBackground(e)
  10.     End If
  11.   End Sub
  12.     End Class

Viewing all articles
Browse latest Browse all 15436

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>