如何在Visual Basic 2008的MessageBox中使字體粗體?Visual Basic中MsgBox的粗體字體
我想有這樣的:
MsgBox(Documentation: .........)
其中,「文件」將用粗體字顯示。
如何在Visual Basic 2008的MessageBox中使字體粗體?Visual Basic中MsgBox的粗體字體
我想有這樣的:
MsgBox(Documentation: .........)
其中,「文件」將用粗體字顯示。
內置的MsgBox
函數不能這樣做。如果你真的需要,你將不得不建立自己的。
正如aphoria所言,VB的MsgBox不允許粗體文本。這裏是你如何解決是:
1)添加一個「新的Windows窗體」 2)添加一個RichTextBox 3)添加要CommandButton控件的#/需要 4)轉到代碼的形式和做類似以下的事情
Public Sub CustomMessageBox(ByVal msg As String, ByVal isBold As Boolean, ByVal color As System.Drawing.Color, ByVal buttonOneText As String, ByVal buttonTwoText As String, ByVal startBoldAt As Integer = 0, ByVal endBoldAt As Integer = 0)
' Use parameters to pass the values you want to show
' startBoldAt will be the position in the string where you want to have bold lettering begin, and endBoldAt will be the position in the string where you want bold lettering to end.
End Sub
Then you can do:
Dim cmb as CustomMessageBox = New CustomMessageBox('Your parameters)
' Add a sub that will let you show the CustomMessageBox
cmb.Show()
希望有所幫助。
或者用win32 api鉤住它,但是再一次...創建一個自己的對話框要容易得多。 – Styxxy 2013-02-12 20:11:00