// C# code for testing the members of the Color class
// specified in the abbreviated UML diagram for Color.
public void Page_Load(object sender, EventArgs e)
{
// Create uninitialized (empty) color object.
Color c1 = new Color();
Response.Write(c1.IsEmpty == + c1.IsEmpty +
);
// Create red color object.
Color c2 = Color.Red;
Response.Write(c2.IsEmpty == + c2.IsEmpty +
c2.R == + c2.R +
c2.G == + c2.G +
c2.B == + c2.B +
);
// Create green color object.
Color c3 = Color.Green;
Response.Write(c3.IsEmpty == + c3.IsEmpty +
c3.R == + c3.R +
c3.G == + c3.G +
c3.B == + c3.B +
);
// Create blue color object.
Color c4 = Color.Blue;
Response.Write(c4.IsEmpty == + c4.IsEmpty +
c4.R == + c4.R +
c4.G == + c4.G +
c4.B == + c4.B +
);
// Create color from name object.
Color c5 = Color.FromName(HotPink);
Response.Write(c5.IsEmpty == + c5.IsEmpty +
c5.R == + c5.R +
c5.G == + c5.G +
c5.B == + c5.B +
);
// Create color from rgb values.
// The color created is brown.
Color c6 = Color.FromArgb(100,60,0);
Response.Write(c6.IsEmpty == + c6.IsEmpty +
c6.R == + c6.R +
c6.G == + c6.G +
c6.B == + c6.B +
);
// Set BackColor of TextBox1.
// Place TextBox1 in the .aspx file before running.
TextBox1.BackColor = c6;
}