After a refreshing two week break I am back at the wheel and working on the KryptonForm custom chrome functionality.

Actually I’ve been back for a week and after spending a couple of days catching up with emails am now hard at work on KryptonForm. Adding the custom chrome capability is proving trickier than I anticipated. , Each time I think I’ve figured something out a couple unexpected side effects appear and cause a rework of the code.

Code that works fine with a static border size and display in my prototype application fails once you add the dynamic customization ability that Krypton exposes. Instead of always having a fixed width on the border the developer can alter the border width at any time using the StateCommon and other instance properties. This flexibility is great for the user of the library but exposes gotchas in the implementation.

For example, I thought I had the sizing of the window border working nicely until I noticed that minimizing and restoring the window caused its size to change. Not because of anything I was doing, but there must be some windows code that is making assumptions about the border size and it applies changes during the min/restore process. Sadly these assumed changes do not play nicely with my code and so it took several hours to find a way to work around the issue.

At the moment I have the custom chrome working with a simple border around the client area. There is no caption bar or any caption buttons. Here is the window when active….

…and when inactive.

Not very exciting but it respects changes you make on the fly to the StateActive, StateInactive and StateCommon properties.

Now, I need to sort out getting it to work when you have rounding for the border or when you specify only a subset of the borders be drawn. So that it acts exactly like a border you can customize for a KryptonButton, KryptonGroup or other such control.

Leave a Reply