thinktank2
Apr 8th, 2002, 12:06 PM
A tool for generating html hexcolor.
//---------------------------------------------------------------------\\
// ColorCode C# Application by Thinktank2 thinktank2k1@yahoo.com )
//---------------------------------------------------------------------//
using System;
using System.Drawing;
using System.Windows.Forms;
class ColorCode : Form
{
private HScrollBar[] HsClr = new HScrollBar[3];
private TextBox txtColor = new TextBox();
private Label lblColor = new Label();
private Color Clr = new Color();
public ColorCode()
{
this.Text = "Color Code 1.0";
this.StartPosition = FormStartPosition.CenterScreen;
this.ClientSize = new Size(208, 157);
this.MaximizeBox = false;
this.MinimizeBox = false;
lblColor.Location = new Point(24, 8);
lblColor.Size = new Size(64, 32);
lblColor.BorderStyle = BorderStyle.Fixed3D;
lblColor.BackColor = Color.Black;
this.Controls.Add(lblColor);
txtColor.Location = new Point(104, 16);
txtColor.Size = new Size(80, 20);
txtColor.Text = "#000000";
this.Controls.Add(txtColor);
Label[] lblClrLegend = new Label[3];
for(int i=0; i < HsClr.Length; i++)
{
lblClrLegend[i] = new Label();
lblClrLegend[i].Location = new Point(8, 60 + (i*35));
lblClrLegend[i].Width = 10;
lblClrLegend[i].Font = new Font(lblClrLegend[i].Font,FontStyle.Bold);
this.Controls.Add(lblClrLegend[i]);
HsClr[i] = new HScrollBar();
HsClr[i].Maximum = 255;
HsClr[i].Location = new Point(25, 60 + (i*35));
HsClr[i].Size = new Size(175, 16);
HsClr[i].LargeChange = 1;
HsClr[i].Scroll += new ScrollEventHandler(HsClr_Scroll);
this.Controls.Add(HsClr[i]);
}
lblClrLegend[0].Text = "R";
lblClrLegend[1].Text = "G";
lblClrLegend[2].Text = "B";
}
public static void Main(string[] args)
{
Application.Run(new ColorCode());
}
protected void HsClr_Scroll(object sender, ScrollEventArgs e)
{
Clr = Color.FromArgb(HsClr[0].Value,HsClr[1].Value,HsClr[2].Value);
lblColor.BackColor = Clr;
txtColor.Text = ColorTranslator.ToHtml(Clr);
}
}
//---------------------------------------------------------------------\\
// ColorCode C# Application by Thinktank2 thinktank2k1@yahoo.com )
//---------------------------------------------------------------------//
using System;
using System.Drawing;
using System.Windows.Forms;
class ColorCode : Form
{
private HScrollBar[] HsClr = new HScrollBar[3];
private TextBox txtColor = new TextBox();
private Label lblColor = new Label();
private Color Clr = new Color();
public ColorCode()
{
this.Text = "Color Code 1.0";
this.StartPosition = FormStartPosition.CenterScreen;
this.ClientSize = new Size(208, 157);
this.MaximizeBox = false;
this.MinimizeBox = false;
lblColor.Location = new Point(24, 8);
lblColor.Size = new Size(64, 32);
lblColor.BorderStyle = BorderStyle.Fixed3D;
lblColor.BackColor = Color.Black;
this.Controls.Add(lblColor);
txtColor.Location = new Point(104, 16);
txtColor.Size = new Size(80, 20);
txtColor.Text = "#000000";
this.Controls.Add(txtColor);
Label[] lblClrLegend = new Label[3];
for(int i=0; i < HsClr.Length; i++)
{
lblClrLegend[i] = new Label();
lblClrLegend[i].Location = new Point(8, 60 + (i*35));
lblClrLegend[i].Width = 10;
lblClrLegend[i].Font = new Font(lblClrLegend[i].Font,FontStyle.Bold);
this.Controls.Add(lblClrLegend[i]);
HsClr[i] = new HScrollBar();
HsClr[i].Maximum = 255;
HsClr[i].Location = new Point(25, 60 + (i*35));
HsClr[i].Size = new Size(175, 16);
HsClr[i].LargeChange = 1;
HsClr[i].Scroll += new ScrollEventHandler(HsClr_Scroll);
this.Controls.Add(HsClr[i]);
}
lblClrLegend[0].Text = "R";
lblClrLegend[1].Text = "G";
lblClrLegend[2].Text = "B";
}
public static void Main(string[] args)
{
Application.Run(new ColorCode());
}
protected void HsClr_Scroll(object sender, ScrollEventArgs e)
{
Clr = Color.FromArgb(HsClr[0].Value,HsClr[1].Value,HsClr[2].Value);
lblColor.BackColor = Clr;
txtColor.Text = ColorTranslator.ToHtml(Clr);
}
}