Work with Point type

image_pdfimage_print
   
 
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);


    }
}

    


This entry was posted in 2D Graphics. Bookmark the permalink.