Set Form window title and center the Form window on the desktop : Form Frame Window « GUI Windows Form « C# / C Sharp






Set Form window title and center the Form window on the desktop

Set Form window title and center the Form window on the desktop

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

public class TestForm2 {
  static void Main() {
    Form simpleForm = new Form();

    simpleForm.Height = 200;
    simpleForm.Width = 200;

    simpleForm.Text = "This is the title";

    // Center the Form on the desktop
    simpleForm.StartPosition = FormStartPosition.CenterScreen;
    simpleForm.Visible = true;

    Application.Run(simpleForm);
  }
}

           
       








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
5.FormStartPosition.CenterScreen
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.Add control to a form windowAdd control to a form window
15.Change Form window backgroundChange Form window background
16.Simplest form code: set window titleSimplest form code: set window title
17.Login fromLogin from
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
25.AutoScrollPosition