views:

720

answers:

5

Hi,

I'm creating a plugin to a software that skins the form I created. However, the button are not skin based on them and a standard gray button is shown. Asking on the software forum pointed me that .NET forms control are owner-draw and therefor my button won't redraw with the correct style instead of creating a non ownerdraw button.

All controls in the system.windows.forms namespace seem to be ownerdraw.

So how can I create a standar C++ PUSHBUTTON in .NET?

Currently codding in C# if that helps.

Thx

+1  A: 

The controls in Windows.Forms are not owner-drawn, but rather system-drawn. This is how Windows paints them by default, be it a Button, TextBox or what else. You can override the drawing either by specifying that the control should be owner-drawn (that is: you are responsible for drawing it) - some controls support that, a couple of them even with a finer granularity (see ListView), or you can override the painting completely in OnPaint event of any Control descendant.

Your question is rather confusing - as I understand the buttons you create in your plug-in are not skinned. Obviously what you need is to tell this skinning framework to paint these buttons. There probably is or should be some component that you drop onto the plug-in form or method you call that will inject the skinning painting routines into your plug-in.

liggett78
+1  A: 

It sounds like you want to set the FlatStyle property of your button to FlatStyle.System. Windows Forms buttons are indeed, by default, owner draw at the WinAPI level, and are drawn by the framework.

P Daddy
A: 

Unfortunatly, the flatstyle.system button doesn`t skin either in the application.

A: 

Have you tried setting the FlatStyle to another value, such as Flat or Popup, just to see if that stops it being skinned?

also setting Flaststyle = Standard (as opposed to system) might solve your problem

Pondidum
A: 

Standard was the default and therefor wasn't reskinned. When setted to flat, I get a background color and a foreground color, but lose the round corner end the hover effect suggesting that the control is not reskinned and just color style is applyed. Flat is the only version not grey, but I lose some of button feature (hover, round corner)