Solved

Numerical value from pointArray[ i ]

Posted on 2004-08-17
4
150 Views
Last Modified: 2010-04-24
I need the numerical values of the x-coordinates of the points on the screen where I have clicked with the mouse. Briefly I do the following (say, clicking twice):



             // add mouse position to vertex list
               points->Add( __box( Point( e->X, e->Y ) ) );



               // if I clicked 2 times
               if ( points->Count  == 2 ) {

                  // create array of points
                  Point pointArray[] = new Point[ points->Count ];
                 
                  // add each point to the array
                  for( int i = 0; i < points->Count; i++ )
                     pointArray[ i ] = *(
                     dynamic_cast< Point* >( points->Item[ i ] ) );
                                                      }



As a result, I see in the messagebox MessageBox::Show(  pointArray[ 0 ].ToString(),  pointArray[ 1 ].ToString() ); the following:

{X=124,Y=231} and {X=67,Y=96}  

How do I extract the numerical values of the x-coordinates from these data (from the array pointArray[ i ])?
0
Comment
Question by:judico
  • 2
4 Comments
 

Author Comment

by:judico
ID: 11822217
I got that:

X1 = pointArray[ 0 ].X;
X2 = pointArray[ 1 ].X;

but how does one first plot

void OnPaint( PaintEventArgs *paintEvent )      
{
<some code>
}

and then, after clicking twice and assigning non-zero values of X1 and X2, plots again

graphicsObject->DrawEllipse( pen, X1, X2, 7, 7 );  ?
0
 

Author Comment

by:judico
ID: 11822789
I got that too. After values X1 and X2 are made non-zero the graphics should be repainted through Refresh();
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 11859253
User resolved; closed, 50 points refunded.

Netminder
Site Admin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Create a progress bar for timer 4 281
How can I find out what's required to run this program ? 3 83
How to change toolbar  runtime 3 412
Visual Studio 2015 install failing. 18 70
The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now