当前位置: 首页>>代码示例>>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;未经允许,请勿转载。