コード例 #1
0
ファイル: SkinEngine.cs プロジェクト: abdel1969/Snow_Player
        // Rebuild new region from previous one
        public static void BuildRegion(IntPtr hWnd)
        {
            IntPtr hRgnClip = IntPtr.Zero;

            Api.RECT rw = new Api.RECT();
            Api.GetWindowRect(hWnd, ref rw);
            int RgnWidth = rw.right - rw.left, RgnHeight = rw.bottom - rw.top;

            // Avoid changing region when iconized !
            if (RgnHeight < DockMin)
            {
                return;
            }

            if ((LastRgnWidth == RgnWidth) && (LastRgnHeight == RgnHeight))
            {
                return;
            }

            IntPtr hRgn = Api.CreateRectRgn(0, 0, 0, 0);

            if (hRgn != IntPtr.Zero)
            {
                if (Api.GetWindowRgn(hWnd, hRgn))
                {
                    hRgnClip = Api.CreateRectRgn(0, 0, RgnWidth, RgnHeight);
                    if (hRgnClip != IntPtr.Zero)
                    {
                        // Top left corner.
                        int rgnX = 0; int rgnY = 0;
                        CombineRegion(ref hRgnClip, hRgn, 0, 0, FixCaptionLeft, FixCaptionHeight, rgnX, rgnY);

                        // Top right corner.
                        rgnX = -LastRgnWidth + FixCaptionRight; rgnY = 0;
                        CombineRegion(ref hRgnClip, hRgn, RgnWidth - FixCaptionRight, 0, FixCaptionRight, FixCaptionHeight, rgnX, rgnY);

                        // Bottom left corner.
                        rgnX = 0; rgnY = -LastRgnHeight + FixBottomHeight;
                        CombineRegion(ref hRgnClip, hRgn, 0, RgnHeight - FixBottomHeight, FixCaptionLeft, FixBottomHeight, rgnX, rgnY);

                        // Bottom right corner.
                        rgnX = -LastRgnWidth + FixCaptionRight; rgnY = -LastRgnHeight + FixBottomHeight;
                        CombineRegion(ref hRgnClip, hRgn, RgnWidth - FixCaptionRight, RgnHeight - FixBottomHeight, FixCaptionRight, FixBottomHeight, rgnX, rgnY);

                        Form.FromHandle(hWnd).BackgroundImage = (Bitmap)SK.DrawBackGround(RgnWidth, RgnHeight);

                        // Set the new region to the form.
                        Api.SetWindowRgn(hWnd, hRgnClip, false);

                        // Save the new region size
                        LastRgnWidth = RgnWidth; LastRgnHeight = RgnHeight;
                    }
                }
                Api.DeleteObject(hRgn);
            }
        }
コード例 #2
0
ファイル: SkinTrackbar.cs プロジェクト: abdel1969/Snow_Player
 private bool CheckOverThumb(int x, int y)
 {
     Api.RECT r = new Api.RECT();
     r.left   = BLUE_Thumb.Left;
     r.top    = BLUE_Thumb.Top;
     r.right  = r.left + BLUE_Thumb.Width;
     r.bottom = r.top + BLUE_Thumb.Height;
     Api.POINT p = new Api.POINT();
     p.x = x; p.y = y;
     return(Api.PtInRect(ref r, p));
 }
コード例 #3
0
ファイル: SkinTrackbar.cs プロジェクト: fordream/store-vnp
 private bool CheckOverThumb(int x, int y)
 {
     Api.RECT r = new Api.RECT();
     r.left = BLUE_Thumb.Left;
     r.top = BLUE_Thumb.Top;
     r.right = r.left + BLUE_Thumb.Width;
     r.bottom = r.top + BLUE_Thumb.Height;
     Api.POINT p = new Api.POINT();
     p.x = x; p.y = y;
     return (Api.PtInRect(ref r, p));
 }