Option Explicit On Option Strict On Public Class Form1 Private dir As String = "c:\vb2010pro\vb7WEBcolor" Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click Dim sw As System.IO.StreamWriter Dim fnameW As String Dim i As Integer Dim j As Integer Dim k As Integer Dim strcol As String Dim colname() As String = {"black", "navy", "green", "teal", _ "maroon", "purple", "olive", "gray", _ "blue", "aqua", "lime", "silver", _ "red", "fuchsia", "yellow", "white"} Dim colno(15) As String Dim str0(19) As String Dim str1(19) As String Dim str2(19) As String Dim str3(19) As String Dim scol() As String = {"00", "33", "66", "99", "cc", "ff"} Dim coldat(215) As String Dim hcol(41) As String Dim c1 As Integer Dim c2 As Integer Dim c3 As Integer Dim rr As Byte Dim gg As Byte Dim bb As Byte '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 To 15 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") Next k sw.WriteLine("

基本カラー 16 色

") sw.WriteLine("") sw.WriteLine("") k = 0 For i = 0 To 3 sw.WriteLine("") For j = 0 To 3 sw.WriteLine("") k = k + 1 Next j sw.WriteLine("") Next i sw.WriteLine("
" & colname(k) & "
" & colno(k) & "
") sw.WriteLine("

") '******************************************************************* sw.WriteLine("

色相環順配置

") sw.WriteLine("") sw.WriteLine("") k = 0 For i = 0 To 6 sw.WriteLine("") For j = 0 To 5 Select Case i Case 0 : c1 = 5 : c2 = j : c3 = 0 Case 1 : c1 = 5 - j : c2 = 5 : c3 = 0 Case 2 : c1 = 0 : c2 = 5 : c3 = j Case 3 : c1 = 0 : c2 = 5 - j : c3 = 5 Case 4 : c1 = j : c2 = 0 : c3 = 5 Case 5 : c1 = 5 : c2 = 0 : c3 = 5 - j Case 6 : c1 = j : c2 = j : c3 = j End Select hcol(k) = "#" & scol(c1) & scol(c2) & scol(c3) sw.WriteLine("") k = k + 1 Next j sw.WriteLine("") Next i sw.WriteLine("
" & hcol(k) & "
") sw.WriteLine("

") '******************************************************************* sw.WriteLine("

Web 用カラー 216 色

") sw.WriteLine("") sw.WriteLine("") k = 0 For i = 0 To 35 sw.WriteLine("") For j = 0 To 5 c1 = i \ 6 c2 = j c3 = i Mod 6 coldat(k) = "#" & scol(c1) & scol(c2) & scol(c3) sw.WriteLine("") k = k + 1 Next j sw.WriteLine("") Next i 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 To 15 Select Case k Case 0 To 8 : strcol = "#ffffff" Case Else : strcol = "#000000" End Select sw.WriteLine("td.col" & k.ToString("00") & "{background-color:" & colno(k) & ";color:" & strcol & ";}") Next k 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 To 6 Select Case i Case 0 To 2 : strcol = "#000000" Case Else : strcol = "#ffffff" End Select For j = 0 To 5 If i = 6 Then Select Case j Case 0 To 2 : strcol = "#ffffff" Case Else : strcol = "#000000" End Select End If sw.WriteLine("td.colh" & k.ToString("00") & "{background-color:" & hcol(k) & ";color:" & strcol & ";}") k = k + 1 Next j, i 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 To 35 For j = 0 To 5 Select Case j Case 0 To 3 : strcol = "#ffffff" Case Else : strcol = "#000000" End Select sw.WriteLine("td.col" & k.ToString("000") & "{background-color:" & coldat(k) & ";color:" & strcol & ";}") k = k + 1 Next j, i sw.Close() Me.Width = 600 Me.Height = 600 WebBrowser1.Url = New Uri(dir & "\subwebcolor.html") End Sub Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click System.Diagnostics.Process.Start(dir & "\subwebcolor.html") End Sub End Class