背景:使用 Visual Studio 2015 的 C# WinForms 程序。
我的项目中有一个用户控制类。我的用户控件类称为“FocusControl”。我的项目包含默认的“Form1”。用户控件没有自动填充到我的工具箱中。
我的研究和无效解决方案的历史:
我发现了更激进的解决方案:
将 [ToolboxItem(true)] 添加到 UserControl。
从应用程序数据中删除旧的工具箱文件,因为它们可能会损坏:请参阅此处:https : //weblogs.asp.net/javiervillarreal/visual-studio-not-showing-properly-the-toolbox-items
我不知道如何搜索谷歌来解决这个问题。
研究网站:
编辑添加代码:
用户控制 FocusControl.cs
namespace ProjectRaven
{
[ToolboxItem(true)]
public partial class FocusControl : UserControl
{
private const NumberStyles StyleDouble = NumberStyles.AllowDecimalPoint | NumberStyles.AllowThousands | …Run Code Online (Sandbox Code Playgroud)