graphics.Isvisible(点、区域) :这些点,区域是否在绘图板的可见范围。
设置显示区域主要代码:
graphics.SetClip(范围,显示模式)
graphics.IntersetClip(用来相交的范围);//设置新范围为老范围和此输入范围的交集。
graphics.ResetClip();//重置
Rectangle clipRect = new Rectangle(0, 0, 200, 200);
e.Graphics.SetClip(clipRect);//设置显示区域为clisRect矩形范围
Rectangle intersectRect = new Rectangle(100, 100, 200, 200);
e.Graphics.IntersectClip(intersectRect);//更新显示区域为,旧区域与矩形的交集
e.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 500, 500);//绘图验证
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.***