You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace ColorChooser
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void tbRot_Scroll(object sender, EventArgs e)
{
UpdatePanels();
}
private void tbGrün_Scroll(object sender, EventArgs e)
{
UpdatePanels();
}
private void tbBlau_Scroll(object sender, EventArgs e)
{
UpdatePanels();
}
void UpdatePanels()
{
panel1.BackColor = Color.FromArgb(tbRot.Value, tbGrün.Value, tbBlau.Value);
panel2.BackColor = Color.FromArgb(255-tbRot.Value, 255-tbGrün.Value, 255-tbBlau.Value);
tbFarbe1.Text = "R: " + tbRot.Value.ToString() + " G: " + tbGrün.Value.ToString()
+ " B: " + tbBlau.Value.ToString() + " #" + String.Format("{0:x2}", tbRot.Value).ToUpper()
+ String.Format("{0:x2}", tbGrün.Value).ToUpper() + String.Format("{0:x2}", tbBlau.Value).ToUpper();
tbFarbe2.Text = "R: " + (255-tbRot.Value).ToString() + " G: " + (255-tbGrün.Value).ToString()
+ " B: " + (255-tbBlau.Value).ToString() + " #" + String.Format("{0:x2}", 255-tbRot.Value).ToUpper()
+ String.Format("{0:x2}", 255-tbGrün.Value).ToUpper() + String.Format("{0:x2}", 255-tbBlau.Value).ToUpper();
}
}
}