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

CreateHandle() private method

private CreateHandle ( ) : void
return void
		protected override void CreateHandle() {
			base.CreateHandle ();

			if (!IsHandleCreated) {
				return;
			}
			
			UpdateBounds();

			if ((XplatUI.SupportsTransparency() & TransparencySupport.Set) != 0) {
				if (allow_transparency) {
					XplatUI.SetWindowTransparency(Handle, opacity, TransparencyKey);
				}
			}

			XplatUI.SetWindowMinMax(window.Handle, maximized_bounds, minimum_size, maximum_size);
			
			if (show_icon && (FormBorderStyle != FormBorderStyle.FixedDialog) && (icon != null)) {
				XplatUI.SetIcon(window.Handle, icon);
			}

			if ((owner != null) && (owner.IsHandleCreated)) {
				XplatUI.SetOwner(window.Handle, owner.window.Handle);
			}

			if (topmost) {
				XplatUI.SetTopmost(window.Handle, topmost);
			}

			for (int i = 0; i < owned_forms.Count; i++) {
				if (owned_forms[i].IsHandleCreated)
					XplatUI.SetOwner(owned_forms[i].window.Handle, window.Handle);
			}
			
			if (window_manager != null) {
				if (IsMdiChild && VisibleInternal) {
					MdiWindowManager wm;
					// Loop through all the other mdi siblings and raise Deactivate events.
					if (MdiParent != null) {
						foreach (Form form in MdiParent.MdiChildren) {
							wm = form.window_manager as MdiWindowManager;
							if (wm != null && form != this) {
								// This will only raise deactivate once, and only if activate has
								// already been raised.
								wm.RaiseDeactivate ();
							}
						}
					}
					
					wm = window_manager as MdiWindowManager;
					wm.RaiseActivated ();

					// We need to tell everyone who may have just been deactivated to redraw their titlebar
					if (MdiParent != null)
						foreach (Form form in MdiParent.MdiChildren)
							if (form != this && form.IsHandleCreated)
								XplatUI.InvalidateNC (form.Handle);
				}
				
				if (window_state != FormWindowState.Normal) {
					window_manager.SetWindowState ((FormWindowState) int.MaxValue, window_state);
				}
				XplatUI.RequestNCRecalc (window.Handle);
			}

		}
Form