Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drawing and editing points in ArrayList... Lost

Status
Not open for further replies.

DarkWorlds

Technical User
Jul 20, 2005
64
US
Well this was something out of the book, but has been modified to do a few more things i need it to do. Right now im just trying to get the delete feature working. Its supposed to delete the closest to the mouse click, but instead what its doing is deleteing the first one in the array list. I know im doing something wrong. But no errors :/

heres where I think is going wrong in my code

else if (rbtn_Delete.Checked)
{
Point[] pointArray = (Point[])points.ToArray(points[0].GetType());
for (int i = 0; i<pointArray.Length; i++)
{
currentTaxicab = Math.Abs(e.X - pointArray.X) + Math.Abs(e.Y - pointArray.Y);
if (currentTaxicab <= oldTaxicab)
{
currentPoint = temp;
oldTaxicab = currentTaxicab;
}
}
points.RemoveAt(currentPoint);
}
drawPanel.Invalidate();

you can download the full source here:


Gotta thank a friend for letting me use his space :p

Im totaly lost. on this part... also if anyone has any cluse how to do a PolyBezier. Supposedly its DrawBeziers method passing it the pen reference and the array of points reference. A PolyBezier curve can only be drawn with 4 or 4 plus a multiple of 3 points.

But again this loses me.
 
what is the variable "temp" set to?

as a first guess, i have a feeling that the code

Code:
currentPoint = temp;

should read something like

Code:
currentPoint = pointArray[i];

good luck.

mr s. <;)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top