Mega Code Archive

 
Categories / C# Tutorial / GUI Windows Forms
 

Button Image

using System; using System.Drawing; using System.Windows.Forms; public class ButtonImage : Form {   Button btn;   Image img;   public ButtonImage()   {         Text = "Button Properties";     Size = new Size(300,200);     img = Image.FromFile("YourFile.bmp");     btn = new Button();     btn.Parent = this;     btn.Text = "test";     btn.Location = new Point(10,10);            btn.Image = img;     ButtonSize(btn);   }   static void Main()    {     Application.Run(new ButtonImage());   }   private void ButtonSize(Button btn)   {     int xSize = 100;     int ySize = 100;     btn.Size = new Size(xSize, ySize);   } }