this looks like a job for... tomorrow!

Behold the Power of Vista

One of Vista's unadvertised, and probably underappreciated, features is the ability to stop time:


It's actually quite disconcerting, because I glance at the time alot, but it doesn't really consciously register with me what time it is. After about 30 minutes, I start thinking that it seems like time is dragging on. Then I'll notice the discrepancy with the IRC timestamp, and the world becomes clear again (and hopefully I'm not late for anything).

I'm sure stopping time will come in handy next time I have a deadline to meet.

TabStrip

I have a new favorite blog: http://blogs.msdn.com/jfoscoding/default.aspx

Even though the author is gone and no longer posts to it, there are years of nitty gritty details about WinForms available, especially the ins and outs of things like ToolStrip. I have no idea how I did not find this previously. I searched high and low for a custom ToolStripRenderer to bootstrap me when I first started ToolStrip, to no avail. (In fact, I didn't even find this by searching for ToolStrip, I was actually searching for an example of what I should do in ProcessMnemonic.)

One thing that caught my eye was a demonstration (MS Word) of how to make a ToolStrip render like the tabs used for documents in Visual Studio 2005. For example:


It turns out this is a great testcase for me. Implementing a public API so that it performs what a user expects is one thing. Behaving correctly when someone has selectively overridden completely random protected functions of your implementation is another thing. So I ripped out the VS designer stuff and put the rest on top of Mono's ToolStrip.

I am relatively proud of how well my implementation stood up. I had to implement a missing method (SetItemLocation), tweak the SetDisplayedItems, and apparently borders are drawn last on a ToolStrip instead of first. In the end, I got a more accurate implementation and this:


Now I just need to get this guy to post his promised VistaToolStripRenderer. :)

Note: I still have to clean up my ToolStrip changes, so they are not in SVN yet.

A Little Strip of Progress

One of my personal goals for the next release of Mono is to fix many of the issues in MenuStrip, ToolStrip, and StatusStrip that manifest themselves in our port of Paint.Net 2.72. Paint.Net has been a godsend for the Winforms team, as it's over 100,000 lines of open-source C# Winforms code. It has helped us find countless bugs in our implementation, as well as some affirmation that we must have plenty of things right if we can run it decently well.

The main menu and tool bar were already in pretty good condition, as they exercise common use cases that I had worked on before. The only noticeable issue was that we were not querying Windows for the a couple of system colors, resulting in an ugly gray color scheme instead of the nicer, uh, beige?

(Click on images to enlarge.)

The tool box took a little bit more work. For ToolStrips, there are five different layouts you can choose. The only one I had implemented was HorizontalStackWithOverflow. The tool box needed Flow, so I had to modify the FlowLayout engine to layout ToolStrips as well. The result is pretty good. I think the two missing buttons are due to something missing in the port.


Finally, the StatusStrip has it's own layout type: SpringTableLayout. That had to be implemented as well as making sure that ToolStripControlHosts properly hid their hosted controls when they weren't visible. (The rectangle in Mono 1.2.3 is a hidden ProgressBar.)


Obviously, there are still several remaining issues that need to be cleaned up, but I'm quite proud of the progress so far.