本文整理匯總了C#中System.Drawing.Point結構體的典型用法代碼示例。如果您正苦於以下問題:C# Point結構體的具體用法?C# Point怎麽用?C# Point使用的例子?那麽, 這裏精選的結構體代碼示例或許可以為您提供幫助。
Point結構體屬於System.Drawing命名空間,在下文中一共展示了Point結構體的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CreatePointsAndSizes
private void CreatePointsAndSizes(PaintEventArgs e)
{
// Create the starting point.
Point startPoint = new Point(subtractButton.Size);
// Use the addition operator to get the end point.
Point endPoint = startPoint + new Size(140, 150);
// Draw a line between the points.
e.Graphics.DrawLine(SystemPens.Highlight, startPoint, endPoint);
// Convert the starting point to a size and compare it to the
// subtractButton size.
Size buttonSize = (Size)startPoint;
if (buttonSize == subtractButton.Size)
// If the sizes are equal, tell the user.
{
e.Graphics.DrawString("The sizes are equal.",
new Font(this.Font, FontStyle.Italic),
Brushes.Indigo, 10.0F, 65.0F);
}
}
示例2: new Point(int x, int y)
//引入命名空間
using System;
using System.Drawing;
class MainClass
{
public static int Main(string[] args)
{
Point pt = new Point(100, 72);
Console.WriteLine(pt);
pt.Offset(20, 20);
Console.WriteLine(pt);
return 0;
}
}