Label over picturebox

Ok, Im creating a label at runtime in a button_click event. Now the problem is, its not showing up, at all. And im thinking its because I need it to appear over a picture box. Because in my program, the form has a background image, and on the form there is a picture box displaying another picture. Is the reason why its not showing up, because of the picture box. I guess another question I should be asking is how do I make the label appear in front of everything else


Answer this question

Label over picturebox

  • Tasha O.

    Try right-clicking, then select "Bring to front".


  • João Pereira

    Ok. I figured out how to bring the object to font at runtime. Here is my code, where I made a label at runtime on top of a picture box in a button_click event.

    public void button1_Click(object sender, EventArgs e)

    {

    Label label1 = new Label();

    label1.Text = "You must select the 'Guest' profile...";

    label1.Location = new Point(430, 407);

    label1.Size = new Size(250, 20);

    label1.Font = new Font("Microsoft Sans Serif", 10, FontStyle.Regular);

    label1.ForeColor = Color.Maroon;

    label1.Image = CSharp.Properties.Resources.Form_Background5_copy1;

    this.Controls.Add(label1);

    {

    label1.BringToFront();

    }

    }



  • Label over picturebox