在Panel上使用C#WinForms Designer而不是Form Again?

时间:2021-06-29 15:51:07

I have the same question, but the answer to use a UserControl will not do. I also need to create a control container that I can add other controls to at design time so I can add it to yet another container (Splitter Panel) which is not avaialable to me at design time (plugin architecture). When I make a User Control, it is missing the design time support and all I get are icons when I drop controls onto this surface.

我有同样的问题,但使用UserControl的答案是不行的。我还需要创建一个控件容器,我可以在设计时添加其他控件,这样我就可以将它添加到另一个容器(Splitter Panel)中,这在设计时对我来说是不可接受的(插件架构)。当我进行用户控制时,它缺少设计时支持,当我将控件放到此表面上时,我得到的只是图标。

Do I need to add all the design time support myself, or is there something I am missing that has this for me?

我是否需要自己添加所有的设计时间支持,或者是否有一些我想念的东西给我?

1 个解决方案

#1


You will have to use either a Form or UserControl to accomplish any forms design within the designer.

您必须使用Form或UserControl来完成设计器中的任何表单设计。

I have often created controls that I need to manipulate en masse. Start with a UserControl, then add a panel that fills the UserControl. This is your base panel that you will fill with all of your controls. I then save as a duplicate control and simply remove the UserControl and leave the panel as the public UI control which is then instanced. If I am making changes, I can go back to the original UserControl, make changes, add code, etc - rinse and repeat.

我经常创建控件,我需要集体操作。从UserControl开始,然后添加一个填充UserControl的面板。这是您将使用所有控件填充的基本面板。然后我保存为一个重复的控件,只需删除UserControl并将面板保留为公共UI控件,然后实例化。如果我要进行更改,我可以返回原始的UserControl,进行更改,添加代码等 - 冲洗并重复。

#1


You will have to use either a Form or UserControl to accomplish any forms design within the designer.

您必须使用Form或UserControl来完成设计器中的任何表单设计。

I have often created controls that I need to manipulate en masse. Start with a UserControl, then add a panel that fills the UserControl. This is your base panel that you will fill with all of your controls. I then save as a duplicate control and simply remove the UserControl and leave the panel as the public UI control which is then instanced. If I am making changes, I can go back to the original UserControl, make changes, add code, etc - rinse and repeat.

我经常创建控件,我需要集体操作。从UserControl开始,然后添加一个填充UserControl的面板。这是您将使用所有控件填充的基本面板。然后我保存为一个重复的控件,只需删除UserControl并将面板保留为公共UI控件,然后实例化。如果我要进行更改,我可以返回原始的UserControl,进行更改,添加代码等 - 冲洗并重复。