当前位置: 首页>>代码示例>>C#>>正文


C# Graphics.SetClip方法代码示例

本文整理汇总了C#中System.Drawing.Graphics.SetClip方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics.SetClip方法的具体用法?C# Graphics.SetClip怎么用?C# Graphics.SetClip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Drawing.Graphics的用法示例。


在下文中一共展示了Graphics.SetClip方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetClipRectangleFCombine

private void SetClipRectangleFCombine(PaintEventArgs e)
{

    // Create rectangle for clipping region.
    RectangleF clipRect = new RectangleF(0.0F, 0.0F, 100.0F, 100.0F);

    // Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect, CombineMode.Replace);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
开发者ID:.NET开发者,项目名称:System.Drawing,代码行数:12,代码来源:Graphics.SetClip

示例2: SetClipRegionCombine

private void SetClipRegionCombine(PaintEventArgs e)
{

    // Create region for clipping.
    Region clipRegion = new Region(new Rectangle(0, 0, 100, 100));

    // Set clipping region of graphics to region.
    e.Graphics.SetClip(clipRegion, CombineMode.Replace);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
开发者ID:.NET开发者,项目名称:System.Drawing,代码行数:12,代码来源:Graphics.SetClip

示例3: SetClipRectangleCombine

private void SetClipRectangleCombine(PaintEventArgs e)
{

    // Create rectangle for clipping region.
    Rectangle clipRect = new Rectangle(0, 0, 100, 100);

    // Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect, CombineMode.Replace);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
开发者ID:.NET开发者,项目名称:System.Drawing,代码行数:12,代码来源:Graphics.SetClip

示例4: SetClipPathCombine

private void SetClipPathCombine(PaintEventArgs e)
{

    // Create graphics path.
    GraphicsPath clipPath = new GraphicsPath();
    clipPath.AddEllipse(0, 0, 200, 100);

    // Set clipping region to path.
    e.Graphics.SetClip(clipPath, CombineMode.Replace);

    // Fill rectangle to demonstrate clipping region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
开发者ID:.NET开发者,项目名称:System.Drawing,代码行数:13,代码来源:Graphics.SetClip

示例5: SetClipGraphicsCombine

private void SetClipGraphicsCombine(PaintEventArgs e)
{

    // Create temporary graphics object and set its clipping region.
    Graphics newGraphics = this.CreateGraphics();
    newGraphics.SetClip(new Rectangle(0, 0, 100, 100));

    // Update clipping region of graphics to clipping region of new

    // graphics.
    e.Graphics.SetClip(newGraphics, CombineMode.Replace);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);

    // Release new graphics.
    newGraphics.Dispose();
}
开发者ID:.NET开发者,项目名称:System.Drawing,代码行数:18,代码来源:Graphics.SetClip

示例6: SetClipRectangle

private void SetClipRectangle(PaintEventArgs e)
{

    // Create rectangle for clipping region.
    Rectangle clipRect = new Rectangle(0, 0, 100, 100);

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

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
开发者ID:.NET开发者,项目名称:System.Drawing,代码行数:12,代码来源:Graphics.SetClip

示例7: SetClipGraphics

private void SetClipGraphics(PaintEventArgs e)
{

    // Create temporary graphics object and set its clipping region.
    Graphics newGraphics = this.CreateGraphics();
    newGraphics.SetClip(new Rectangle(0, 0, 100, 100));

    // Update clipping region of graphics to clipping region of new

    // graphics.
    e.Graphics.SetClip(newGraphics);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);

    // Release new graphics.
    newGraphics.Dispose();
}
开发者ID:.NET开发者,项目名称:System.Drawing,代码行数:18,代码来源:Graphics.SetClip

示例8: SetClipPath

private void SetClipPath(PaintEventArgs e)
{

    // Create graphics path.
    GraphicsPath clipPath = new GraphicsPath();
    clipPath.AddEllipse(0, 0, 200, 100);

    // Set clipping region to path.
    e.Graphics.SetClip(clipPath);

    // Fill rectangle to demonstrate clipping region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
开发者ID:.NET开发者,项目名称:System.Drawing,代码行数:13,代码来源:Graphics.SetClip

示例9: SetClipRectangleF

private void SetClipRectangleF(PaintEventArgs e)
{

    // Create rectangle for clipping region.
    RectangleF clipRect = new RectangleF(0.0F, 0.0F, 100.0F, 100.0F);

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

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
开发者ID:.NET开发者,项目名称:System.Drawing,代码行数:12,代码来源:Graphics.SetClip

示例10: Main

//引入命名空间
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
   
class KeyholeClip: Form
{
     protected Image        image;
     protected GraphicsPath path;
   
     public static void Main()
     {
          Application.Run(new KeyholeClip());
     }
     public KeyholeClip()
     {
          ResizeRedraw = true;
          image = Image.FromFile("Color.jpg");
   
          path = new GraphicsPath();
          path.AddArc(80, 0, 80, 80, 45, -270);
          path.AddLine(70, 180, 170, 180);
     }
     protected override void OnPaint(PaintEventArgs pea)
     {
          pea.Graphics.SetClip(path);
          pea.Graphics.DrawImage(image, 0, 0, image.Width, image.Height);
     }      

}
开发者ID:C#程序员,项目名称:System.Drawing,代码行数:31,代码来源:Graphics.SetClip

示例11: Graphics.SetClip(path, (CombineMode)miCombineMode.Index)

//引入命名空间
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
   
class ClippingCombinations: Form
{
     string   strCaption = "CombineMode = ";
     MenuItem miCombineMode;
   
     public static void Main()
     {
          Application.Run(new ClippingCombinations());
     }
     protected override void OnPaint(PaintEventArgs pea)
     {
          DoPage(pea.Graphics, ForeColor,ClientSize.Width, ClientSize.Height);
     }      
     public ClippingCombinations()
     {
          ResizeRedraw = true;
   
          Menu = new MainMenu();
          Menu.MenuItems.Add("&CombineMode");
   
          EventHandler ehClick = new EventHandler(MenuCombineModeOnClick);
          
          for (int i = 0; i < 6; i++)
          {
               MenuItem mi   = new MenuItem("&" + (CombineMode)i);
               mi.Click     += ehClick;
               mi.RadioCheck = true;
   
               Menu.MenuItems[0].MenuItems.Add(mi);
          }
          miCombineMode = Menu.MenuItems[0].MenuItems[0];
          miCombineMode.Checked = true;
     }
     void MenuCombineModeOnClick(object obj, EventArgs ea)
     {
          miCombineMode.Checked = false;
          miCombineMode = (MenuItem) obj;
          miCombineMode.Checked = true;
   
          Text = strCaption + (CombineMode)miCombineMode.Index;
          Invalidate();
     }
     protected void DoPage(Graphics grfx, Color clr, int cx, int cy)
     {
          GraphicsPath path = new GraphicsPath();
          path.AddEllipse(0, 0, 2 * cx / 3, cy);
          grfx.SetClip(path);
   
          path.Reset();
          path.AddEllipse(cx / 3, 0, 2 * cx / 3, cy);
          grfx.SetClip(path, (CombineMode)miCombineMode.Index);
   
          grfx.FillRectangle(Brushes.Red, 0, 0, cx, cy);
     }
}
开发者ID:C#程序员,项目名称:System.Drawing,代码行数:61,代码来源:Graphics.SetClip


注:本文中的System.Drawing.Graphics.SetClip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。