Introduction
The .NET Framework provides us with over 100 colours to use within the
System.Drawing namespace. In order that we know exactly what all these colours
look like here is a simple web based tool that uses Reflection to loop through
all the colours with the System.Drawing.Color struct and print them to the page.
Code
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Reflection" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim t As Type = GetType(System.Drawing.Color)
For Each fi As PropertyInfo In t.GetProperties()
If fi.PropertyType.ToString() = "System.Drawing.Color" Then
Dim colorName As String = fi.Name
Comments
Join the conversation! Your thoughts help the community grow.