Login from : Form Frame Window « GUI Windows Form « C# / C Sharp

Login from

Login from
Professional Windows GUI Programming Using C#
by Jay Glynn, Csaba Torok, Richard Conway, Wahid Choudhury, 
   Zach Greenvoss, Shripad Kulkarni, Neil Whitlow

Publisher: Peer Information
ISBN: 1861007663

using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;

namespace Wrox.ProWinProg.Chapter01.WinFormNonVS
   public class frmLogin : System.Windows.Forms.Form
      System.Windows.Forms.TextBox txtUser;
      System.Windows.Forms.Button btnOK;
      System.Windows.Forms.Button btnCancel;

      public frmLogin()
         txtUser = new System.Windows.Forms.TextBox();
         txtUser.Location = new Point(30, 15);
         txtUser.Size = new Size(250, 20);
         txtUser.Text = "";
         txtUser.Name = "txtUser";

         btnOK = new System.Windows.Forms.Button();
         btnOK.Location = new Point(40,
            (txtUser.Location.Y + txtUser.Size.Height + btnOK.Size.Height));

         btnCancel = new System.Windows.Forms.Button();
         btnCancel.Location = new Point((this.Size.Width -
                                         btnCancel.Size.Width) - 40,
            (txtUser.Location.Y + txtUser.Size.Height + btnOK.Size.Height));
         btnCancel.Text = "Cancel";
         btnCancel.Name = "btnCancel";

         this.Size = new Size(this.Size.Width, btnCancel.Location.Y +
                              btnCancel.Size.Height + 60);

         btnCancel.Click += new System.EventHandler(btnCancelHandler);
         btnOK.Click += new System.EventHandler(btnEventHandler);

      private void btnEventHandler(object sender, System.EventArgs e)
      private void btnCancelHandler(object sender, System.EventArgs e)
         MessageBox.Show("The second handler");

      static void Main()
         Application.Run(new frmLogin());

WinFormVS.zip( 19 k)

Related examples in the same category

1.Print out Form size and position related information
2.Use Font from Form to paint string on a form
3.Set ResizeRedraw property
4.Set ClientSize to change the form window size
6.Form hideForm hide
7.Change Form window ownershipChange Form window ownership
8.Create Graphics Object from form window handleCreate Graphics Object from form window handle
9.Center form windowCenter form window
10.Assign Form window default valueAssign Form window default value
11.Change the background and text colors of a form using Color DialogChange the background and text colors of a form using Color Dialog
12.Draw image based on the window sizeDraw image based on the window size
13.Auto scroll form windowAuto scroll form window
14.Set Form window title and center the Form window on the desktopSet Form window title and center the Form window on the desktop
15.Add control to a form windowAdd control to a form window
16.Change Form window backgroundChange Form window background
17.Simplest form code: set window titleSimplest form code: set window title
18.makes a new window out of a graphics path that has been traced on this forms spacemakes a new window out of a graphics path that has been traced on this forms space
19.Windows Forms Getting StartedWindows Forms Getting Started
20.A form-based Windows SkeletonA form-based Windows Skeleton
21.Simple formSimple form
22.Add controls to a formAdd controls to a form
23.Form for data inputForm for data input
24.Demonstrates creating a form in a console programDemonstrates creating a form in a console program