Point class in C#

前端 未结 6 1233
醉梦人生
醉梦人生 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:28

    You should add a reference to your solution, to the namespace System.Drawing.

    From the tab 'Solution Explorer', right click on 'References' and select 'Add Reference', as shown below:

    SolutionExplorer

    In the new window, type in the search bar 'System.Drawing'. Double click in the results found and click the button 'OK'.

    Now, in your code, where the other using statements are declared, add the following line:

    using System.Drawing;
    

    Note: I noticed you're creating a new Console application. Be aware that, if you want to create a basic user interface, the System.Drawing.Point structure won't help you, because in a Console application you cannot interact with the user using buttons, labels and coordinates useful to place your UI items. In a Console application, you can interact only using plain text. If you want to create a simple application with a basic user interface, create instead a Windows Forms application.

提交回复
热议问题