首页 > 代码库 > C#-TrackBar-RGB颜色窗体背景色,动态加载颜色效果,通过Trackbar设置,值255.---ShinePans
C#-TrackBar-RGB颜色窗体背景色,动态加载颜色效果,通过Trackbar设置,值255.---ShinePans
using System; 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 设置窗体颜色_TrackBar_ { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { textBox1.Text = trackBar1.Value.ToString(); textBox2.Text = trackBar2.Value.ToString(); textBox3.Text = trackBar3.Value.ToString(); this.BackColor = Color.FromArgb(trackBar1.Value, trackBar2.Value, trackBar3.Value); } private void trackBar1_Scroll(object sender, EventArgs e) { textBox1.Text = trackBar1.Value.ToString(); Form1 frm = this; frm.BackColor = Color.FromArgb(trackBar1.Value, trackBar2.Value, trackBar3.Value); } private void trackBar2_Scroll(object sender, EventArgs e) { textBox2.Text = trackBar2.Value.ToString(); Form1 frm = this; frm.BackColor = Color.FromArgb(trackBar1.Value, trackBar2.Value, trackBar3.Value); } private void trackBar3_Scroll(object sender, EventArgs e) { textBox3.Text = trackBar3.Value.ToString(); Form1 frm = this; frm.BackColor = Color.FromArgb(trackBar1.Value, trackBar2.Value, trackBar3.Value); } } }
通过 FromArgb 0-255 的数值来设置颜色 ,加入了 TrackBar, 我想到了 win 8安装时 那个颜色渐变,就是采用这个原理,可以马上做一个.
接下来会做一个
效果及 源码:
http://yunpan.cn/csJwjgxLF65rD 提取码 b1a5
C#-TrackBar-RGB颜色窗体背景色,动态加载颜色效果,通过Trackbar设置,值255.---ShinePans
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。