How can I show the text in bold in the dialog displayed by MessageBox.Show
, using C#?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
It is possible, a message box is a regular window that can be messed with like any other. The code to do so is however a bit gritty. Add a new class to your project and paste this code:
And use it like this:
There is one flaw in this approach. After making the font bold, the text must still fit in the static control that the message box reserved for the text. That required me to make the font smaller. You may have to tweak this value.
No can do. You'll have to build your own box. I'm assuming that this is WinForms, if it's ASP.NET I'm not qualified to answer.
You can't. This is a wrapper for the API MessageBoxEx.
Create your own custom messagebox to do it.
You can follow this tutorial, as an example of how to implement one.
The basics steps of creating such a form:
Extended MessageBox .NET Assembly XMSG .NET web page: more info, download
Adjusts on the fly wide variety of MessageBox visual settings.
Adjustable features include message font and color, button captions, fonts and tooltips, dialog background, dialog position, dialog icon, timeout and more. Depending on message font selected, the dialog window automatically resizes itself to accommodate the message.
Additional controls that can be optionally displayed: check box, text input, web link, up to 3 extra buttons.
In your .NET code you still call regular MessageBox.Show. Extended MessageBox is not a custom-made dialog. This is still regular MessageBox with extended features added.
OS supported: XP, 2000, 2003, 2008 Vista, Win7 -- 32 or 64-bit.
Downloads include fully-functional trial version, and regular version with complete C# source code.