Point class in C#

前端 未结 6 1199
醉梦人生
醉梦人生 2021-01-02 04:33

I\'m pretty new to C# and I\'m trying to do something but without much success. I am trying to use the class Point (the one with coordinates).

This is t

6条回答
  •  醉梦人生
    2021-01-02 05:25

    The Point structure is a part of the System.Drawing namespace.
    You can either reference this namespace or create your own Point structure, which, if you only need it as a coordinate container could be a very simple structure.

    Something like:

    public struct Point 
    {
       public int X {get;set;}
       public int Y {get;set;}
    }
    

    Altho, the original Point struct in the System.Drawing namespace got a few more functions than the above code (which obviously don't have any, hehe). If you need those, I would recommend including the System.Drawing namespace instead of making your own, cause it would probably take more time than you wish that it took for such a simple structure.

    http://msdn.microsoft.com/library/system.drawing.point.aspx

提交回复
热议问题