开发者

C# Control Parent

I have a winform project with a tabcontrol and several tabpages.

Within each tabpage there is some unique panel controls. However, when the user interacts with the form in each tab page, I want a generic picturebox to show. So I don't want to create a new picturebox for each tabpa开发者_运维问答ge, rather show the same one. Which control should I therefore have as a parent to the picturebox, and how can I change the parent once I drag the control onto the form?

Thanks.


The form has to be the parent. Which is not so easy to get done in the designer, the tab page will suck it in every opportunity it gets. One thing you can do is put it to the left of the tab control and move it in place by changing its Location property in the form's constructor, after the InitializeComponent() call

    public Form1() {
        InitializeComponent();
        pictureBox1.Left = tabControl1.Left + 15;
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜