首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何修复空白用户控件?

如何修复空白用户控件?
EN

Stack Overflow用户
提问于 2019-06-04 03:54:45
回答 1查看 612关注 0票数 -2

我已经创建了一个用按钮、标签、文本框等填充的userControl。当我将它添加到我的FormMain中时,出现的只是一个150x150的灰色方块,而不是我的userControl应该是什么样子。我在这个项目中还有其他的userControls,它们的功能都很好。目前没有提供代码,因为根据我的另一个userControls,这应该发生在winforms上-对于这两个UC,我只是从工具箱中拖放。

当我添加一个“其他”userControls时会发生什么:

添加所需的userControl时会发生什么情况的图像:

我的userControl实际外观的图像:

在窗体主设计器中,它们被添加到此处的选项卡中...

代码语言:javascript
复制
this.tabPageTelescope.Controls.Add(this.userControlTelescope21);
this.tabPageTelescope.Controls.Add(this.userControlTelescope1);

稍后,它们会再次出现在这里。

代码语言:javascript
复制
// userControlTelescope1
// 
this.userControlTelescope1.Location = new System.Drawing.Point(113, 55);
this.userControlTelescope1.Name = "userControlTelescope1";
this.userControlTelescope1.Size = new System.Drawing.Size(150, 150);
this.userControlTelescope1.TabIndex = 0;
// 
// userControlTelescope21
// 
this.userControlTelescope21.Location = new System.Drawing.Point(236, 13);
this.userControlTelescope21.Name = "userControlTelescope21";
this.userControlTelescope21.Size = new System.Drawing.Size(752, 587);
this.userControlTelescope21.TabIndex = 1;

两个userControlTelescope21都像预期的那样出现,userControl1才是有问题的那个。除了TabIndex之外,它们具有相同的属性。可能值得注意的是,userControlTelescope1的大小不是(150,150) -这就是它添加它的原因。

EN

回答 1

Stack Overflow用户

发布于 2019-06-04 04:37:22

在没有代码的情况下,我唯一能想到的就是确保您的控件是选项卡窗格的成员,而不是底层窗体。查看它们的属性面板或窗体设计器的代码。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56433746

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档