C#调色板如何显示颜色
用C#的什么控件能够显示颜色?我在做一个调色板程序,但是只能改变字体颜色,却无法改变某一控件的颜色或者在某一区域显示调出的颜色。
以下是代码,请指教
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace _1113640111秦超
{
public partial class Form1 : Form
{
int r, g, b;
public Form1()
{
InitializeComponent();
}
private void hScrollBar1_Scroll(object sender, ScrollEventArgs e)
{
textBox1.Text = (hScrollBar1.Value).ToString();
listBox1 .BackColor = System.Drawing.Color.FromArgb(r = hScrollBar1.Value);
}
private void hScrollBar2_Scroll(object sender, ScrollEventArgs e)
{
textBox2.Text = (hScrollBar2.Value).ToString();
listBox1.BackColor = System.Drawing.Color.FromArgb(g = hScrollBar2.Value);
}
private void hScrollBar3_Scroll(object sender, ScrollEventArgs e)
{
textBox3.Text = (hScrollBar3.Value).ToString();
listBox1.BackColor = System.Drawing.Color.FromArgb(b = hScrollBar3.Value);
}
}
}
以下是代码,请指教
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace _1113640111秦超
{
public partial class Form1 : Form
{
int r, g, b;
public Form1()
{
InitializeComponent();
}
private void hScrollBar1_Scroll(object sender, ScrollEventArgs e)
{
textBox1.Text = (hScrollBar1.Value).ToString();
listBox1 .BackColor = System.Drawing.Color.FromArgb(r = hScrollBar1.Value);
}
private void hScrollBar2_Scroll(object sender, ScrollEventArgs e)
{
textBox2.Text = (hScrollBar2.Value).ToString();
listBox1.BackColor = System.Drawing.Color.FromArgb(g = hScrollBar2.Value);
}
private void hScrollBar3_Scroll(object sender, ScrollEventArgs e)
{
textBox3.Text = (hScrollBar3.Value).ToString();
listBox1.BackColor = System.Drawing.Color.FromArgb(b = hScrollBar3.Value);
}
}
}
...全文


