Beispiel #1
0
        public void SetClipRectangle(int x, int y, int width, int height)
        {
            x += offset.X;
            y += offset.Y;

            var region = Gdi32API.CreateRectRgnChecked(x, y, x + width, y + height);

            try
            {
                Gdi32API.SelectClipRgn(hdc, region);
            }
            finally
            {
                Gdi32API.DeleteObject(region);
            }
        }
Beispiel #2
0
        private void FillOpaqueRectangleGDI(Color color, int x, int y, int width, int height)
        {
            // todo: check that width and height are exact
            var region = Gdi32API.CreateRectRgnChecked(x, y, x + width, y + height);

            try
            {
                // todo: pick FillRgn or PaintRgn
                Gdi32API.FillRgn(hdc, region, objectCache.GetSolidBrush(color));

                // SelectSolidBrush(color);
                // Gdi32API.PaintRgn(hdc, region);
            }
            finally
            {
                Gdi32API.DeleteObject(region);
            }
        }