Welcome, Guest Ohm namah shivoy
www.faqpanel.com
Home | ASP.Net | C-Sharp | Winforms | MS SQL | AJAX | XML | .Net Training*** | Search
Invite friends 
Extras 
VS Tips & Tricks
Top 10 .Net Tools
Special folders in ASP.Net
VS Find Combobox
 Winforms Interview Questions / FAQs
How do I resize a Button to fit its Text?
Get a Graphics object for the button and use its MeasureString method to compute the width you need.

using ( Graphics g = button1.CreateGraphics() )
float w = g.MeasureString( button1.Text, button1.Font ).Width;
button1.Width = (int) w + 12; // 12 is for the margins

How do I put a bitmap or icon on a Button?
You can use the Button.Image property to add an image to a button face. Use the Button.ImageAlign (and possibly Button.TextAlign) to layout your button face.

You can also implement custom drawing on a button face.

How do I trigger a Button Click event?
Use the Button's public method PerformClick().