Mega Code Archive

 
Categories / C# Tutorial / GUI Windows Forms
 

Button Text Alignment

using System; using System.Drawing; using System.Windows.Forms; public class ButtonTextAlign : Form {   Button btn;   public ButtonTextAlign()   {         Text = "Button Properties";     Size = new Size(300,200);     btn = new Button();     btn.Parent = this;     btn.Text = "text";     btn.Location = new Point(10,10);     btn.BackColor = Color.LightGreen;     btn.TextAlign = ContentAlignment.MiddleLeft;          f(btn);   }   static void Main()    {     Application.Run(new ButtonTextAlign());   }   private void f(Button btn)   {     int xSize = 100;     int ySize = 100;     btn.Size = new Size(xSize, ySize);   } }