VB设计如图所示的改变文本框中文字字体及文本框前景色及背景颜色设置的菜单,一个简单窗体
Private Sub Text1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
Text1.Enabled = False
PopupMenu Me.右击
Text1.Enabled = True
End If
End Sub
Private Sub text背景_Click()
CommonDialog1.ShowColor
Text1.BackColor = CommonDialog1.Color
End Sub
Private Sub text前景_Click()
CommonDialog1.ShowColor
Text1.ForeColor = CommonDialog1.Color
End Sub
Private Sub 字体_Click()
On Error Resume Next
CommonDialog1.ShowFont
Text1.FontBold = CommonDialog1.FontBold
Text1.FontItalic = CommonDialog1.FontItalic
Text1.FontName = CommonDialog1.FontName
Text1.FontSize = CommonDialog1.FontSize
End Sub