| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 ])? |
|
#2
|
|||
|
|||
|
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 ); ? |
|
#3
|
|||
|
|||
|
I got that too. After values X1 and X2 are made non-zero the graphics should be repainted through Refresh();
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > Numerical value from pointArray[ i ] |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|