For the last couple of months, I have been building my own feed reader. Apart from giving me valuable experience with the Whidbey betas and CTP's, I am building it because I am not happy with any other readers. You know how the saying goes, if you want it done right (or your own way), then do it yourself.
Anyway, about four weeks ago, I did something in the IDE which had the effect of incorrectly rendering the form at runtime. I think what killed it was clicking the Synchronize button in My Project -

When the application was run, the form was rendered like this:

The display is a complete mix of themed and unthemed rendered controls and parts of controls. The statusbar, for example, renders the themed gripper, but the background colour is wrong, whereas the gripper and the colour is wrong in the toolbar. The buttons are a mixture of themed and unthemed colours and none of the buttons are shaped correctly. The scrollbar for the browser is also incorrect.
My initial thought was that the RenderMode property of these controls was changed as I have had heaps of problems with Beta 2 not rebuilding the designer file correctly. These were correct though. I thought that maybe it was something in the framework that might have gone funny. I started up a new solution and added the explorer winforms template. That project rendered correctly at runtime. So the framework looks good. My next test was to add a new explorer winforms template to the current project and solution. I set it as the startup form and it also rendered correctly. That leaves me to believe that there is something in the designer for my form that is not correct, but I had checked the designer code against the new forms designer and it all looked good.
Now things get a little weird. I deleted the new form from the project, then went to the project settings to change the startup form from Explorer1 to frmCapella. Just for kicks (actually it was to check nothing was broken) I ran the project. My form suddenly renders correctly again. Thankfully I am using VSS 2005 so I can do a diff of the files against source control. There were four files checked out in the project. Three of the files were identical to source control. The last file was the project file itself. The VSS diff tool highlighted the problem for me.
The Solution:
In the project file, there is an XML node called StartupObject. Source control (the buggy version) had a value of Capella.frmCapella. The new checked out file (the good version) had a value of Capella.My.MyApplication. In the project settings, frmCapella is still the startup form, but now the application is started with the application designer code instead of the main form directly.
The form at runtime now gets correctly rendered with this:

Tags: