Monday, September 5th, 2011
I know it has been a little while since I last posted. This is because I have now take a contract job and so have been working full time for the last six weeks. This will continue for at least another couple of months and if they offer a contract extension I will certainly accept it.
As anyone in the component development industry will tell you the demand for WinForms controls has been on the slide for a few years. It has not been a crash, with sales falling off a cliff, but the demand peaked a few years ago and it has been slowly running downhill. In itself this is not surprising as WPF is capable of taking the place of WinForms for desktop development work. Plus you have the inexorable rise of Internet applications with Silverlight providing a rich web application platform for .NET developers.
A year ago sales were enough to pay me the same as a senior developer position. That is no longer the case and with WinForms sales trending downward that is not going to change. Hence I have entered the job market again. This does not mean the end of Krypton. I will still be working on Krypton and making new releases. But it does perhaps mean the end of major new additions. It is going to be tough to write a major component such as a Grid control when you are working on it only in your spare time.
After some weeks working on the PFGrid.NET code base I have unfortunately come to a realisation I did not want to make. The full list of features I want to make available in a Krypton grid control are just not possible with that code. I started work on updating the design but it has become obvious that it would be better to start from scratch than try to alter the existing design. So unfortunately I have decided to not use the PFGrid after all. So instead I need to build my own from scratch. A big job but sometimes there is nothing for it but to roll up your sleeves and get stuck in.
It gives me great pleasure to announce an agreement has been reached to license the PFGrid.NET control for use within the Krypton Suite. There have been many requests for a high quality grid within the Krypton Suite and this will now be possible by Kryptonizing the excellent PFGrid.NET. It has all the features you would expect such as grouping, filtering, sorting, tree list mode and so forth.
You can check out the grid in more detail by visiting the PFGrid.NET website. I will be Kryptonizing the control over the next few weeks so that it has the same look and feel as the rest of the Krypton controls and uses the palette system for obtaining appearance information. I will blog about progress as I go along.
Here are just a couple of pictures…
Drawing the tree nodes is much tricker than it might sound. When you perform custom drawing of the entire node it does not modify how the mouse interacts with the node itself and so you need to ensure that the drawing is aligned with the expected mouse locations. For example, when drawing check boxes I must ensure that I draw them in the exact pixel offset from the left of the control. Otherwise they will look nice but the users’ clicks will not match the drawn location and so the interaction will not work as expected.
Here you can see the drawing of check boxes and how the highlight for the selected/tracking node is immediately adjacent to the check box itself. This is not very pretty and I would prefer a pixel gap between the check box and the highlighting but this is not possible because that is the method expected by the tree control.
You can assign an ImageList to the KryptonTreeControl and then use the per-node image index to draw images by the nodes. Luckily the standard tree does have a gap between the right of the image and the node highlighting so the appearance looks tidier than for check boxes.
Also implemented is the use of the StateImageList that is used to provide an optional per-node image at the left of the node drawing. In this example I used set this up on the top two nodes only.
I honour the BackColor, ForeColor and NodeFont overrides that are defined per-node. This allows you to provide a custom look for each node to reflect status.
To make like a little easier for developers I have added a new class called KryptonTreeNode that derives from the standard TreeNode class. It adds an extra property called LongText that is an extra string that will be drawn when defined to the right of the standard node text. It also includes a LongForeColor and LongNodeFont pair of overrides allowing the l0ng text to be drawn differently.
Note that apart from the KryptonTreeNode there is no new functionality in the control. It is really just a standard TreeView with some custom drawing and so any requests for new features will not be possible. It is just a TreeView!
I have started the process of creating a Kryptonized version of the TreeView control. As with many of the Krypton controls in the Toolkit it works by using the custom drawing ability of the standard TreeView control. So it will not have any new functionality but should draw in a manner consistent with the rest of the Krypton controls.
So far I have implemented drawing the node text and the tree plus/minus nodes and lines. You can see two examples below, the first using the Office 2010 Blue palette and the second the professional palette.