添加使用Windows窗体设计器用户控件窗体、控件、Windows

2023-09-03 03:21:19 作者:一隔三秋梦

这可能是一个非常明显的问题,但我只是不明白。

This is probably an incredibly obvious question, but I just can't figure it out.

我通过表单设计管理的Windows窗体。我想包括一个自定义用户控件,也窗体设计管理。但我无法得到自定义控件出现在工具箱中,即使我尝试手动添加它下的选择项目...对话框。

I have a Windows Form managed by the form designer. I'd like to include a custom user control, also managed by the form designer. But I'm unable to get the custom control to show up in the Toolbox, even if I try manually adding it under the "Choose Items..." dialog.

这两个窗体和控件在同一个组件。我试着控制分离成一个单独的程序,以便按照指示这里到信中,都无济于事。我还使用C ++ / CLI,如果改变任何东西。

Both form and control are in the same assembly. I've tried separating the control into a separate assembly in order to follow the instructions here to the letter, to no avail. I'm also using C++/CLI, if that changes anything.

有一个属性还是我等应设置为我控制,以便它出现在设计工具箱?

Is there an attribute or such I should be setting to my control in order for it to appear in the Designer Toolbox?

推荐答案

是的,有一个。唯一一个我知道,$ P $的pvents从显示出来工具箱中如果类是在同一项目中的控制。工具+选项,Windows窗体设计器,通用,AutoToolboxPopulate应设置为True。的默认值。

Yes, there is one. The only one I'm aware of that prevents a control from showing up in the toolbox if the class is in the same project. Tools + Options, Windows Forms Designer, General, AutoToolboxPopulate should be set to True. The default value.