C
chris in grimsby
I am developing a control that inherits the
system.windows.forms.checkbox
I want to supress user interaction such as the Click event and the
Keypress event when my control's custom property "ReadOnly" is true.
I expected to be able to override the OnClick and OnKeypress methods,
only calling the base object methods when ReadOnly is not true:
<code clip>
Public [ReadOnly] as boolean
Overrides Sub OnClick( e as EventArgs)
If not [ReadOnly] then
Mybase.OnClick(e)
End if
End Sub
<end clip>
but this just doesn't work.
Before anyone suggests it, the "Enabled" property is not good as it
greys out the caption (oops, sorry, text) shown on screen.
Any ideas?
system.windows.forms.checkbox
I want to supress user interaction such as the Click event and the
Keypress event when my control's custom property "ReadOnly" is true.
I expected to be able to override the OnClick and OnKeypress methods,
only calling the base object methods when ReadOnly is not true:
<code clip>
Public [ReadOnly] as boolean
Overrides Sub OnClick( e as EventArgs)
If not [ReadOnly] then
Mybase.OnClick(e)
End if
End Sub
<end clip>
but this just doesn't work.
Before anyone suggests it, the "Enabled" property is not good as it
greys out the caption (oops, sorry, text) shown on screen.
Any ideas?