C# 控制父级
我有一个带有选项卡控件和几个选项卡页的 winform 项目。
每个选项卡页面内都有一些独特的面板控件。但是,当用户与每个选项卡页面中的表单交互时,我希望显示一个通用图片框。所以我不想为每个标签页创建一个新的图片框,而是显示相同的图片框。因此,我应该将哪个控件作为图片框的父控件,以及将控件拖到窗体上后如何更改父控件?
谢谢。
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 tabpage, 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该表单必须是父表单。这在设计器中并不容易完成,标签页会抓住每一个机会。您可以做的一件事是将其放在选项卡控件的左侧,并在调用 InitializeComponent() 之后通过在表单的构造函数中更改其 Location 属性来将其移动到位
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