在 C# Windows 表单中更改按钮字体 - "Medium" 字体样式不可用

Changing Button fonts in C# Windows forms - "Medium" font style is unavailable

我正在使用 C# 开发一个 Windows Forms 项目,我所做的其中一件事是创建一个自定义关闭按钮。我发现 Marlett 字体可以用来为关闭按钮生成 "X",但是我想使用 "Medium" Marlett 样式,因为 "Bold" 太粗了。当我尝试在属性中 select "Medium" 时,它总是默认变回粗体。我的按钮看起来像这样:

在属性中,字体定义如下:

如果我尝试更改 属性 我可以 select "Medium",但它总是默认返回 "Bold":

在设计器代码中(我不会更改)它看起来像这样:

我试图通过执行以下操作在运行时更改字体:

    private void FrmMain_Load(object sender, EventArgs e)
    {
        _BtnClose.Font = new System.Drawing.Font("Marlett", 12F, System.Drawing.FontStyle.Medium, System.Drawing.GraphicsUnit.Point, ((byte)(2)));
    }

但是 System.Drawing.FontStyle 中没有可用的 "Medium" 字体样式。

如何强制我的程序使用 "Medium" 字体样式?

好的,根据 JQSOFT and Herohtar 上面的评论,我尝试在我的按钮上绘制控件。我创建了一个class继承自Button的CloseButton,并修改了onPaint方法如下:

    protected override void OnPaint(PaintEventArgs e)
    {
        base.OnPaint(e);
        GraphicsPath gPath;
        Pen gPen;
        gPen = new Pen(System.Drawing.SystemColors.ControlText);
        gPath = new GraphicsPath();
        gPath.AddLine(20, 10, 30, 20);
        gPath.CloseFigure();
        gPath.AddLine(20, 20, 30, 10);
        gPath.CloseFigure();
        e.Graphics.DrawPath(gPen, gPath);
    }

按钮看起来像这样:

我现在需要做的就是弄清楚当我将鼠标移到控件上(并且颜色发生变化)时如何重绘图形,但我会做到的!