Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for an Elegant "Dont Show Me This Dialog Again" Dialog in C#

I've been looking for a dialog with a checkbox "Don's show me this dialog again" in C#.

I googled and search a lot, but I just could not find an elegant solution.

The dialog should work as similar as the native MessageBox.Show, but with a new property value (bool value) return to the caller.

Thanks.

like image 736
Peter Lee Avatar asked Nov 25 '10 05:11

Peter Lee


2 Answers

Vista and Windows 7 applications can use the new TaskDialog features which extend the standard MessageBoxes to support a checkbox at the bottom (along with all sorts of other goodies such as Command Links, custom button text, footers etc).

alt text

Unfortunately from C# you need to do some interop to access this. If you just want the advanced TaskDialogs to target Vista/Windows 7, use the WindowsAPICodePack from http://code.msdn.microsoft.com/WindowsAPICodePack which can handle the interop complexity for you.

If you need to support XP, there is an excellent wrapper that supports the native TaskDialogs on Vista/7 with a WinForms fallback for XP here: http://www.codeproject.com/KB/vista/Vista_TaskDialog_Wrapper.aspx

like image 117
Ed Andersen Avatar answered Nov 15 '22 08:11

Ed Andersen


Why don't you create your own. It is a very simple one. Just derive from System.Windows.Forms.Form class and mimic it like the one you want.

like image 35
Aamir Avatar answered Nov 15 '22 09:11

Aamir