lottoman2000
Member
- Joined
- Mar 11, 2005
- Messages
- 6
- Programming Experience
- 5-10
I was able to draw a triangle on a toolbarbutton to simulate a drop
down button without having the extra button beside my dropdownbutton.
I have overrrided the onpaint event for the form. that only problem is when I click on the button ( a context menu shows up) the triangle disappears. I also overrided mouse up, down, hover, leave events and made them to call me.invalidate.
The button style is: PushButton
Here is my code
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim g As Graphics
Dim tbb As ToolBarButton
Dim brush As SolidBrush = New SolidBrush(Color.Black)
Dim Points(2) As Point
Points(0) = New Point(tbbArchive.Rectangle.Right - 10, tbbArchive.Rectangle.Bottom / 2)
Points(1) = New Point(tbbArchive.Rectangle.Right - 7, (tbbArchive.Rectangle.Bottom / 2) - 3)
Points(2) = New Point(tbbArchive.Rectangle.Right - 13, (tbbArchive.Rectangle.Bottom / 2) - 3)
g = Me.ToolBar1.CreateGraphics
g.FillPolygon(brush, Points)
g.Dispose()
End Sub
Any help is appreciated.
down button without having the extra button beside my dropdownbutton.
I have overrrided the onpaint event for the form. that only problem is when I click on the button ( a context menu shows up) the triangle disappears. I also overrided mouse up, down, hover, leave events and made them to call me.invalidate.
The button style is: PushButton
Here is my code
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim g As Graphics
Dim tbb As ToolBarButton
Dim brush As SolidBrush = New SolidBrush(Color.Black)
Dim Points(2) As Point
Points(0) = New Point(tbbArchive.Rectangle.Right - 10, tbbArchive.Rectangle.Bottom / 2)
Points(1) = New Point(tbbArchive.Rectangle.Right - 7, (tbbArchive.Rectangle.Bottom / 2) - 3)
Points(2) = New Point(tbbArchive.Rectangle.Right - 13, (tbbArchive.Rectangle.Bottom / 2) - 3)
g = Me.ToolBar1.CreateGraphics
g.FillPolygon(brush, Points)
g.Dispose()
End Sub
Any help is appreciated.