2013-02-12 219 views

回答

1

內置的MsgBox函數不能這樣做。如果你真的需要,你將不得不建立自己的。

+1

或者用win32 api鉤住它,但是再一次...創建一個自己的對話框要容易得多。 – Styxxy 2013-02-12 20:11:00

3

正如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() 

希望有所幫助。