Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio VisualStudio designer自动将GenerateMember属性设置为false_Visual Studio_User Controls_Properties_Windows Forms Designer - Fatal编程技术网

Visual studio VisualStudio designer自动将GenerateMember属性设置为false

Visual studio VisualStudio designer自动将GenerateMember属性设置为false,visual-studio,user-controls,properties,windows-forms-designer,Visual Studio,User Controls,Properties,Windows Forms Designer,所有东西都在标题中: 我希望VisualStudio designer为每个控件自动将GenerateMember属性设置为false。我会在需要时手动将其设置为true。 这可能吗?您可以通过继承要使用的每个类来编写自己的控件。在构造函数中,将该属性设置为false。要将它们放入VS的工具箱中,您可以右键单击工具箱并添加每个类。您必须为要使用的每个控件执行此操作。单调乏味,但这是我能想到的实现你想要的唯一方法 public MyDropDownList : DropDownList {

所有东西都在标题中:

我希望VisualStudio designer为每个控件自动将GenerateMember属性设置为false。我会在需要时手动将其设置为true。
这可能吗?

您可以通过继承要使用的每个类来编写自己的控件。在构造函数中,将该属性设置为false。要将它们放入VS的工具箱中,您可以右键单击工具箱并添加每个类。您必须为要使用的每个控件执行此操作。单调乏味,但这是我能想到的实现你想要的唯一方法

public MyDropDownList : DropDownList
{
    public MyDropDownList() : base()
    {
        GenerateMember = false;
    }
}

这个答案不止一个方面是错误的。控件会自动添加到工具箱中。而且这段代码不会编译,GenerateMember不是控件的属性。