Ejemplo n.º 1
0
        /// <summary>
        ///  Resets pinned icon location relative to parent when parent is moved.
        /// </summary>
        public void MoveToParentWindow()
        {
            Point newLocation = PinForm.GetRelativeLocation(this._parentHandle);

            this.Left = newLocation.X;
            this.Top  = newLocation.Y;
        }
Ejemplo n.º 2
0
        /// <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));
        }
Ejemplo n.º 3
0
        public static PinForm Create(IntPtr parentHandle)
        {
            PinForm pinForm = new PinForm(parentHandle);

            ApiTopMost.Set(parentHandle);
            PinForm.ShowSetOwnerHandle(pinForm, parentHandle);
            return(pinForm);
        }