Example #1
0
        /// <summary>
        /// Obtain the edge vertical and horizontal offset
        /// based on the current type of window
        /// </summary>
        /// <remarks>
        /// ThreeDBorderWindow : WINDOWEDGE + CLIENTEDGE + THICKFRAME
        /// SingleBorderWindow : WINDOWEDGE + THICKFRAME
        /// ToolWindow         : WINDOWEDGE + TOOLWINDOW + THICKFRAME
        /// </remarks>
        /// <returns>The width and height offset</returns>
        private EdgeOffset GetEdgeOffset()
        {
            EdgeOffset edgeOffset = new EdgeOffset();

            WS_EX ws_ex = UnsafeNativeMethods.GetWindowStyleEx(_hWnd);
            WS    ws    = UnsafeNativeMethods.GetWindowStyle(_hWnd);

            if ((ws_ex & WS_EX.WINDOWEDGE) == WS_EX.WINDOWEDGE)
            {
                edgeOffset.FixedFrame = new Size()
                {
                    Width  = SystemParameters.FixedFrameVerticalBorderWidth,
                    Height = SystemParameters.FixedFrameHorizontalBorderHeight
                };
            }

            if ((ws_ex & WS_EX.CLIENTEDGE) == WS_EX.CLIENTEDGE)
            {
                edgeOffset.ThickBorder = new Size()
                {
                    Width  = SystemParameters.ThickVerticalBorderWidth,
                    Height = SystemParameters.ThickHorizontalBorderHeight
                };
            }

            if ((ws_ex & WS_EX.TOOLWINDOW) == WS_EX.TOOLWINDOW)
            {
                edgeOffset.ThinBorder = new Size()
                {
                    Width  = SystemParameters.ThinVerticalBorderWidth,
                    Height = SystemParameters.ThinHorizontalBorderHeight
                };
            }

            if ((ws & WS.THICKFRAME) == WS.THICKFRAME)
            {
                edgeOffset.ResizeFrame = new Size()
                {
                    Width  = SystemParameters.ResizeFrameVerticalBorderWidth,
                    Height = SystemParameters.ResizeFrameHorizontalBorderHeight
                };
            }

            return(edgeOffset);
        }
 public EdgeOffsetChangedEventArgs(EdgeOffset offset)
 {
     Offset = offset;
 }