Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
208 views
in Technique[技术] by (71.8m points)

c# - Custom Message Box

Is it possible to create my own custom MessageBox where I would be able to add images instead of only strings?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I also wanted this feature, so I created WPFCustomMessageBox, a WPF clone of the native Windows/.NET MessageBox which supports extra features like custom button text.

WPFCustomMessageBox uses static methods just like the standard .NET MessageBox, so you can plug-and-play the new library without modifying any code. Most importantly, I designed this control so it looks identical to the original MessageBox.

WPFCustomMessageBox example

I created this library because I wanted to use verbs for my MessageBox buttons to help users better understand the functionality of the buttons. With this library, you can offer your users button descriptions like Save/Don't Save or Eject Fuel Rods/Don't do it! rather than the standard OK/Cancel or Yes/No (although you can still use those too, if you like).

The WPFCustomMessageBox message boxes return standard .NET MessageBoxResults. It also offers the same features as the original MessageBox like MessageBoxIcons and custom message box captions.

WPFCustomMessageBox is open source, so you can grab the code or make improvements here: https://github.com/evanwon/WPFCustomMessageBox

You can add WPFCustomMessage to your project via NuGet: https://www.nuget.org/packages/WPFCustomMessageBox/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...