/// <summary> /// Make the form Sticky /// </summary> /// <param name="formAdapter">Form to be made sticky</param> public StickyWindow(BaseFormAdapter formAdapter) { _resizingForm = false; _movingForm = false; _originalFormAdapter = formAdapter; _formRect = Rectangle.Empty; _formOffsetRect = Rectangle.Empty; _formOffsetPoint = Point.Empty; _offsetPoint = Point.Empty; _mousePoint = Point.Empty; StickOnMove = true; StickOnResize = true; StickToScreen = true; StickToOther = true; _defaultMessageProcessor = DefaultMsgProcessor; _moveMessageProcessor = MoveMsgProcessor; _resizeMessageProcessor = ResizeMsgProcessor; _messageProcessor = _defaultMessageProcessor; AssignHandle(_originalFormAdapter.Handle); }
/// <summary> /// Unregister a form from the external references. /// <see cref="RegisterExternalReferenceForm(BaseFormAdapter)"/> /// </summary> /// <param name="frmExternal">External window that will was used as reference</param> public static void UnregisterExternalReferenceForm(BaseFormAdapter frmExternal) { _globalStickyWindows.Remove(frmExternal); }
/// <summary> /// Register a new form as an external reference form. /// All Sticky windows will try to stick to the external references /// Use this to register your MainFrame so the child windows try to stick to it, when your MainFrame is NOT a sticky window /// </summary> /// <param name="frmExternal">External window that will be used as reference</param> public static void RegisterExternalReferenceForm(BaseFormAdapter frmExternal) { _globalStickyWindows.Add(frmExternal); }