Archive for 2010

Our latest release includes three new components for the Toolkit. All of these are modal dialogs that are intended to replace your use of the existing message box, task dialog and input box forms. So now your dialogs can be consistent with the rest of the application by also using the Krypton palette styling.

The switch to using the KryptonMessageBox is very easy because you only need to perform a Find/Replace of the phrase MessageBox.Show with KryptonMessageBox.Show. This is because the exact same static Show methods have been used in the Krypton implementation as exist for the MessageBox which ensures an easy upgrade path. Check out the three new samples that can be accessed from the KryptonExplorer in order to see them working and experiment with the different settings that are possible.

Also present in this release is an important bug fix. Under Windows 7 the showing of a dialog that is derived from KryptonForm can fail. The bug is very nasty in that the dialog simply fails to be drawn on the screen, which is likely to be very confusing for your users. This has now been fixed. For a full list of changes you should check out the change lists that are installed.

New Components
- KryptonMessageBox
- KryptonTaskDialog
- KryptonInputBox

Download 4.3

It’s not often I add something to make VB programmers happy, but today I have gone crazy and added a component called KryptonInputBox that is a Kryptonized version of the InputBox that VB.NET programmers take for granted. It is a very simple dialog box that allows the user to enter a string. There is little customization possible, you can only alter the window title, the user prompt and the default value that populates the text box.

You can use it in the following way…

   string result = KryptonInputBox.Show("Prompt",
                                        "Window Title",

This results in the following appearance…

Don’t say I never do anything for the VB.NET community!

Now that we have added a Kryptonized version of the MessageBox it seems reasonable to keep that theme going and add a Krypton version of the TaskDialog. For those not familiar with the TaskDialog it’s a feature added with Windows Vista and is essentially a MessageBox on steroids.

I would however point out that our Krypton version is not intended as an exact copy. It is very similar but it might not contain absolutely everything that is possible with the operating system version of the dialog. However, something is better than nothing and so here is what we have.

Basic Settings
The most basic settings allow for a window title, main instructions, content details, associated icon and the specification of dialog buttons.  You can omit any of these values in which case they will not be displayed. Here is an example of the dialog when they have all been specified with simple values…

CheckBox Settings
You can optionally define a CheckBox that is presented in the same area as the dialog buttons. You can define the text for the control as well as the initial checked state. This is more useful than it might first appear. A common scenario is to present warning messages to the user, but ff the user finds these annoying the checkbox could be checked to indicate that the warnings should be suppressed in the future. Or maybe the checkbox is used to indicate that the selected option should always be used in the future without the need to ask again.

Footer Settings
Additional information can be shown to the user in the footer area of the dialog. You can set an image, footer text and hyperlink text for this area or any combination of the three values. This is very useful if you want to allow additional help documentation or webpages to be shown in response to a hyperlink being pressed.

Radio Button
Use the radio button feature to present a multiple choice to the user. A simple collection property is used to specify the list of possible options and the selected value is available as a property on the KryptonTaskDialog class when the dialog has been removed.

Command Settings
This is similar to the radio buttons except the choices are presented as a set of buttons. Each button is assigned a DialogResult value and so on return from the dialog being dismissed you can check the return DialogResult to see which command was selected by the user.

As an extreme example you could even specify all the possible features and show the following…

…although I am not sure your users would appreciate such a monstrosity!

Due to popular demand, well at least 2 people anyway, I have added a Kryptonized version of the standard windows MessageBox funtionality. In order to make it fully backward compatible I have provided a set of static methods that have identical parameters to the existing MessageBox methods. So you need only perform a search and replace of the existing MessageBox.Show methods so they become KryptonMessageBox.Show instead.

Here you have some examples of the appearance using different palettes…

The text used in the buttons is localizable and exposed via the KryptonManager component. So if you need to define text for non-English systems you can update the new GlobalStrings property of the manager and all message boxes will then use those updated strings.

If you are using a Krypton application on Windows 7 machines then you need to be aware of a potential bug that is quite nasty. When using ShowDialog to show a window that derives from KryptonForm the window will sometimes not appear. This only seems to be the case when you have the Desktop Window Manager (DWM) enabled. It will effectively be invisible even though it has been successfully created.

For those now aware, the DWM is responsible for the Aero theme (sometimes known as the glass). Needless to say, your customers are going to be confused if a window is just plain missing. In fact your developers are going to be pretty confused as well.

The workaround for this is quite simple. You need to hook into the Shown event of the modal window and then add the following call to the PerformNeedPaint method:-

    private void Form1_Shown(object sender, EventArgs e)

I expect to release a maintenance release in about three weeks that will include this fix along with any other fixes and changes that accumulate between now and then.