Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to access Point Coordinates
    primarykey
    data
    text
    <p>Just starting out with GUI Windows programming. I'm working in Visual Studio C++ Wondows Forms.</p> <p>I've figured out how to grab the mouse coordinates and dump them into a double Point coordinate variable but when I try and access the the X &amp; Y values to manipulate them I get...</p> <pre><code>error C2248: 'System::Drawing::Point::x' : cannot access private member declared in class 'System::Drawing::Point' </code></pre> <p>The Point variable is called firstPoint and I'm trying to access the values using firstPoint.X and firstPoint.Y. I guess that's not the correct way to go about it.</p> <p>How do I go about converting the values into an int so I can mess with it? Convert::ToInt32(firstPoint.x) is what threw the errors.</p> <p>Google searches keep sending me to pointer topics not Point Coordinate topics.</p> <p>Additional code as requested:</p> <pre><code>private: /// &lt;summary&gt; /// Required designer variable. unsigned char ucRed, ucGrn, ucBlu; bool drawing; Point firstPoint, finalPoint; //int iShape, iX1,iY1,iX2,iY2; private: System::Void panel1_Paint_1(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) { Graphics^ g = e-&gt;Graphics; //create an ellipse with // Black color // start position = firstPoint mouse coordinate // width = difference between firstPoint and finalPoint, height = difference between firstPoint and finalPoint g-&gt;DrawEllipse(Pens::Black,firstPoint.x,firstPoint.Y,(finalPoint.X-firstPoint.X),(finalPoint.Y-firstPoint.Y)); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload