Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/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
如何覆盖C#(字体、高度、宽度、背景色)中的按钮属性_C#_Windows_Windows Controls - Fatal编程技术网

如何覆盖C#(字体、高度、宽度、背景色)中的按钮属性

如何覆盖C#(字体、高度、宽度、背景色)中的按钮属性,c#,windows,windows-controls,C#,Windows,Windows Controls,如何使用C#覆盖我的控件 需要将按钮属性设置为 Font(Name => Segoe UI, style => Regular, size => 10), height => 50px, width => 250px, back color => green 默认情况下 如何对受尊重的按钮属性使用覆盖方法 注意:我将使用windows控件库控件来创建我的项目。 提前感谢。您可以使用默认属性创建用于覆盖的自定义控件 自定义按钮的示例按钮代码: using Sy

如何使用C#覆盖我的控件

需要将按钮属性设置为

Font(Name => Segoe UI, style => Regular, size => 10), height => 50px, width => 250px, back color => green
默认情况下

如何对受尊重的按钮属性使用覆盖方法

注意:我将使用windows控件库控件来创建我的项目。
提前感谢。

您可以使用默认属性创建用于覆盖的自定义控件

自定义按钮的示例按钮代码:

using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace DemoControls
{
    [ToolboxItem(true)]

    public class SimpleButton : Button
    {
        public SimpleButton()
        {
            Font = new Font("Segoe UI", 10, FontStyle.Regular);
            Height = 50;
            BackColor = DefaultBackColor;
        }
    }
}

当您构建项目时,它将在工具箱中显示控件,然后您必须在您想要的项目中使用此SimpleButton

如果使用构造函数尝试上述代码,然后使用我们使用的属性,这些属性也会显示在.designer.cs文件中。我也想限制这一点。如果我们只使用覆盖,我们将限制.designer.cs文件。但仍然没有得到预期的结果.“覆盖我的控制”对你来说意味着什么?