本文整理汇总了C#中System.Windows.Rect.Offset方法的典型用法代码示例。如果您正苦于以下问题:C# Rect.Offset方法的具体用法?C# Rect.Offset怎么用?C# Rect.Offset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Rect
的用法示例。
在下文中一共展示了Rect.Offset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: offsetExample1
private Point offsetExample1()
{
// Initialize new rectangle.
Rect myRectangle = new Rect();
// The Location property specifies the coordinates of the upper left-hand
// corner of the rectangle.
myRectangle.Location = new Point(10, 5);
// Set the Size property of the rectangle with a width of 200
// and a height of 50.
myRectangle.Size = new Size(200, 50);
// Create a vector to use to offset the position of the rectangle.
Vector vector1 = new Vector(20, 30);
// The Offset method translates this rectangle by the specified vector.
// myRectangle location changed from 10,5 to 30,35.
myRectangle.Offset(vector1);
// This rectangle's location changed from 10,5 to 30,35.
return myRectangle.Location;
}
示例2: offsetExample2
private Point offsetExample2()
{
// Initialize new rectangle.
Rect myRectangle = new Rect();
// The Location property specifies the coordinates of the upper left-hand
// corner of the rectangle.
myRectangle.Location = new Point(10, 5);
// Set the Size property of the rectangle with a width of 200
// and a height of 50.
myRectangle.Size = new Size(200, 50);
// The Offset method translates this rectangle by the specified horizontal and
// vertical amounts.
// myRectangle location changed from 10,5 to 30,35.
myRectangle.Offset(20,30);
// This rectangle's location changed from 10,5 to 30,35.
return myRectangle.Location;
}
示例3: offsetExample3
private Point offsetExample3()
{
// Initialize new rectangle.
Rect myRectangle = new Rect();
// The Location property specifies the coordinates of the upper left-hand
// corner of the rectangle.
myRectangle.Location = new Point(10, 5);
// Set the Size property of the rectangle with a width of 200
// and a height of 50.
myRectangle.Size = new Size(200, 50);
// Create a vector to use to offset the position of the rectangle.
Vector vector1 = new Vector(20, 30);
// The Offset method translates the specified rectangle by the specified amount
// and returns the resulting Rect.
// resultRect location changed from 10,5 to 30,35.
Rect resultRect = Rect.Offset(myRectangle, vector1);
// This rectangle's location changed from 10,5 to 30,35.
return resultRect.Location;
}
示例4: offsetExample4
private Point offsetExample4()
{
// Initialize new rectangle.
Rect myRectangle = new Rect();
// The Location property specifies the coordinates of the upper left-hand
// corner of the rectangle.
myRectangle.Location = new Point(10, 5);
// Set the Size property of the rectangle with a width of 200
// and a height of 50.
myRectangle.Size = new Size(200, 50);
// Create a vector to use to offset the position of the rectangle.
Vector vector1 = new Vector(20, 30);
// The Offset method translates the specified rectangle by the specified horizontal
// and vertical amounts and returns the resulting Rect.
// resultRect location changed from 10,5 to 30,35.
Rect resultRect = Rect.Offset(myRectangle, 20, 30);
// This rectangle's location changed from 10,5 to 30,35.
return resultRect.Location;
}