控件 | 属性 | 值 | 控件 | 属性 | 值 |
GroupBox | Text | 字体颜色 | GroupBox | Text | 颜色强度 |
Radiobutton | name | rdbRed | radiobutton | Name | rdbLow |
Text | 红色 | Text | 低 | ||
Check | True | Check | True | ||
RadioButton | Name | rdbGreen | RadioButton | Name | rdbMid |
Text | 绿色 | Text | 中 | ||
RadioButton | Name | rdbBlue | RadioButton | Name | rdbHigh |
Text | 蓝色 | Text | 高 | ||
Label | Font | 隶书,20pt | Form | Text | 字体样式 |
Text | 文字示例 | ||||
CheckBox | Text | 粗体 | CheckBox | Text | 下划线 |
CheckBox | Text | 斜体 | CheckBox | Text | 删除线 |
Button | Text | 设置 | Button | Text | 退出 |
Public Class Form1
Private Sub btnSet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSet.Click
Dim MyFontStyle As FontStyle = FontStyle.Regular
Dim ColorDegree As Integer
If rdbLow.Checked Then
ColorDegree = 50
ElseIf rdbMid.Checked Then
ColorDegree = 150
Else
ColorDegree = 250
End If
If rdbRed.Checked Then
lblSample.ForeColor = Drawing.ColorTranslator.FromWin32(RGB(ColorDegree, 0, 0))
ElseIf rdbGreen.Checked Then
lblSample.ForeColor = Drawing.ColorTranslator.FromWin32(RGB(0, ColorDegree, 0))
ElseIf rdbBlue.Checked Then
lblSample.ForeColor = Drawing.ColorTranslator.FromWin32(RGB(0, 0, ColorDegree))
End If
If chkBold.Checked Then
MyFontStyle = MyFontStyle Or FontStyle.Bold
End If
If chkItalic.Checked Then
MyFontStyle = MyFontStyle Or FontStyle.Italic
End If
If chkUderline.Checked Then
MyFontStyle = MyFontStyle Or FontStyle.Underline
End If
If chkStrokOut.Checked Then
MyFontStyle = MyFontStyle Or FontStyle.Strikeout
End If
lblSample.Font = New Font(lblSample.Font, MyFontStyle)
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
End Class