Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我创建了一条错误消息,其中包含每个值是通过还是失败。我希望每个条目根据 Passed = green 和 pail = red 更改颜色。
例子:
这会显示在输出消息框中,目前
msgBox(errorMessage)
当它显示出来时,我喜欢失败的背景为红色,而通过的背景为绿色。目前我仍然被认为是 VB.Net 的新手,我知道如何处理鼠标悬停和鼠标离开。我假设我需要进行类似的活动。
感谢您的帮助。
您不会使用内部调用的MsgBoxorMessageBox.Show来执行此操作。MsgBox您将不得不创建自己的表单,然后Label为每一行添加一个,在这种情况下,您可以为每一行设置ForeColor一个,或者使用 GDI+ 自己绘制文本。如果您确实走这Label条路,您可能需要使用 aTableLayoutPanel或FlowLayoutPanel保持它们正确对齐。
MsgBox
MessageBox.Show
Label
ForeColor
TableLayoutPanel
FlowLayoutPanel