C
Chris
1. I was trying to use a flatcombo box. I found code on codeproject
that did what I needed. They used the following code in the WndProc
overridden procedure.
Dim g As Graphics = Me.CreateGraphics
g.FillRectangle(BorderBrush, Me.ClientRectangle)
I thought using CreateGraphics was a no-no if you could avoid it. So I
changed it to
Dim g As Graphics = Graphics.FromHwnd(Me.Handle)
g.FillRectangle(Brushes.Black, Me.ClientRectangle)
Is my was a better way of doing it?
2. I thought it would be better to do this in the onpaint override of
the combobox, but it never gets called. Why not?
Protected Overrides Sub OnPaint(ByVal e As
System.Windows.Forms.PaintEventArgs)
Dim rect As Rectangle = New Rectangle(Me.Width - 15, 3, 12,
Me.Height - 6)
e.Graphics.FillRectangle(Brushes.Black, rect)
e.Graphics.FillRectangle(Brushes.Black, Me.ClientRectangle)
End Sub
Thanks for the info.
Chris
that did what I needed. They used the following code in the WndProc
overridden procedure.
Dim g As Graphics = Me.CreateGraphics
g.FillRectangle(BorderBrush, Me.ClientRectangle)
I thought using CreateGraphics was a no-no if you could avoid it. So I
changed it to
Dim g As Graphics = Graphics.FromHwnd(Me.Handle)
g.FillRectangle(Brushes.Black, Me.ClientRectangle)
Is my was a better way of doing it?
2. I thought it would be better to do this in the onpaint override of
the combobox, but it never gets called. Why not?
Protected Overrides Sub OnPaint(ByVal e As
System.Windows.Forms.PaintEventArgs)
Dim rect As Rectangle = New Rectangle(Me.Width - 15, 3, 12,
Me.Height - 6)
e.Graphics.FillRectangle(Brushes.Black, rect)
e.Graphics.FillRectangle(Brushes.Black, Me.ClientRectangle)
End Sub
Thanks for the info.
Chris