Mapping a set of spatial coordinates

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.


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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:


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.