當前位置: 首頁>>代碼示例>>C#>>正文


C# Graphics.TranslateClip方法代碼示例

本文整理匯總了C#中System.Drawing.Graphics.TranslateClip方法的典型用法代碼示例。如果您正苦於以下問題:C# Graphics.TranslateClip方法的具體用法?C# Graphics.TranslateClip怎麽用?C# Graphics.TranslateClip使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Drawing.Graphics的用法示例。


在下文中一共展示了Graphics.TranslateClip方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TranslateClip

        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) );
        }
開發者ID:mono,項目名稱:sysdrawing-coregraphics,代碼行數:23,代碼來源:DrawingView.cs

示例2: DrawImageTranslateClip

        void DrawImageTranslateClip(Graphics g)
        {
            // Create rectangle for clipping region.
            var clipRect = new Rectangle (0, 0, 100, 100);

            // Set clipping region of graphics to rectangle.
            g.SetClip (clipRect);

            // Translate clipping region.
            int dx = 50;
            int dy = 50;
            g.TranslateClip (dx, dy);

            // Fill rectangle to demonstrate translated clip region.
            g.FillRectangle (new SolidBrush (Color.Black), 0, 0, 500, 300);
            title = "DrawImageTranslateClip";
        }
開發者ID:mono,項目名稱:sysdrawing-coregraphics,代碼行數:17,代碼來源:DrawingView.cs

示例3: Clip

 public static void Clip(Graphics g, int time, IGraph graph)
 {
     ClipPath path1 = graph.ClipPath;
     if ((path1 != null) && path1.ShowClip)
     {
         GraphicsPath path2 = path1.GetGraphicsPath(g, time);
         if (path1.ClipPathUnit == Units.ObjectBoundingBox)
         {
             GraphicsPath path3 = (GraphicsPath) graph.GPath.Clone();
             RectangleF ef1 = path3.GetBounds();
             float single1 = ef1.Left;
             RectangleF ef2 = path3.GetBounds();
             float single2 = ef2.Top;
             RectangleF ef3 = path3.GetBounds();
             float single3 = ef3.Width;
             RectangleF ef4 = path3.GetBounds();
             float single4 = ef4.Height;
             Matrix matrix1 = new Matrix();
             matrix1.Scale(single3, single4);
             path2.Transform(matrix1);
             g.SetClip(path2, CombineMode.Intersect);
             g.TranslateClip(single1, single2);
         }
         else
         {
             g.SetClip(path2, CombineMode.Intersect);
         }
     }
 }
開發者ID:EdgarEDT,項目名稱:myitoppsp,代碼行數:29,代碼來源:ClipPath.cs


注:本文中的System.Drawing.Graphics.TranslateClip方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。