Subclassing a Button...

Kieron

Newcomer
Joined
Nov 19, 2002
Messages
15
Location
England
Hi,

I'm trying to overrides a buttons OnPaint or OnPaintBackground event. However when the buttons flatstyle is set to system these event aren't called. The point was to be able to draw an image on a button with the visual style set to the current visual style (if any). Does anyone have any ideas how I can get around/ do this...

Cheers,
Kieron :D
 
I know that when setting a controls color from the system colors you cannot just use Color= Color.Red
It must be Color= SystemColors.Red

So, maybe the events have System in them somewhere. . .
 
The point of setting Flatstyle to System is that the system assumes all drawing responsibility for the buttons, so I'm not surprised that you can't override those events and achieve anything.

You should try subclassing WndProc and looking for the WM_PAINT message.
 
Back
Top