本文整理匯總了C#中System.Drawing.Drawing2D.RegionData類的典型用法代碼示例。如果您正苦於以下問題:C# RegionData類的具體用法?C# RegionData怎麽用?C# RegionData使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
RegionData類屬於System.Drawing.Drawing2D命名空間,在下文中一共展示了RegionData類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetRegionDataExample
public void GetRegionDataExample(PaintEventArgs e)
{
// Create a rectangle and draw it to the screen in black.
Rectangle regionRect = new Rectangle(20, 20, 100, 100);
e.Graphics.DrawRectangle(Pens.Black, regionRect);
// Create a region using the first rectangle.
Region myRegion = new Region(regionRect);
// Get the RegionData for this region.
RegionData myRegionData = myRegion.GetRegionData();
int myRegionDataLength = myRegionData.Data.Length;
DisplayRegionData(e, myRegionDataLength, myRegionData);
}
// THIS IS A HELPER FUNCTION FOR GetRegionData.
public void DisplayRegionData(PaintEventArgs e,
int len,
RegionData dat)
{
// Display the result.
int i;
float x = 20, y = 140;
Font myFont = new Font("Arial", 8);
SolidBrush myBrush = new SolidBrush(Color.Black);
e.Graphics.DrawString("myRegionData = ",
myFont,
myBrush,
new PointF(x, y));
y = 160;
for(i = 0; i < len; i++)
{
if(x > 300)
{
y += 20;
x = 20;
}
e.Graphics.DrawString(dat.Data[i].ToString(),
myFont,
myBrush,
new PointF(x, y));
x += 30;
}
}