System.Windows.Forms.Form.Close C# (CSharp) Method

Close() public method

public Close ( ) : void
return void
		public void Close () {
			if (IsDisposed)
				return;

			if (!IsHandleCreated) {
				base.Dispose ();
				return;
			}
 
			if (Menu != null)
				XplatUI.SetMenu (window.Handle, null);

			XplatUI.SendMessage(this.Handle, Msg.WM_CLOSE, IntPtr.Zero, IntPtr.Zero);

			closed = true;
		}

Usage Example

Example #1
1
		public void SelectRow_ShouldMaintain_ActivePosition()
		{
			// set up special conditions
			var grid = new Grid();
			grid.Redim(1, 1);
			grid[0, 0] = new Cell();
			
			var form = new Form();
			form.Controls.Add(grid);
			form.Show();

			grid.SelectionMode = GridSelectionMode.Row;
			grid.Selection.EnableMultiSelection = false;
			
			
			// just assert that we have correct conditions for test, 
			// active position should not be empty
			grid.Selection.Focus(new Position(0, 0), true);
			Assert.AreEqual(new Position(0, 0), grid.Selection.ActivePosition);
			
			// this method causes first row to be selected. Should not fail 
			// it failed once in RowSelection.SelectRow method
			// As call to ResetSelection asked to maintain focus, a stack overflow was raised
			grid.Selection.SelectRow(0, true);
			Assert.AreEqual(new Position(0, 0), grid.Selection.ActivePosition);
			
			// destroy
			form.Close();
			form.Dispose();
		}
All Usage Examples Of System.Windows.Forms.Form::Close
Form