C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 17th, 2004, 10:47 AM
Omnibus Omnibus is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 3 Omnibus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Numerical value from pointArray[ i ]

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 ])?

Reply With Quote
  #2  
Old August 17th, 2004, 11:23 AM
Omnibus Omnibus is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 3 Omnibus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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 ); ?

Reply With Quote
  #3  
Old August 17th, 2004, 12:10 PM
Omnibus Omnibus is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 3 Omnibus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I got that too. After values X1 and X2 are made non-zero the graphics should be repainted through Refresh();

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Numerical value from pointArray[ i ]


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT