Ok
Does anyone know why this doesn't work
Public Class UserControl1
Inherits System.Windows.Forms.UserControl
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim CB As New ComboBox()
CB.Bounds = Me.Bounds
CB.Font = Me.Font
Me.InvokePaint(CB, e)
MyBase.OnPaint(e)
End Sub
End Class
yet this does work
Public Class UserControl1
Inherits System.Windows.Forms.UserControl
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim CB As New button()
CB.Bounds = Me.Bounds
CB.Font = Me.Font
Me.InvokePaint(CB, e)
MyBase.OnPaint(e)
End Sub
End Class
It's driving me nuts.
Please let me know
Joe

Invokepaint to paint another controls image on your control
jhnnym
gigo318
I have a project posted at PSC
http://www.planet-source-code.com/vb/scripts/ShowCode.asp txtCodeId=1332&lngWId=10
Hope it helps anyone that comes across this isssue.
Joe
Nowandever29
My one solution so far was to make a new control and inherit the combobox like this
Public Class UserControl2
Inherits System.Windows.Forms.ComboBox
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
e.Graphics.DrawRectangle(New Pen(Color.Black), New Rectangle(0, 0, Me.Width, Me.Height))
MyBase.OnPaint(e)
End Sub
End Class
Now if the user uses this control in thier project it works just fine. Now if they use the invokepaint it will paint a rectangle with a black border.
So every control that doesn't work and that I want to use this feature I must add this bit of code and make what looks like the paint of the control.
I know for a fact that the combo box must not use the onpaint since if you use this control with the modifications as above it paints normally and you got your normal combo box.
This seems to be the issue with anything that inherits the listcontrol.
Joe