C# Custom Control doesn't show up in the toolbox

前端 未结 5 1749
囚心锁ツ
囚心锁ツ 2021-01-28 19:50

I have created the custom control which is just a panel that I will be using to render my DirectX code. However, I am unable to see the control in my toolbox for when I try to a

相关标签:
5条回答
  • 2021-01-28 19:58

    Is the control class public ? The default template creates an internal class.

    Is there a public parameterless constructor ? The designer needs it.

    0 讨论(0)
  • 2021-01-28 20:01

    Did you right click on the toolbox and click "Choose Items", and then browse to the built assembly that contains your custom control?

    That's what I always have to do, and then my custom controls show up in the "General" section of the toolbox.

    0 讨论(0)
  • 2021-01-28 20:06

    Right click the Toolbox, then Choose items and browse for the .dll file that contains your control. The Toolbox will add all the components found in that dll. Also check in Tools -> Options -> Windows Forms Designer if the AutoToolboxPopulate setting is set to true.

    0 讨论(0)
  • 2021-01-28 20:12

    C# custom control will automatically populate once you build the project in which it is created & add reference of that project to the project having Form which needs that custom control. Faced the same problem myself. Once dll is made for that project and included using add references in the project you want its use, It is sure to see it in Toolbox.

    0 讨论(0)
  • 2021-01-28 20:12

    and check that you mustn't stay in the custom control's designer window.

    0 讨论(0)
提交回复
热议问题