D
dominique
Hi,
In windows forms (vb.net), i use my own controls subclassed from base
controls and i override the Onxxx methods.
for example:
Public Class MyBouton
Inherits System.Windows.Forms.Button
..
Protected Overrides Sub OnPaint(ByVal pe As
System.Windows.Forms.PaintEventArgs)
MyBase.OnPaint(pe)
..
Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
Mybase.OnClick(e)
..
I saw that :
- for some controls (ex: combobox), i can't access to OnPaint but i can
access to OnClick ..
- for these controls, if i had in the constructor :
Me.SetStyle(ControlStyles.UserPaint, true)
i can now access to OnPaint (then i must draw the control even if i put
MyBase.OnPaint(pe))
but if i put : Me.SetStyle(ControlStyles.UserPaint, false)
i can't access to none Onxxx
- in some controls (ex: Button) without Me.SetStyle, it is ok, i can
access to OnPaint
I saw also if i intercept a windows message, it is ok :
Protected Overrides Sub WndProc(ByRef m As Message)
MyBase.WndProc(m)
Select Case m.Msg
Case &HF ' =15 =Paint
Can anybody explain this strangeness ?
Is it a known bug ?
Is it better to use always windows message instead of OnPaint ?
Thanks for advice.
Dominique Gratpain
In windows forms (vb.net), i use my own controls subclassed from base
controls and i override the Onxxx methods.
for example:
Public Class MyBouton
Inherits System.Windows.Forms.Button
..
Protected Overrides Sub OnPaint(ByVal pe As
System.Windows.Forms.PaintEventArgs)
MyBase.OnPaint(pe)
..
Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
Mybase.OnClick(e)
..
I saw that :
- for some controls (ex: combobox), i can't access to OnPaint but i can
access to OnClick ..
- for these controls, if i had in the constructor :
Me.SetStyle(ControlStyles.UserPaint, true)
i can now access to OnPaint (then i must draw the control even if i put
MyBase.OnPaint(pe))
but if i put : Me.SetStyle(ControlStyles.UserPaint, false)
i can't access to none Onxxx
- in some controls (ex: Button) without Me.SetStyle, it is ok, i can
access to OnPaint
I saw also if i intercept a windows message, it is ok :
Protected Overrides Sub WndProc(ByRef m As Message)
MyBase.WndProc(m)
Select Case m.Msg
Case &HF ' =15 =Paint
Can anybody explain this strangeness ?
Is it a known bug ?
Is it better to use always windows message instead of OnPaint ?
Thanks for advice.
Dominique Gratpain