System.Drawing.Graphics.TranslateClip C# (CSharp) Method

TranslateClip() public method

public TranslateClip ( float dx, float dy ) : void
dx float
dy float
return void
        public void TranslateClip(float dx, float dy)
        {
            clipRegion.Translate (dx, dy);
            SetClip (clipRegion, CombineMode.Replace);
        }

Same methods

Graphics::TranslateClip ( int dx, int dy ) : void

Usage Example

        public void TranslateClip(Graphics g)
        {
            Pen myPen = new Pen(Color.FromArgb(196, 0xC3, 0xC9, 0xCF), (float)0.6);
            SolidBrush myBrush = new SolidBrush(Color.FromArgb(127, 0xDD, 0xDD, 0xF0));

            // Create the first rectangle and draw it to the screen in blue.
            Rectangle regionRect = new Rectangle(100, 50, 100, 100);
            g.DrawRectangle(myPen, regionRect);
            g.FillRectangle (myBrush, regionRect);

            // Create a region using the first rectangle.
            Region myRegion = new Region(regionRect);

            g.Clip = myRegion;

            // Apply the translation to the region.
            g.TranslateClip(150, 100);

            // Fill the transformed region with red and draw it to the screen in red.
            myBrush.Color = Color.FromArgb(127, 0x66, 0xEF, 0x7F);
            myPen.Color = Color.FromArgb(255, 0, 0x33, 0);
            g.FillRectangle(myBrush, new Rectangle(0,0,500,500) );
        }
All Usage Examples Of System.Drawing.Graphics::TranslateClip