How to create a non OwnerDraw button in .NET?

I am creating a plugin for software that protects the form I created. However, the button is not based on them, and the standard gray button is displayed. When I asked the software forum, I pointed out that .NET form control is drawing the owner, and therefore my button will not be redrawn using the correct style, and not create a button without the owner.

All controls in the system.windows.forms namespace appear to be the owner.

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

Currently codding in C # if that helps.

thanks

+4
source share
4 answers

The controls in Windows.Forms are not styled by the owner, but rather styled by the system. This is how Windows will color them by default, whether it be Button, TextBox or whatever. You can override the drawing by indicating that the control should be drawn by the owner (i.e.: you are responsible for drawing it). Some controls support this, several of them with even finer granularity (see ListView), or you can completely override the picture in the OnPaint event of any Control descendant.

Your question is rather confusing - as I understand that the buttons you created in your plug-in are not protected. Obviously, you need to talk about this skin framework to draw these buttons. There is probably or should be some component that you throw into the form of the plug-in, or a method that you call that will inject the tint routines into your plugin.

+1
source

It looks like you want to set the FlatStyle property of your button to FlatStyle.System . Buttons Windows Forms really, by default, the owner is drawn at the WinAPI level and drawn in frame.

+1
source

Have you tried setting FlatStyle to a different value, such as Flat or Popup , to make sure that it is no longer tailored?

also setting Flaststyle = Standard (unlike the system) may solve your problem

0
source

The standard was standard and therefore has not been updated. When you set it on a flat surface, I get the background color and foreground color, but lose the round end of the end of the hover effect, assuming the control is not reskinned and only the color style is applied. Flat is the only version that does not have gray color, but I lose part of the button function (hover, round corner)

0
source

All Articles