------------------
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim side As Integer
side = Val(TextBox1.Text) * 3 / Math.Sqrt(3)
Label3.Text = Format(side, "0.0")
Label2.Text = "の時の一辺の長さは▼"
Label2.BackColor = Color.LightBlue
Button2.Visible = False
'計算結果をLabel3に少数1桁で表示
'Label2にButton2と同じ色の背景色で
'「の時の一辺の長さは▼」を表示
'Button2は非表示
End Sub
------------------Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim radius As Integer
radius = Val(TextBox1.Text) * Math.Sqrt(3) / 3
Label3.Text = Format(radius, "0.0")
Label2.Text = "の時の半径は▼"
Label2.BackColor = Color.Khaki
Button1.Visible = False
'計算結果をLabel3に少数1桁で表示
'Label2にButton1と同じ色の背景色で
'「の時の半径は▼」を表示
'Button1は非表示
End Sub
------------------Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Button1.Visible = True
Button2.Visible = True
Button1.ForeColor = Color.Black
Button1.BackColor = Color.Khaki
Button2.ForeColor = Color.Black
Button2.BackColor = Color.LightBlue
TextBox1.ResetText()
Label2.ResetText()
Label2.BackColor = SystemColors.Control
Label3.ResetText()
Label3.BackColor = SystemColors.Control
'Button1を表示
'Button1の背景色をKhaki、文字をBlackに指定
'Button2を表示
'Button2の背景色をLightBlue、文字をBlackに指定
'TextBox1をリセット
'Label2、3をリセット
'Label2、3の背景色をControlに戻す
'Webカラーではなくシステムカラーの指定は
'Color.ではなくでSystemColors.を使う
End Sub
------------------Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
End
'プログラム終了
End Sub
------------------Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
Button1.Visible = True
Button2.Visible = True
Button1.ForeColor = Color.Black
Button1.BackColor = Color.Khaki
Button2.ForeColor = Color.Black
Button2.BackColor = Color.LightBlue
Label2.ResetText()
Label2.BackColor = SystemColors.Control
Label3.ResetText()
Label3.BackColor = SystemColors.Control
'Button1を表示
'Button1の背景色をKhaki、文字をBlackに指定
'Button2を表示
'Button2の背景色をLightBlue、文字をBlackに指定
'Label2、3をリセット
'Label2、3の背景色をControlに戻す
'Webカラーではなくシステムカラーの指定は
'Color.ではなくでSystemColors.を使う
End Sub
End Class