本文整理汇总了C#中IGraphics.SetClippingMask方法的典型用法代码示例。如果您正苦于以下问题:C# IGraphics.SetClippingMask方法的具体用法?C# IGraphics.SetClippingMask怎么用?C# IGraphics.SetClippingMask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGraphics
的用法示例。
在下文中一共展示了IGraphics.SetClippingMask方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoPaint
public static void DoPaint(IGraphics g, Control container, int addx, int addy)
{
DoPaintBackground(g, container);
if (container is Label){
DoPaint(g, (Label) container);
} else if (container is TextBox){
DoPaint(g, (TextBox) container);
} else if (container is RichTextBox){
DoPaint(g, (RichTextBox) container);
} else{
(container as BaseDrawControl)?.DoPaint(g);
foreach (Control control in container.Controls){
g.SetClippingMask(control.Width, control.Height, container.Location.X + control.Location.X + addx,
container.Location.Y + control.Location.Y + addy);
// Clipping mask: (50,50) 682x306
Debug.WriteLine("Clipping mask: (" + (container.Location.X + control.Location.X) + "," +
(container.Location.Y + control.Location.Y) + ") " + control.Width + "x" + control.Height);
if (control is TableLayoutPanel){
Debug.WriteLine("TableLayoutPanel");
DoPaint(g, control as TableLayoutPanel, container.Location.X + addx, container.Location.Y + addy);
} else if (control is SplitContainer){
Debug.WriteLine("SplitContainer");
DoPaint(g, control as SplitContainer);
} else if (control is SplitterPanel){
Debug.WriteLine("SplitterPanel");
DoPaint(g, control as SplitterPanel);
} else if (control is TextBox){
Debug.WriteLine("TextBox");
DoPaint(g, control as TextBox);
} else if (control is Label){
Debug.WriteLine("Label");
DoPaint(g, control as Label);
} else if (control is RichTextBox){
Debug.WriteLine("RichTextBox");
DoPaint(g, control as RichTextBox);
} else if (control is DataGridView){
Debug.WriteLine("DataGridView");
DoPaint(g, control as DataGridView);
} else if (control is BasicControl){
Debug.WriteLine("-" + control.GetType().Name);
((BasicControl) control).view.Print(g, control.Width, control.Height);
} else if (control is Panel){
DoPaint(g, control as Panel, container.Location.X + addx, container.Location.Y + addy);
} else{
DoPaint(g, control);
}
}
}
}