gpt4 book ai didi

vb.net - Visual Basic 中 MsgBox 的粗体字体

转载 作者:行者123 更新时间:2023-12-02 05:14:42 25 4
gpt4 key购买 nike

如何在 Visual Basic 2008 中将 MessageBox 中的字体设置为粗体?

我希望它是这样的:

MsgBox(Documentation: .........) 

“文档”将以粗体显示。

最佳答案

正如 aphoria 所说,VB 的 MsgBox 不允许粗体文本。以下是解决此问题的方法:

1) 添加“新 Windows 窗体”2) 添加一个富文本框3)添加你想要/需要的命令按钮的数量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()

希望对您有所帮助。

关于vb.net - Visual Basic 中 MsgBox 的粗体字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14840843/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com