graphics.Isvisible(点、区域)  :这些点,区域是否在绘图板的可见范围。

 

设置显示区域主要代码:

graphics.SetClip(范围,显示模式)

graphics.IntersetClip(用来相交的范围);//设置新范围为老范围和此输入范围的交集。

graphics.ResetClip();//重置


            Rectangle clipRect = new Rectangle(00200200);
            e.Graphics.SetClip(clipRect);
//设置显示区域为clisRect矩形范围

            
            Rectangle intersectRect 
= new Rectangle(100100200200);
            e.Graphics.IntersectClip(intersectRect);
//更新显示区域为,旧区域与矩形的交集

            e.Graphics.FillRectangle(
new SolidBrush(Color.Blue), 00500500);//绘图验证

            e.Graphics.ResetClip();
//重置显示区域

            e.Graphics.DrawRectangle(
new Pen(Color.Black), clipRect);//绘制这两个矩形范围
            e.Graphics.DrawRectangle(new Pen(Color.Red), intersectRect);

 

范围可以为:

 

1、指定区域

graphics1.SetClip(new Rectangle(0, 0, 100, 100));//设定为矩形区域

GraphicsPath clipPath = new GraphicsPath();
clipPath.AddEllipse(0, 0, 200, 100);
graphics.SetClip(clipPath, CombineMode.Replace);//设为某路径区域

 

 Region clipRegion = new Region(new Rectangle(0, 0, 100, 100));
graphics.SetClip(clipRegion, CombineMode.Replace);//设为某范围

graphics2.SetClip(graphics1, CombineMode.Replace);//另一个graphics区域

 

2 模式

CombineMode.***

 

 

相关文章:

  • 2022-12-23
  • 2021-10-12
  • 2021-12-04
  • 2022-12-23
  • 2021-09-04
  • 2022-12-23
  • 2022-01-06
  • 2021-10-28
猜你喜欢
  • 2021-12-04
  • 2022-03-10
  • 2021-11-19
  • 2021-06-16
  • 2022-12-23
  • 2021-08-14
  • 2022-12-23
相关资源
相似解决方案