September 23, 2007

A Winforms CheckList

  • Check the StartPosition property is CenterParent
  • Check the Text property (the Title) is set to something sensible
  • IF it is a child window set the 'ShowInTaskbar' property to 'False'
  • Check FormBorderStyle property is set to 'FixedDialog' on the Form if it is non-resizable.
  • Check MaximiseBox property is set to 'True' on the Form if you want it
  • Check MinimiseBox property is set to 'True' on the Form if you want it
  • Check AcceptButton property is set on the Form to the 'default' accept/OK button
  • Check CancelButton property is set on the Form to the 'default' cancel changes button
  • IF you want the OK and cancel buttons to work automatically then set the DialogResult property of the button to Accept or Cancel etc.
  • Check the TAB order is set.
OR put these in the xxxForm.designer.cs file, in InitializeComponent() just before ResumeLayout(false);
    this.AcceptButton = this.NAME_OF_ACCEPT_OK_BUTTON;
    this.CancelButton = this.NAME_OF_CANCEL_BUTTON;
    this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
    this.MaximizeBox = false;
    this.MinimizeBox = false;
    this.ShowIcon = false;
    this.ShowInTaskbar = false;
    this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
    this.Text = "FORM TITLE";

No comments: