本文整理汇总了C#中System.Drawing.Point.Offset方法的典型用法代码示例。如果您正苦于以下问题:C# System.Drawing.Point.Offset方法的具体用法?C# System.Drawing.Point.Offset怎么用?C# System.Drawing.Point.Offset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Point
的用法示例。
在下文中一共展示了System.Drawing.Point.Offset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestGesture_ZoomWithInertialMotion_ViewportUpdatesCorrectly
public void TestGesture_ZoomWithInertialMotion_ViewportUpdatesCorrectly()
{
IWebElement vcElem = Driver.FindElement(By.Id("vc"));
Assert.IsNotNull(vcElem, "err: cannot find canvas element");
Assert.IsTrue(vcElem.Size.Width > 10 && vcElem.Size.Height > 10, "err: canvas size should be atleast (10px,10px) to run test");
int width = vcElem.Size.Width - 10; // assuming a max border width of 5px on each side
int height = vcElem.Size.Height - 10;
VirtualCanvasComponent vc = new VirtualCanvasComponent(Driver);
vc.SetVisible(new JsVisible(-3194.8898068225376, 401.0288546497742, 0.38537988462392836));
vc.UpdateViewport();
Random rnd = new Random();
Point zoomPt = new Point(rnd.Next(0, width), rnd.Next(0, height));
zoomPt.Offset(5, 5);
JsCoordinates p1 = vc.PointScreenToVirtual(new JsCoordinates(zoomPt.X, zoomPt.Y));
action = new ActionsExtension(Driver);
action.MoveToElement(vcElem, Convert.ToInt32(zoomPt.X), Convert.ToInt32(zoomPt.Y));
action.DoubleClick();
action.Perform();
vc.WaitAnimation();
JsCoordinates p2 = vc.PointVirtualToScreen(p1);
// Assert that the zoom-pt remains fixed after zooming.
Assert.AreEqual(zoomPt.X, p2.X, 5);
Assert.AreEqual(zoomPt.Y, p2.Y, 5);
}
示例2: AC_WirelessTransmitter
private void AC_WirelessTransmitter(TestContext context) {
DPoint testOffset = new DPoint(422, 371);
context.Phase = "1-1";
this.Config.WirelessTransmitterConfigs[ComponentConfigProfile.Default].Range = 3;
this.Config.WirelessTransmitterConfigs[ComponentConfigProfile.Default].Cooldown = 0;
this.MetadataHandler.Metadata.WirelessTransmitters.Clear();
this.MetadataHandler.Metadata.WirelessTransmitters.Add(testOffset, this.GetTestPlayer().Name);
this.MetadataHandler.Metadata.WirelessTransmitters.Add(testOffset.OffsetEx(2, 0), this.GetTestPlayer().Name);
this.QuickProcessCircuit(testOffset.X, testOffset.Y + 3);
TAssert.IsObjectInactive(testOffset.X + 2, testOffset.Y + 3);
context.Phase = "1-2";
this.QuickProcessCircuit(testOffset.X, testOffset.Y + 3);
TAssert.IsObjectActive(testOffset.X + 2, testOffset.Y + 3);
context.Phase = "1-3";
this.QuickProcessCircuit(testOffset.X, testOffset.Y + 3);
TAssert.IsObjectInactive(testOffset.X + 2, testOffset.Y + 3);
context.Phase = "2-1";
testOffset.Offset(5, 0);
this.MetadataHandler.Metadata.WirelessTransmitters.Add(testOffset, this.GetTestPlayer().Name);
this.MetadataHandler.Metadata.WirelessTransmitters.Add(testOffset.OffsetEx(2, 0), this.GetTestPlayer().Name);
this.QuickProcessCircuit(testOffset.X, testOffset.Y + 3);
TAssert.IsObjectActive(testOffset.X + 2, testOffset.Y + 3);
context.Phase = "2-2";
this.QuickProcessCircuit(testOffset.X, testOffset.Y + 3);
TAssert.IsObjectActive(testOffset.X + 2, testOffset.Y + 3);
context.Phase = "2-3";
this.QuickProcessCircuit(testOffset.X, testOffset.Y + 3);
TAssert.IsObjectActive(testOffset.X + 2, testOffset.Y + 3);
context.Phase = "3-1";
this.Config.WirelessTransmitterConfigs[ComponentConfigProfile.Default].Range = 6;
testOffset.Offset(5, 0);
this.MetadataHandler.Metadata.WirelessTransmitters.Add(testOffset, this.GetTestPlayer().Name);
this.MetadataHandler.Metadata.WirelessTransmitters.Add(testOffset.OffsetEx(2, 0), this.GetTestPlayer().Name);
this.MetadataHandler.Metadata.WirelessTransmitters.Add(testOffset.OffsetEx(4, 0), this.GetTestPlayer().Name);
this.QuickProcessCircuit(testOffset.X, testOffset.Y + 3);
TAssert.IsObjectInactive(testOffset.X + 2, testOffset.Y + 3);
TAssert.IsObjectActive(testOffset.X + 4, testOffset.Y + 3);
context.Phase = "3-2";
this.QuickProcessCircuit(testOffset.X, testOffset.Y + 3);
TAssert.IsObjectActive(testOffset.X + 2, testOffset.Y + 3);
TAssert.IsObjectInactive(testOffset.X + 4, testOffset.Y + 3);
context.Phase = "3-3";
this.QuickProcessCircuit(testOffset.X, testOffset.Y + 3);
TAssert.IsObjectInactive(testOffset.X + 2, testOffset.Y + 3);
TAssert.IsObjectActive(testOffset.X + 4, testOffset.Y + 3);
}
示例3: TestGesture_PanWithInertialMotion_ViewportUpdatesCorrectly
public void TestGesture_PanWithInertialMotion_ViewportUpdatesCorrectly()
{
IWebElement vcElem = Driver.FindElement(By.Id("vc"));
Assert.IsNotNull(vcElem, "err: cannot find canvas element");
Assert.IsTrue(vcElem.Size.Width > 10 && vcElem.Size.Height > 10, "err: canvas size should be atleast (10px,10px) to run test");
int width = vcElem.Size.Width - 10; // assuming a max border width of 5px on each side
int height = vcElem.Size.Height - 10;
VirtualCanvasComponent vc = new VirtualCanvasComponent(Driver);
vc.SetVisible(new JsVisible(-3194.8898068225376, 401.0288546497742, 0.38537988462392836));
vc.UpdateViewport();
Random rnd = new Random();
Point panStart = new Point(rnd.Next(width), rnd.Next(height));
panStart.Offset(5, 5);
Point panEnd = new Point(rnd.Next(width), rnd.Next(height));
panEnd.Offset(5, 5);
Vector pan = new Vector(panEnd.X - panStart.X, panEnd.Y - panStart.Y);
JsCoordinates p1 = vc.PointScreenToVirtual(new JsCoordinates(panStart.X, panStart.Y));
action = new ActionsExtension(Driver);
action.MoveToElement(vcElem, panStart.X, panStart.Y);
action.ClickAndHold();
action.MoveByOffset(Convert.ToInt32(pan.X), Convert.ToInt32(pan.Y));
action.Release();
action.Perform();
vc.WaitAnimation();
JsCoordinates p2 = vc.PointVirtualToScreen(p1);
// Assert that start-pt wrt the newViewport corresponds to end-pt in the oldViewport
Assert.AreEqual(panEnd.X, p2.X, 5);
Assert.AreEqual(panEnd.Y, p2.Y, 5);
}