/// <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)); }