views:

57

answers:

2

plz keep in mind I'm very noobish...

What I'm trying to do is add "blips" to my form. I have a calculation that determines where all these "blips" will be, which is plotted on a graph. the solution determines that the coordinates are "blipHours, blipAltitude"

I want to somehow add small dots to my form at these locations. At first I was going to create something to be my "blips" but then I realized that I want it so small that I could just use an empty picture box with the background color what I want (I know this isn't the best way but I'm still very new to this).

I've created the code that will add the blip

                    PictureBox blip = new PictureBox();
                    blip.Location = new Point(blipHours, blipAltitude);
                    blip.Size = new Size(6, 6);
                    blip.BackColor = System.Drawing.Color.Lime;
                    blip.Text = "";
                    blip.Name = callsign;
                    this.Controls.Add(blip); 

It adds the blip, but it always adds it underneath other controls. Is there a way to make it add the new blip on top of everything else so that it's visible?

my second question is how do I remove all of the blips that get created at once with the click of a button?

A: 

You can use .AddAt to set its position in the list of controls.

Faruz
never used addAt... so would it look like this:this.Controls.AddAt(1,blip);
Brodie
Yep. Just use the Visual Studio auto-complete or google it
Faruz
Or even the *help* in visual studio (or MSDN online) - which is fairly compresensive up to a point...
Murph
A: 

An alternative to nobugz' answer is to change the Z-order of your controls via the Form.Controls.SetChildIndex method:

this.Controls.Add(blip);
this.Controls.SetChildIndex(blip, 0);
stakx