Wednesday, April 29th, 2009
Krypton Sale – 25% Off for April 2009
(You only have 2 days left to take advantage)
To celebrate the release of Krypton Suite 3.5 we are offering a 25% sale on all prices for April. Combine this with our 60 day money back guarantee and you would be mad not to give Krypton a try out.
Use Krypton to build WinForms applications with the latest look and feel including the Office 2007 and Windows Media Player themes.
See our 25% off prices…
Prices Page
Download Krypton Suite…
KryptonSuite352.zip
Posted in General | 2 Comments »
KryptonWorkspace has a new property called MaximizedCell that positions a cell to occupy the entire client area of the workspace. This allows the user to concentrate on an area of special interest for a period of time before returning to the previous layout. Here we have a simple workspace with three cells defined.

Right clicking on the Workstation tab header shows a context menu with a new Maximize option.

Selecting the option gives the following maximized layout with all but the maximized cell hidden from view.

Right click the tab header again and you will find the Maximize option has changed to become Restore instead. Keyboard users can use the shortcut Ctrl + Shift + M combination to toggle between maximized and restored.
In the examples above you can see a ButtonSpec that I added with appropriate images that allows an easier method of switching without requiring the user to discover the feature by looking at the context menu. This ButtonSpec is not added by the workspace and so if you want the same ability you will need to add it manually just as I did. You can see the new Cell Maximize + Restore sample to discover the few lines of code needed to add this capability.
Double Clicking Tabs
I’ve also added a new event to the KryptonNavigator called TabDoubleClicked which is fired whenever the user double clicks with the left mouse button on the tab header. In my new sample this is used to toggle the maximzed state but you could use this as a trigger for any default action you would like to perform.
Posted in Krypton Navigator, Krypton Workspace | 2 Comments »
Wednesday, April 22nd, 2009
I love the KryptonWorkspace. When you combine the flexibility of the KryptonNavigator with drag and drop positioning you have a great control. But a missing feature is the ability to persist the workspace layout so that it can be restored again. Many applications would like to save the layout when closed and reload it again at restart. Even better would be allowing the user to save multiple layouts so they can quickly switch between them as needed at the click of a button.
Persistence Formats
Use SaveLayoutToFile and LoadLayoutFromFile in order to persist to/from a file. The actual contents of the file will be an XML document but you can ignore this as modifying the contents risks making it invalid. Alternatively use the SaveLayoutToArray and LoadLayoutFromArray methods to deal with arrays of bytes. An array of bytes makes it easy to save the data into a database and so associate the layout with user’s details. Or you could convert the array of bytes into a Base64 string and include it into your own applications persistence mechanism.
There are two other formats for those needing even more options. SaveLayoutToXml and LoadLayoutFromXml use references to instances of XmlTextWriter and XmlTextReader classes respectively. So if you are already using these two classes for streaming your own data you can call into these methods and have the layout data inserted into your own XML data. Finally th SaveLayoutToStream and LoadLayoutFromStream are the most flexible and allow you to supply any Stream derived class.
Persisted Information
The hierarchy of the layout is saved starting with the Root sequence of the control. Each workspace sequence and cell is saved along with the details needed to recreate that item. Each cell can contain any number of individual KryptonPage instances, so details about each page are also saved including most, but not all, of the properties of the page. You should assume that everything about the page is saved except for two types of information. The actual set of child controls that exist on the page are not persisted and neither are the modified values of the State properties. We can see the implications of this by looking at the two likely scenarios for usage.
In the static scenario the set of pages in the workspace are going to be fixed and so every time you run your application the pages are identical. This is the easiest situation to handle. Reloading is only expected to result in the repositioning of pages into a new layout but not cause the creation or removal of pages. You do not need to write any additional code to handle this scenario and simply calling the Save/Load methods will perform this default behavior. This is because when a page is loaded the control attempts to lookup the named page in the existing set of pages. If found it simply uses that existing page. In this static scenario the loading page will always be found and so reused.
In a dynamic scenario the set of pages could be different every time the application is run. Here you would be creating new pages depending on the users actions. Now when you load a layout you are likely to find that none of the existing pages match those being loaded. When a loading page does not match any of the existing ones then it creates a new page instance and updates the page with the loading data. Once the loading is complete it will remove any pages that are no longer required. This scenario does require you to write some additional code because the child controls on a page need to be created by the developer and are not persisted by the workspace control. Hook into the PageLoading event which is called each time a page is loaded and add the child controls as appropriate for that page (more on this below).
Customization Events
It is very likely you will want to save some additional application specific information along with the automatically generated content. To allow this use the GlobalSaving and GlobalLoading events to persist whatever arbitrary data you like. Use the PageLoading and PageSaving to persist custom data on a per-page basis.
As noted above, the PageLoading is the event used to not just recover custom data but also allow you to modify the page instance before it is used. If you have pages being created then this is where you would add the appropriate child controls and perform whatever data binding etc might be required. You can go even futher than that and assign a new page instance to the returned event data so that your assigned page is used in place of the original. It will probably be easier to create a new page in your event handler than try to customize the page provided by adding the child controls in code. Note you could assign null to the returned event data and so prevent a page being added at all. This is the technique needed to prevent a loading page from being added to the workspace, effectively ensuring the loading page is ignored as no longer required.
Our final event is fired at the end of the loading process and called PagesUnmatched. This event provides you with a list of pages that were present before the load started but were not matched with any loaded page. By default, if you do nothing then those unmatched pages will be deleted from the workspace. Hook this event if you need to examine that list of unmatched pages and instead use code to add them into the workspace again so they are not removed.
I have added a new workspace demo that shows per-page custom data being added to the persisted information so that you can see in code how easy it is.
Posted in Krypton Workspace | 5 Comments »
Thursday, April 16th, 2009
The global recession has been underway for a year and I’ve been wondering how long will it last. How bad can it get before the return of growth?
Being from the UK I often read the BBC News website and spotted this graph that really puts it into perspective. It shows a comparison between the current downturn and the recessions in 1980 and 1990. Keep in mind these figures are for the UK only.

We can clearly see that the red line is marching downwards without any sign yet of turning. The recession is already much worse than that of the 1990’s and seems to be matching that of the 1980’s. Obviously no one knows when it will actually turn but lets assume it matches the 1980’s recession. In that case we can expect all of 2009 to consist of negative growth. Starting in 2010 we could see growth return but it would still take another two years for output to reach pre-recession levels.
If however, the red line keeps going past the 1980’s level then we can expect even more than 3 years before the economy is back in reasonably good shape. That means we will be telling our kids about the Great Recession.
But we need to take care before becoming as depressed as the economists. This recession is going to split people into two groups. If you’re laid off then things are going to be pretty rough for quite a long time. But remember that 90% of people will not lose their job. That means 90% of households are paying much lower interest rates of their mortgage and if you need to replace your car then now is the best time of your life. So most people will have the chance to emerge from the downturn in a much better financial position than when they entered it. I hope that that most of us fit into that category.
Posted in General | 1 Comment »
Wednesday, April 15th, 2009
Includes an important fix with the KryptonTextBox that was displaying the password text when in disabled mode. This made the text box unusable when disabled.
Download 3.5.2
Posted in General | 2 Comments »