In order to support the drop down menu needed for a ribbon gallery I have added a new item type for the KryptonContextMenu. The KryptonContextMenuImageSelect is used to display a range of images that the user can select from. Here you have two instances with a horizontal separator between them…


You provide an ImageList along with the starting and ending indexes of items of interest from the list. This allows you to use the same ImageList instance with multiple KryptonContextMenuImageSelect items but just change the index range between as appropriate.
Use the SelectedIndex property to define the index of the item that should appear selected. When the user selects an item the SelectedIndex is updated and the SelectedIndexChanged event fired. There is also an event that called TrackingItem that is fired as the tracking item changes. So you can provide instance feedback in order parts of your application if that is appropriate.
Posted in Krypton Toolkit | 2 Comments »
Thursday, March 20th, 2008
Adding the KryptonGallery into the KryptonRibbon involves updating the shrinking algorithm for determining the size of group elements. It needs to be updated so that it can handle more than the existing concept of Large, Medium and Small for each group item.
As you may know, each group item has three possible sizes and the shrinking algorithm automatically downgrades items to smaller sizes when there is not enough space. So a triple container with three buttons might start off in Large size but progressively down shift to Medium and then Small as space becomes constrained. This is fine for buttons because we can easily define three distinct ways of drawing the buttons in those sizes.
The gallery component actually needs to be sized in more than 3 variations. To show this we have the following image that demos a simple group that is shrinking as size is decreased…


Our gallery still has the concept of being in Large, Medium or Small setting. But it has a couple of extra properties called LargeItemCount and MediumItemCount. At the top of the above image you can see the group when it has as much space as it wants, where the gallery is in Large setting and the default value of 6 is assigned to the LargeItemCount. You can see the gallery is displaying with 6 images.
As space becomes constrained it will reduce the size of the gallery by one item at a time until it reaches the MediumItemCount count and which point it enters the Medium setting. The MediumItemCount value is defaulted as 3. You can see this process occuring in the top four instances of the group in the above image. Each time it shrinks, one more item is removed from the gallery until it finally reaches MediumItemCount.
Notice that during this shrinking it has left the two buttons unchanged. This is because the shrinking algorithm has been changed to not only progressively reduce the gallery from LargeItemCount to MediumItemCount but also to always reduce the size of all the galleries to Medium before it reduces the size of other group elements. This is reasonable as the gallery should take up as much room as it wants if the space is available. Once the gallery is down to the minimum size required for showing a full gallery, the Medium setting, then the usual shrink semantics you are familiar with are applied. Where elements are shrunk in turn from right to left in a cyclic fashion.
The second to last instance in the above image shows that now other group elements are included in shrinking and so the buttons are reduced in size. Finally the gallery enters the Small setting, in the last example above, which replaces the full gallery appearance with the button appearance.
Of course, this sounds much more complicated than it appears when you actually play around with it. In practice you just need to set the LargeItemCount to the number of items you want to appear when space is unlimited and then set MediumItemCount to the number of items that are shown just before it is removed in favor of a button appearance. Just let the ribbon take care of the details at runtime!
(Note that the ribbon can handle multiple galleries inside a single group. In that case they will be shrunk in turn until all have reached the MediumItemCount values and then all the other elements are again including in shrink calculations.)
Posted in Krypton Ribbon | 2 Comments »
Thursday, March 6th, 2008
I’m looking at adding some testimonials to the website in the near future. So this is a call out to all Kryton Toolkit fans for feedback that I can use. A couple of sentences about the toolkit and your name, company and country would be ideal. If you refer not to give a company name then that is fine. Here is an example…
“Kryton Toolkit is the best thing since sliced bread! Saved me a heap of time and impressed my boss no end.”
Phil Wright, Component Factory, Australia
Place your testimonial as a comment or as an email direct to me. Many Thanks!
Posted in Krypton Toolkit | 5 Comments »
Wednesday, March 5th, 2008
It’s been a long time since my last post so I want to give you a quick update on progress.
After adding many new Toolkit controls/components it was time to do those tasks that all programmers hate, samples and documentation. Essential work, but not the kind you can really blog about! In the tradition of always showing lots of pictures, here is my pic about the samples work…




With all the recent additions the free Toolkit now has 26 controls/components that are available from the toolbox at design time. And this does not include the list of various items that can be added to the KryptonContextMenu which would expand it even more! Amazing how small changes add up over time.
Feedback on the KryptonContextMenu has been that adding/removing items is not as easy as people would like. Adding a full design time experience like the ToolStrip functionality would take far too long to implement so I compromised with the following collection editor instead…


This appears when you use the edit button of the KryptonContextMenu items collection. It shows a TreeView on the left with the hierarchy of context items. In the middle are buttons making it quick and easy to add new items and on the right, not visible above, is a property grid showing properties of the selected item. I hope this makes life a little easier in future.
Now onto something far more exciting. The KryptonRibbon needs a gallery feature in order to fully mimic the functionality available in the Office 2007 version. Rather than restricting this to the ribbon I think it would be quite useful as a standalone control as well. After all, the gallery control is really just a way to select from a list of multiple images. Something that is required outside the ribbon scenario. So here is what i have so far…


I have only just begun the control but you can see that it is coming along nicely. We have the three buttons on the right hand side for scrolling the view and dropping down a context menu. I will post about the gallery control in more detail once I have something closer to the finished product.
Posted in Krypton Ribbon, Krypton Toolkit | 7 Comments »