当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - Trying to add a image to a group box, however, it doesnt show up

问题描述:

Solved: Using design toolbox.

I'm using the following method to add a image

 private void cobertura1vertente_Load(object sender, EventArgs e)

{

PictureBox pb1 = new PictureBox();

pb1.Image = Image.FromFile("C:/cobertura1vertente.png");

pb1.Location = new Point(3, 3);

pb1.Size = new Size(250, 250);

//doubt right below

groupBox81.Controls.Add(pb1);

}

I usually would add a image to a entire form, but now i want to add it to a specific groupbox, who lies inside a tab.

If the code is correct, my guess is that the location that i've set is relative to the whole form, and not to the groupBox, why would that happen?

分享给朋友:
您可能感兴趣的文章:
随机阅读: