本文整理汇总了C#中System.Windows.Point.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Point.ToString方法的具体用法?C# Point.ToString怎么用?C# Point.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Point
的用法示例。
在下文中一共展示了Point.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Defaults
public void Defaults ()
{
Point p = new Point ();
Assert.AreEqual (0.0, p.X, "X");
Assert.AreEqual (0.0, p.Y, "Y");
Assert.AreEqual ("0,0", p.ToString (), "ToString");
Compare (p);
}
示例2: NegativeInfinity
public void NegativeInfinity ()
{
Point p = new Point (Double.NegativeInfinity, Double.NegativeInfinity);
Assert.IsTrue (Double.IsNegativeInfinity (p.X), "X");
Assert.IsTrue (Double.IsNegativeInfinity (p.Y), "Y");
Assert.AreEqual (String.Format ("{0},{0}",Double.NegativeInfinity,Double.NegativeInfinity), p.ToString ());
//Assert.AreEqual ("-Infinity,-Infinity", p.ToString (), "ToString");
Compare (p);
}
示例3: MakeFormattedString
private FormattedText MakeFormattedString(Point point)
{
string testString = point.ToString();
FormattedText formattedText = new FormattedText(testString,
System.Globalization.CultureInfo.GetCultureInfo("ko-kr"),
FlowDirection.LeftToRight,
new Typeface("Verdana"), 16, Brushes.Black);
return formattedText;
}
示例4: AddLines
private void AddLines()
{
Point pt1 = new Point();
Point pt2 = new Point();
pt1.X = Convert.ToDouble(tbX1.Text);
pt1.Y = Convert.ToDouble(tbY1.Text);
pt2.X = Convert.ToDouble(tbX2.Text);
pt2.Y = Convert.ToDouble(tbY2.Text);
double length = 0.5 * Convert.ToDouble(tbLength.Text);
line1 = new Line();
line1.X1 = pt1.X;
line1.Y1 = pt1.Y;
line1.X2 = pt2.X;
line1.Y2 = pt2.Y;
line1.Stroke = Brushes.Gray;
line1.StrokeThickness = 4;
canvas1.Children.Add(line1);
Canvas.SetLeft(tbPoint1, pt1.X);
Canvas.SetTop(tbPoint1, pt1.Y);
Canvas.SetLeft(tbPoint2, pt2.X);
Canvas.SetTop(tbPoint2, pt2.Y);
tbPoint1.Text = "Pt1(" + pt1.ToString() + ")";
tbPoint2.Text = "Pt2(" + pt2.ToString() + ")";
Vector v1 = pt1 - pt2;
Matrix m1 = new Matrix();
Point pt3 = new Point();
Point pt4 = new Point();
m1.Rotate(-90);
v1.Normalize();
v1 *= length;
line2 = new Line();
line2.Stroke = Brushes.Gray;
line2.StrokeThickness = 4;
line2.StrokeDashArray = DoubleCollection.Parse("3, 1");
pt3 = pt2 + v1 * m1;
m1 = new Matrix();
m1.Rotate(90);
pt4 = pt2 + v1 * m1;
line2.X1 = pt3.X;
line2.Y1 = pt3.Y;
line2.X2 = pt4.X;
line2.Y2 = pt4.Y;
canvas1.Children.Add(line2);
Canvas.SetLeft(tbPoint3, pt3.X);
Canvas.SetTop(tbPoint3, pt3.Y);
Canvas.SetLeft(tbPoint4, pt4.X);
Canvas.SetTop(tbPoint4, pt4.Y);
pt3.X = Math.Round(pt3.X, 0);
pt3.Y = Math.Round(pt3.Y, 0);
pt4.X = Math.Round(pt4.X, 0);
pt4.Y = Math.Round(pt4.Y, 0);
tbPoint3.Text = "Pt3(" + pt3.ToString() + ")";
tbPoint4.Text = "Pt4(" + pt4.ToString() + ")";
}
示例5: NaN
public void NaN ()
{
Point p = new Point (Double.NaN, Double.NaN);
Assert.IsTrue (Double.IsNaN (p.X), "X");
Assert.IsTrue (Double.IsNaN (p.Y), "Y");
Assert.AreEqual ("NaN,NaN", p.ToString (), "ToString");
// special reserved case
Point p2 = p;
Assert.IsFalse (p.Equals ((object) p2), "Equals(object)");
Assert.IsFalse (p.Equals (p2), "Equals(Point)");
Assert.IsFalse (p == p2, "==");
Assert.IsTrue (p != p2, "!=");
}
示例6: ToStringTest
public void ToStringTest ()
{
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-us");
Point p = new Point (4, 5);
Assert.AreEqual ("4,5", p.ToString());
Point p2 = new Point(4.1, 5.1);
Assert.AreEqual("4.1,5.1",p2.ToString());
Point p3 = new Point(0, 0);
Assert.AreEqual("0,0", p3.ToString());
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("de-de");
Point p4 = new Point(4, 5);
Assert.AreEqual("4;5", p4.ToString());
Point p5 = new Point(4.1, 5.1);
Assert.AreEqual("4,1;5,1", p5.ToString());
Point p6 = new Point(0, 0);
Assert.AreEqual("0;0", p6.ToString());
}
示例7: TS_CreatePoint
internal void TS_CreatePoint(ref TextPatternRange range, Rect[] boundRects, out Point screenLocation, BoundingRectangleLocation boundRectLoc, CheckType checkType)
{
int rectIdx = 0;
Rect autoElementRect = new Rect();
Rect[] tempRects = new Rect[0];
TextPatternRange documentRange = Pattern_DocumentRange(CheckType.Verification);
screenLocation = new Point();
// Sanity check
Library.ValidateArgumentNonNull(range, "range argument cannot be null");
if ((boundRects.Length == 0) && (boundRectLoc != BoundingRectangleLocation.OutsideAutomationElement))
{
throw new ArgumentException("TS_CreatePoint requires non-empty array of bounding rectangles");
}
// Finally, generate the point!
switch (boundRectLoc)
{
case BoundingRectangleLocation.InsideTopLeft:
rectIdx = 0;
screenLocation.X = boundRects[rectIdx].Left + 1;
screenLocation.Y = boundRects[rectIdx].Top + 1;
break;
case BoundingRectangleLocation.Middle:
screenLocation.X = (boundRects[rectIdx].Left + boundRects[rectIdx].Right) / 2;
screenLocation.Y = (boundRects[rectIdx].Top + boundRects[rectIdx].Bottom) / 2;
break;
case BoundingRectangleLocation.InsideBottomRight:
rectIdx = boundRects.Length - 1;
screenLocation.X = boundRects[rectIdx].Right - 1;
screenLocation.Y = boundRects[rectIdx].Bottom - 1;
break;
case BoundingRectangleLocation.OutsideBottomRight:
rectIdx = boundRects.Length - 1;
screenLocation.X = boundRects[rectIdx].Right + 1;
screenLocation.Y = boundRects[rectIdx].Bottom + 1;
break;
case BoundingRectangleLocation.OutsideTopLeft:
rectIdx = 0;
screenLocation.X = boundRects[rectIdx].Left - 1;
screenLocation.Y = boundRects[rectIdx].Top - 1;
break;
case BoundingRectangleLocation.OutsideAutomationElement:
// Get automation element bounding rectangle
GetAutomationElementBoundingRectangle(out autoElementRect);
screenLocation.X = autoElementRect.Left - 1;
screenLocation.Y = autoElementRect.Top - 1;
break;
case BoundingRectangleLocation.FirstChar:
tempRects = null;
Range_GetBoundingRectangles(documentRange, ref tempRects, null, checkType);
if (tempRects.Length == 0)
ThrowMe(checkType, "TS_CreatePoint expects non-empy bounding rectangles array for document");
screenLocation.X = tempRects[0].Left + 1; // essentially top-left of first rect
screenLocation.Y = tempRects[0].Top + 1;
break;
case BoundingRectangleLocation.FirstCharInRange:
rectIdx = 0;
screenLocation.X = boundRects[0].Left + 1; // essentially top-left of first rect
screenLocation.Y = boundRects[0].Top + 1;
break;
case BoundingRectangleLocation.LastCharInRange:
rectIdx = boundRects.Length - 1;
screenLocation.X = boundRects[rectIdx].Right - 1; // essentially bottom-right of last rect
screenLocation.Y = boundRects[rectIdx].Bottom - 1;
break;
default:
throw new ArgumentException("TS_CreatePoint() has no support for " + ParseType(boundRectLoc));
}
Comment("Created Point (" + screenLocation.ToString(CultureInfo.InvariantCulture) + ") at " +
Parse(boundRectLoc) +
" relative to boundRect " +
(boundRectLoc != BoundingRectangleLocation.OutsideAutomationElement ?
boundRects[rectIdx].ToString(CultureInfo.InvariantCulture) :
autoElementRect.ToString(CultureInfo.InvariantCulture)));
m_TestStep++;
}
示例8: ShowVars
// Method to display the variables used in the operations
public void ShowVars()
{
// Displays the values of the variables
var p1 = new Point(10, 5);
var p2 = new Point(15, 40);
var v1 = new System.Windows.Vector(20, 30);
var v2 = new System.Windows.Vector(45, 70);
var m1 = new Matrix(40, 50, 60, 70, 80, 90);
double s1 = 75;
txtPoint1.Text = p1.ToString();
txtPoint2.Text = p2.ToString();
txtVector1.Text = v1.ToString();
txtVector2.Text = v2.ToString();
txtMatrix1.Text = m1.ToString();
txtScalar1.Text = s1.ToString(CultureInfo.InvariantCulture);
}
示例9: PerformOperation
public void PerformOperation(object sender, RoutedEventArgs e)
{
var li = sender as RadioButton;
// Strings used to display results
string syntaxString, resultType, operationString;
switch (li?.Name)
{
//begin switch
case "rb1":
{
// Translates a Point by a Vector using the overloaded + operator.
var point1 = new Point(10, 5);
var vector1 = new System.Windows.Vector(20, 30);
var pointResult = point1 + vector1;
// pointResult is equal to (-10,-25)
// Displaying Results
syntaxString = "pointResult = point1 + vector1;";
resultType = "Point";
operationString = "Translating a Point by a Vector";
ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb2":
{
// Adds a Vector to a Vector using the overloaded + operator.
var vector1 = new System.Windows.Vector(20, 30);
var vector2 = new System.Windows.Vector(45, 70);
// vectorResult is equal to (65,100)
var vectorResult = vector1 + vector2;
// Displaying Results
syntaxString = "vectorResult = vector1 + vector2;";
resultType = "Vector";
operationString = "Adding a Vector to a Vector";
ShowResults(vectorResult.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb3":
{
// Adds a Vector to a Vector using the static Add method.
var vector1 = new System.Windows.Vector(20, 30);
var vector2 = new System.Windows.Vector(45, 70);
var vectorResult = System.Windows.Vector.Add(vector1, vector2);
// vectorResult is equal to (65,100)
// Displaying Results
syntaxString = "vectorResult = Vector.Add(vector1, vector2);";
resultType = "Vector";
operationString = "Adding a Vector to a Vector";
ShowResults(vectorResult.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb4":
{
// Translates a Point by a Vector using the static Add method.
var vector1 = new System.Windows.Vector(20, 30);
var point1 = new Point(10, 5);
var pointResult = System.Windows.Vector.Add(vector1, point1);
// vectorResult is equal to (30,35)
// Displaying Results
syntaxString = "pointResult = Vector.Add(vector1, point1);";
resultType = "Point";
operationString = "Translating a Point by a Vector";
ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb5":
{
// Subtracts a Vector from a Vector using the overloaded - operator.
var vector1 = new System.Windows.Vector(20, 30);
var vector2 = new System.Windows.Vector(45, 70);
var vectorResult = vector1 - vector2;
// vector Result is equal to (-25, -40)
// Displaying Results
//.........这里部分代码省略.........
示例10: ShowVars
// Method to display the variables used in the operations
public void ShowVars()
{
// Displays the values of the variables
System.Windows.Point p1 = new System.Windows.Point(10, 5);
System.Windows.Point p2 = new System.Windows.Point(15, 40);
Vector v1 = new Vector(20, 30);
Vector v2 = new Vector(45, 70);
Matrix m1 = new Matrix(40, 50, 60, 70, 80, 90);
Double s1 = 75;
txtPoint1.Text = p1.ToString();
txtPoint2.Text = p2.ToString();
txtVector1.Text = v1.ToString();
txtVector2.Text = v2.ToString();
txtMatrix1.Text = m1.ToString();
txtScalar1.Text = s1.ToString();
}
示例11: ShowVars
// Displays the values of the variables
public void ShowVars()
{
Point p1 = new Point(10, 5);
Point p2 = new Point(15, 40);
Vector v1 = new Vector(20, 30);
Vector v2 = new Vector(45, 70);
Matrix m1 = new Matrix(40, 50, 60, 70, 80, 90);
// Displaying values in Text objects
txtPoint1.Text = p1.ToString();
txtPoint2.Text = p2.ToString();
txtVector1.Text = v1.ToString();
txtVector2.Text = v2.ToString();
txtMatrix1.Text = m1.ToString();
}
示例12: PerformOperation
// This method performs the Point operations
public void PerformOperation(object sender, RoutedEventArgs e)
{
RadioButton li = sender as RadioButton;
// Strings used to display the results
String syntaxString, resultType, operationString;
// The local variables point1, point2, vector2, etc are defined in each
// case block for readability reasons. Each variable is contained within
// the scope of each case statement.
switch (li.Name)
{ //begin switch
case "rb1":
{
// Translates a Point by a Vector using the overloaded + operator.
// Returns a Point.
Point point1 = new Point(10, 5);
Vector vector1 = new Vector(20, 30);
Point pointResult = new Point();
pointResult = point1 + vector1;
// pointResult is equal to (30, 35)
// Note: Adding a Point to a Point is not a legal operation
// Displaying Results
syntaxString = "pointResult = point1 + vector1;";
resultType = "Point";
operationString = "Adding a Point and Vector";
ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb2":
{
// Translates a Point by a Vector using the static Add method.
// Returns a Point.
Point point1 = new Point(10, 5);
Vector vector1 = new Vector(20, 30);
Point pointResult = new Point();
pointResult = Point.Add(point1, vector1);
// pointResult is equal to (30, 35)
// Displaying Results
syntaxString = "pointResult = Point.Add(point1, vector1);";
resultType = "Point";
operationString = "Adding a Point and Vector";
ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb3":
{
// Subtracts a Vector from a Point using the overloaded - operator.
// Returns a Point.
Point point1 = new Point(10, 5);
Vector vector1 = new Vector(20, 30);
Point pointResult = new Point();
pointResult = point1 - vector1;
// pointResult is equal to (-10, -25)
// Displaying Results
syntaxString = "pointResult = point1 - vector1;";
resultType = "Point";
operationString = "Subtracting a Vector from a Point";
ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb4":
{
// Subtracts a Vector from a Point using the static Subtract method.
// Returns a Point.
Point point1 = new Point(10, 5);
Vector vector1 = new Vector(20, 30);
Point pointResult = new Point();
pointResult = Point.Subtract(point1, vector1);
// pointResult is equal to (-10, -25)
// Displaying Results
syntaxString = "pointResult = Point.Subtract(point1, vector1);";
resultType = "Point";
operationString = "Subtracting a Vector from a Point";
ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
break;
}
case "rb5":
{
// Subtracts a Point from a Point using the overloaded - operator.
// Returns a Vector.
Point point1 = new Point(10, 5);
Point point2 = new Point(15, 40);
Vector vectorResult = new Vector();
//.........这里部分代码省略.........
示例13: Crown_Unchecked
private void Crown_Unchecked(object sender, RoutedEventArgs e)
{
try
{
crown_points = drawHost.getPoints()[0];
MessageBox.Show(crown_points.ToString());
}
catch
{
}
drawHost.CurrentEditor = null;
}
示例14: singleClick
public void singleClick(object sender, TouchContactEventArgs e)
{
Console.WriteLine("This only happends when the single click event is satisfied");
Point point = new Point();
point = ((TouchContactEventArgs)e).TouchContact.GetPosition((InteractiveBorder)sender);
Console.WriteLine(point.ToString());
Get_Region_For_Single_Click(point);
}
示例15: getDisplayPosition
private Point getDisplayPosition(Joint joint)
{
float depthX, depthY;
nui.SkeletonEngine.SkeletonToDepthImage(joint.Position, out depthX, out depthY);
depthX = Math.Max(0, Math.Min(depthX * 320, 320)); //convert to 320, 240 space
depthY = Math.Max(0, Math.Min(depthY * 240, 240)); //convert to 320, 240 space
int colorX, colorY;
ImageViewArea iv = new ImageViewArea();
// only ImageResolution.Resolution640x480 is supported at this point
nui.NuiCamera.GetColorPixelCoordinatesFromDepthPixel(ImageResolution.Resolution640x480, iv, (int)depthX, (int)depthY, (short)0, out colorX, out colorY);
// map back to skeleton.Width & skeleton.Height
Point p = new Point((int)(skeleton.Width * colorX / 640.0), (int)(skeleton.Height * colorY / 480));
if (p.X < 10 && p.Y < 10)
{
System.Diagnostics.Debug.WriteLine("Point: " + p.ToString());
}
return p;
}