小编fau*_*ity的帖子

更改 NumericUpDown 的边框颜色

我对 C# 很陌生,有一个问题。我已经能够通过将 FlatStyle 更改为“Flat”来更改按钮的边框颜色等。使用NumericUpDown,我无法更改 FlatStyle。我希望仍然能够使用向上和向下箭头,因此仅使用其他东西来覆盖边缘是行不通的。这是我在代码中所做的事情的简化版本:

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace bordertest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            BackColor = Color.Black;
            numericUpDown1.BackColor = Color.Red;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

.net c# numericupdown winforms

3
推荐指数
1
解决办法
2487
查看次数

标签 统计

.net ×1

c# ×1

numericupdown ×1

winforms ×1