C#ã§Colorã®å¤ããªã¹ãã¢ãããã¦ã¿ã
C#ã¨ããããã¯ã.NET Framework ã®
Colorã¯ã©ã¹ã«å®ç¾©ããã¦ããå¤ããã¹ã¦åç
§ãã
ã«ã¯ã©ãããã°ãããã¨ãããã¨ã
ListViewã«ãªã¹ãã¢ãããã¦ã¾ãã
ãã¤ã³ãã¯GetProperties()ã¨BindingFlagsã§ãã
foreach (PropertyInfo info in typeof(Color).GetProperties(BindingFlags.Public | BindingFlags.Static)) { Color color = (Color)info.GetValue(null, null); if (color.Name == "Transparent") continue; string value = "#" + color.R.ToString("X2") + color.G.ToString("X2") + color.B.ToString("X2"); ListViewItem item = new ListViewItem(new string[] { color.Name, value }); item.BackColor = color; listView1.Items.Add(item); }