Windows Develop Bookmark and Share   
 index > Windows Forms General > Get rid of button style but keep behavior
 

Get rid of button style but keep behavior

What is the best way to get rid of the style of the System.Windows.Forms.Button ( i.e. the 3D border, the XP-look and feel and the padding of the content) but keep how the button arranges image and text inside (i.e. automatic wordwrapping for the text as well as Button.TextAlign and Button.ImageAlign)? Do I really have to inherit the button and override OnPaint? Because that seems to require to reimplement the arrangement logic for text and image to exactly mimic the behavior of the original button.
bitbonk  Thursday, May 10, 2007 6:08 AM

To get rid of the XP visualstyle you would have to comment out the line Application.EnableVisualStyles(); within the main method. which VS automatically adds. but this would affect all the controls in the app.

or else

Set the FlatStyle property of the buttonto FlatStyle.Flat to get rid of the borders.

if that too wont suffice you would have to ownerdraw the button.

a.Binny  Thursday, May 10, 2007 6:54 AM

To get rid of the XP visualstyle you would have to comment out the line Application.EnableVisualStyles(); within the main method. which VS automatically adds. but this would affect all the controls in the app.

or else

Set the FlatStyle property of the buttonto FlatStyle.Flat to get rid of the borders.

if that too wont suffice you would have to ownerdraw the button.

a.Binny  Thursday, May 10, 2007 6:54 AM

You can use google to search for other answers

Custom Search

More Threads

• displaying enum's to a user
• RowEnter and RowLeave
• Windows Forms application displays differently on different computer OS
• C# windows form looks different on different OS/Platform
• Combobox???
• event +C#
• ComboBoxStyle
• ownerdraw menus...
• using usercontrols
• Image Resize to 30,000x30,000 pixels