1、直接点出来,例如
- this.BackColor = Color.White; //白色
- this.BackColor = Color.Black; //黑色
2、使用16进制格式
- this.BackColor = Color.FromName("#FFFFFF"); //白色
- this.BackColor = Color.FromName("#000000"); //黑色
- this.BackColor = ColorTranslator.FromHtml("#DDDDDD"); //浅灰色
3、使用RGB
- this.BackColor = Color.FromArgb(255, 255, 255); //白色
- this.BackColor = Color.FromArgb(0, 0, 0); //黑色
4、设置透明颜色
this.BackColor = Color.FromArgb(50,195, 0, 0); //透红色
标签:颜色,C#,FromName,代码,Color,FromArgb,BackColor,255
From: https://www.cnblogs.com/linnew/p/17913255.html