如何在Visual Basic 2008中的MessageBox中使字体变粗?
我想这样:
MsgBox(Documentation: .........)
其中“文档”将以粗体显示。
答案 0 :(得分:3)
正如aphoria所说,VB的MsgBox不允许使用粗体文本。以下是您解决这个问题的方法:
1)添加“新Windows窗体” 2)添加RichTextBox 3)添加你想要/需要的CommandButtons 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()
希望有所帮助。
答案 1 :(得分:1)
内置MsgBox
功能无法执行此操作。如果你确实需要,你必须建立自己的。