Solved

# Mapping a set of spatial coordinates

Posted on 2006-04-22
Medium Priority
250 Views
I have a simple forms program with a form that is 777 x 777, the program passes along 3 values from the previous form to 3 labels  XCoord, YCoord, and ZCoord.

What I AM trying to do is map on the form with a simple blue point 5px by 5px where exactly the point space is.

This is the code that is being used currently to pass the values to labels on the new form.

shw.XCoord.Text = "XCoord: " + coordX.ToString();
shw.YCoord.Text = "YCoord: " + coordY.ToString();
shw.ZCoord.Text = "ZCoord: " + coordZ.ToString();

Any help would be greatly appreiciated.

Thanks

Peter
0
Question by:schenkp
1 Comment

LVL 5

Accepted Solution

gazzzzzzer earned 1000 total points
ID: 16514973
First of all I would create a function on the form with the labels that sets the labels text.
Also create a form paint handler to draw the blue point on the form (not sure how you wannt to handle the zcoord).
This might look like:

///Global Vars to store where to paint the blue point
int xcoord,ycoord,zcoord = -5;

public void setCoord(int x int y, int z)
{
//Set Label Text
this.XCoord.text = x.ToString();
this.YCoord.text = y.ToString();
this.ZCoord.text = z.ToString();

//Set global vars used to paint blue point
xcoord = x;
ycoord = y;
zcoord = z;
}

//Form Paint Event Handler
void MyFormPaint(object sender, System.Windows.Forms.PaintEventArgs e)
{
//Draw Blue Point on form canvas
this.CreateGraphics().FillRectangle(new SolidBrush(Color.Blue),new Rectangle(xcoord,ycoord,5,5));
}

Now from your other form call the setCoord function. EXAMPLE:

setCoord(coordX,coordY,coordZ);
0

## Featured Post

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Screencast - Getting to Know the Pipeline
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
###### Suggested Courses
Course of the Month16 days, 23 hours left to enroll