/// <summary> /// Calculates absolute location of pin icon based on parent form's handle. /// </summary> /// <param name="handle">Parent window handle.</param> /// <returns>Absolute location of pin icon.</returns> private static Point GetRelativeLocation(IntPtr handle) { int rightMargin = PinForm.GetControlAreaWidth(handle) + 20; Rectangle move = ApiWindowPos.Get(handle); return(new Point(move.Left + move.Width - rightMargin, move.Top + 5)); }
/// <summary> /// Calculates absolute location of pin icon based on parent form's handle. /// </summary> /// <param name="handle">Parent window handle.</param> /// <returns>Absolute location of pin icon.</returns> private static Point GetRelativeLocation(IntPtr handle) { var style = new WindowStyle(handle); int rightMargin = style.GetControlBoxWidth() + 20; Rectangle move = ApiWindowPos.Get(handle); return(new Point(move.Left + move.Width - rightMargin, move.Top + 5)); }
/// <summary> /// Override in child form for custom /// </summary> protected virtual void MoveToParentWindow() { Rectangle parentRectangle = ApiWindowPos.Get(ParentHandle); MoveToParent(parentRectangle); }