Work with Point type : Point « 2D Graphics « C# / C Sharp






Work with Point type

 
using System;
using System.Drawing;



class Program {
    static void Main(string[] args) {
        // Create and offset a point.
        Point pt = new Point(100, 72);
        Console.WriteLine(pt);
        pt.Offset(20, 20);
        Console.WriteLine(pt);

        // Overloaded Point operators.
        Point pt2 = pt;
        if (pt == pt2)
            Console.WriteLine("Points are the same");
        else
            Console.WriteLine("Different points");

        // Change pt2's X value.
        pt2.X = 4000;

        // Now show each X:
        Console.WriteLine("First point: {0}", pt);
        Console.WriteLine("Second point: {0}", pt2);


    }
}

 








Related examples in the same category

1.Add size to a Point