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

image_pdfimage_print


   


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);
  }
}