Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

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. . .

C#
  • *Gurus*
Posted

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.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...