using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace vcsWEBcolor { public partial class Form1 : Form { string dir = "c:\\vcs2010pro\\vcs7WEBcolor"; public Form1() { InitializeComponent(); } //--------------------------------------------------------------- private void toolStripButton1_Click(object sender, EventArgs e) { System.IO.StreamWriter sw; string fnameW = ""; int i, j, k; string strcol; string[] colname = {"black", "navy", "green", "teal", "maroon", "purple", "olive", "gray", "blue", "aqua", "lime", "silver", "red", "fuchsia", "yellow", "white"}; string[] colno = new string[16]; string[] str0 = new string[20]; string[] str1 = new string[20]; string[] str2 = new string[20]; string[] str3 = new string[20]; string[] scol = { "00", "33", "66", "99", "cc", "ff" }; string[] coldat = new string[216]; string[] hcol = new string[42]; int c1 = 0; int c2 = 0; int c3 = 0; ; byte rr, gg, bb; //htmlファイル出力 fnameW = dir + "\\subwebcolor.html"; sw = new System.IO.StreamWriter(fnameW, false, System.Text.Encoding.GetEncoding("shift-jis")); sw.WriteLine(""); sw.WriteLine(""); sw.WriteLine(""); sw.WriteLine(""); sw.WriteLine(""); //******************************************************************* for (k = 0; k <= 15; k++) { rr = Color.FromName(colname[k]).R; gg = Color.FromName(colname[k]).G; bb = Color.FromName(colname[k]).B; colno[k] = "#" + rr.ToString("X2") + gg.ToString("X2") + bb.ToString("X2"); } sw.WriteLine("

基本カラー 16 色

"); sw.WriteLine(""); sw.WriteLine(""); k = 0; for (i = 0; i <= 3; i++) { sw.WriteLine(""); for (j = 0; j <= 3; j++) { sw.WriteLine(""); k = k + 1; } sw.WriteLine(""); } sw.WriteLine("
" + colname[k] + "
" + colno[k] + "
"); sw.WriteLine("

"); //******************************************************************* sw.WriteLine("

色相環順配置

"); sw.WriteLine(""); sw.WriteLine(""); k = 0; for (i = 0; i <= 6; i++) { sw.WriteLine(""); for (j = 0; j <= 5; j++) { switch (i) { case 0: c1 = 5; c2 = j; c3 = 0; break; case 1: c1 = 5 - j; c2 = 5; c3 = 0; break; case 2: c1 = 0; c2 = 5; c3 = j; break; case 3: c1 = 0; c2 = 5 - j; c3 = 5; break; case 4: c1 = j; c2 = 0; c3 = 5; break; case 5: c1 = 5; c2 = 0; c3 = 5 - j; break; case 6: c1 = j; c2 = j; c3 = j; break; } hcol[k] = "#" + scol[c1] + scol[c2] + scol[c3]; sw.WriteLine(""); k = k + 1; } sw.WriteLine(""); } sw.WriteLine("
" + hcol[k] + "
"); sw.WriteLine("

"); //******************************************************************* sw.WriteLine("

Web 用カラー 216 色

"); sw.WriteLine(""); sw.WriteLine(""); k = 0; for (i = 0; i <= 35; i++) { sw.WriteLine(""); for (j = 0; j <= 5; j++) { c1 = i / 6; c2 = j; c3 = i % 6; coldat[k] = "#" + scol[c1] + scol[c2] + scol[c3]; sw.WriteLine(""); k = k + 1; } sw.WriteLine(""); } sw.WriteLine("
" + coldat[k] + "
"); //******************************************************************* sw.WriteLine(""); sw.WriteLine(""); sw.Close(); //******************************************************************* //cssファイル出力 fnameW = dir + "\\cswebcolor.css"; sw = new System.IO.StreamWriter(fnameW, false, System.Text.Encoding.GetEncoding("shift-jis")); sw.WriteLine("body{background-color:#2F4F4F;color:#ffffff;}"); sw.WriteLine("p.cline{text-align:center;}"); sw.WriteLine("table.tbl1{background-color:#ffffff;text-align:center;font-size:1.0em;font-weight:bold;line-height:120%;}"); for (k = 0; k <= 15; k++) { switch (k) { case 0: strcol = "#ffffff"; break; case 1: strcol = "#ffffff"; break; case 2: strcol = "#ffffff"; break; case 3: strcol = "#ffffff"; break; case 4: strcol = "#ffffff"; break; case 5: strcol = "#ffffff"; break; case 6: strcol = "#ffffff"; break; case 7: strcol = "#ffffff"; break; case 8: strcol = "#ffffff"; break; default: strcol = "#000000"; break; } sw.WriteLine("td.col" + k.ToString("00") + "{background-color:" + colno[k] + ";color:" + strcol + ";}"); } sw.WriteLine("table.tbl2{background-color:#ffffff;text-align:center;font-size:1.0em;font-weight:bold;line-height:150%;}"); k = 0; for (i = 0; i <= 6; i++) { switch (i) { case 0: strcol = "#000000"; break; case 1: strcol = "#000000"; break; case 2: strcol = "#000000"; break; default: strcol = "#ffffff"; break; } for (j = 0; j <= 5; j++) { if (i == 6) { switch (j) { case 0: strcol = "#ffffff"; break; case 1: strcol = "#ffffff"; break; case 2: strcol = "#ffffff"; break; default: strcol = "#000000"; break; } } sw.WriteLine("td.colh" + k.ToString("00") + "{background-color:" + hcol[k] + ";color:" + strcol + ";}"); k = k + 1; } } sw.WriteLine("table.tbl3{background-color:#ffffff;text-align:center;font-size:1.0em;font-weight:bold;line-height:150%;}"); k = 0; for (i = 0; i <= 35; i++) { for (j = 0; j <= 5; j++) { switch (j) { case 0: strcol = "#ffffff"; break; case 1: strcol = "#ffffff"; break; case 2: strcol = "#ffffff"; break; case 3: strcol = "#ffffff"; break; default: strcol = "#000000"; break; } sw.WriteLine("td.col" + k.ToString("000") + "{background-color:" + coldat[k] + ";color:" + strcol + ";}"); k = k + 1; } } sw.Close(); this.Width = 600; this.Height = 600; webBrowser1.Url = new Uri(dir + "\\subwebcolor.html"); } //--------------------------------------------------------------- private void toolStripButton2_Click(object sender, EventArgs e) { System.Diagnostics.Process.Start(dir + "\\subwebcolor.html"); } //--------------------------------------------------------------- } }