Button Localtion : Button : GUI Windows Form C# Source Code


Custom Search

C# Source Code » GUI Windows Form » Button »

 

Button Localtion








    
 


using System;
using System.Drawing;
using System.Windows.Forms;
   
class SimpleButton: Form
{
     public static void Main()
     {
          Application.Run(new SimpleButton());
     }
     public SimpleButton()
     {
          Text = "Simple Button";
   
          Button btn   = new Button();
          btn.Parent   = this;
          btn.Text     = "Click Me!";
          btn.Location = new Point(100, 100);
          btn.Click   += new EventHandler(ButtonOnClick);
     }
     void ButtonOnClick(object obj, EventArgs ea)
     {
          Graphics grfx   = CreateGraphics();
          Point    ptText = Point.Empty;
          string   str    = "Button clicked!";
   
          grfx.DrawString(str, Font, new SolidBrush(ForeColor), ptText);
          grfx.Dispose();
     }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo GUI Windows Form
» Button