设置字体
控件:FontDialog,label
注意:FontDialog1.showApply=true FontDialog1.showColor=true FontDialog1.showEffect=true
代码:
- If FontDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
- Label1.Font = FontDialog1.Font
- End If
设置颜色:
控件:ColorDialog1
- If ColorDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
- Label1.ForeColor = ColorDialog1.Color
- End If
关于复选框
- Dim italicfont, regfont As System.Drawing.Font
- italicfont = New System.Drawing.Font(Label4.Font, FontStyle.Italic)
- regfont = New System.Drawing.Font(Label4.Font, FontStyle.Regular)
- If CheckBox4.CheckState = CheckState.Checked Then
- Label4.Font = italicfont
- Else
- Label4.Font = regfont
- End If
判断这个复选框被选中时,应该发生什么行为? 下面的仅为借鉴
- Private Sub opt486_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles opt486.CheckedChanged
- If sender.checked Then
- strcomputer = "486"
- Call displaycaption() '调用某一个过程函数
- End If
- End Sub