Andrej Tozon's blog

In the Attic


Smart, meet beautiful

"Smart, meet beautiful" - this is the message you're greeted with towards the end of Microsoft Vista Pre-RC1 installation. And yes, Vista continues to look better with each new build [but I'm hardly getting any smarter...]. The latest build (5536). available for download for the first 100.000 people, appears to run a bit faster (graphics/drawing) on my notebook, making me comfortable doing my regular work in Visual Studio 2005 and Office 2007. IE7 appears to perform better too. Now, with the first RC just behind the corner, the wait for the late January release continues...

Also, XNA Game Studio Express Beta has just been released. If you ever wanted to build a good looking game for Windows (who hasn't?) or Xbox 360 (!), now you can do it using C# and Visual Studio 2005 (C# Express). Now, C# Express Edition is required on the system before installing XNA GSE even if  VS2005 (Standard or higher) is already installed) - it's somewhat a double install but both versions of Visual Studio can coexist on the same machine without interfering with each other.
I installed it and tried to run the included "Spacewar Starter Kit", but without luck - my video card on this machine is way behind the required standard (DirectX 9.0c). On hold till final release...

Windows Forms controls - controlling the z-order

Talking to other developers and hanging around newsgroups and forums I noticed quite a few people have problems arranging controls on a windows form in design time. A typical problem is the overlapping of docked controls. For example, put a Panel and a MenuStrip on a blank form (in that exact order) and set Panel's Dock property to Fill [MenuStrip should already be docked to top]. This results in Panel's top area being hidden behind the MenuStrip:


Why's that? The way how controls on a form are docked is determined by the z-order [how controls are layered along the form's Z-axis - depth]. The control's z-order is determined by its position in container's Controls collection, with the first control in the collection being at the front (top layer) and the last at the back.

Thus, in the previous example, the form's Controls collection order is: [0: MenuStrip, 1: Panel], and since higher-layered controls can overlap those behind them, the Panel, having Dock set to Fill, can take all the space it needs, without MenuStrip blocking its way.

Now, as you've already guessed, we need to change control's z-order to make things look right. If Panel was put in front of MenuStrip, MenuStrip would still be visible (it's docked to Top) and Panel would only occupy the remaining of form's space.

To fix this at design time, we have a few options:

  • Right-click on the Panel and select "Bring to Front". This will change Panel's position in form's Controls collection to 0, making it the top of z-order. Similarly, you could right-click on MenuStrip and choose "Send to Back".
  • Select the Panel and choose "Format | Order | Bring to Front" from Visual Studio's menu. There are also two icons on the Layout toolbar that do the same thing.

  • Visual Studio 2005 also includes a very useful tool window called Document Outline (menu: View | Other Windows | Document Outline, shortcut: Ctrl+Alt+T), allowing you to rearrange controls by simple drag and drop operations, moving it among different containers and changing their z-order:

At run time, when adding controls dynamically, you can change control's z-order programmatically: every control, derived from Control class, has BringToFront() and SendToBack() methods:

Panel panel = new Panel();

There's many ways you can control the layout of your forms and controls, changing z-order is just one of them. Setting your controls' margins, padding, anchoring and docking properties properly will help you create powerful layouts, which will automatically adjust to various screen resolutions and form's sizes, without the need of additional coding for adapting user controls when user resizes the form.

[Update: images above were copied directly to WLW and published using FTP Image publishing feature. Issues encountered were image blurring - see above - and numerous errors/republish attempts to upload all images successfully. Also, pictures were "taken" on Windows Vista July CTP]

Accessing (more) old posts with WLW

I thought about moving some of my posts from my old blog to this one - Windows Live Writer doesn't really have an option to copy posts between blogs (yet?), but since it supports the Blogger API, it's easy to access and open those old posts nobody wants to read anymore...

So I added a new weblog account to WLW and connected to Blogger and immediately got my blogger theme look and feel in Writer's document area - this works great. The problem was with how to access all of my old posts since WLW only offers the listing of maximum 25 (latest) posts... To show more, registry tweaking is required: open the registry editor and scroll down to the WLW Preferences section: HKEY_CURRENT_USER\Software\Windows Live Writer\Preferences\PostEditor\RecentPostDefaults, where you'll find a list of guids, representing your blog configurations. In the Data column, you'll see currently set numbers of posts to be displayed (5, 10, 15, 20 or 25). Simply double click on these items and set the higher number - 50, 100, ... When you return in WLW the number will be (re)set to that number and you'll be able to access much more posts than before.

Now, to republish old posts in my current blog, I'd have to copy the post into a new blog post, set its original date and title and publish it in the new blog.

[Be careful when editing registry settings - changing wrong keys can lead to unpredictable results. Don't try to do this if you're not sure of what you're doing...]

Better late then never...

... for my Windows Live Writer post... I just love this tool! A bunch of helpful add-ins are already popping up (here, here, here), and if you want to make your own - here's how.

Also, I'm writing this on Vista July CTP, which also is a major improvement compared to Beta 2. No more (wireless) network problems (at least in my case), VS2005 and SQL2005 install without problems (although suggesting applying SQL2005 SP2...). IIS is also back (with IIS6 compatibility)... However, the NX7010/Radeon 9200 issue remains..

The address of this blog has also changed, RSS subscriptions should remain the same (thanks to FeedBurner) and is now running on Community Server 2.1. The upgrade process, like always, wasn't going as expected... My online CS database is probably very messed up by now...

And here's where I live [testing Windows Live Map :)]...



[Update: apparently, WLMap coordinates get screwed up somewhere in the process, since it put my location about 50km west of actual location I entered...]

Community Server 2.1 Released!

Download the latest version from the official site. Right on time - for a long an rainy weekend...

Some features that I was eagerly waiting for: Better SPAM protection, Tags, Content Mirroring and Medium Trust.

Also, a new WLM build [8.0.0812.00] is available...

Windows Live QnA

Microsoft recently launched a new Live service called Windows Live QnA (Beta), where you can ask all kinds of questions, answer the questions to which you think you know the answer, and also vote for the best answer, given by others.

So if you have a deep or silly question no one around you knows the answer to, head over to Windows Live QnA and ask away...

And if you need an invite to get there... post a comment here.

Rome, revisited

This year, the occasion was Madonna's concert, yesterday, 6.8.2006, Olympic Stadium, Rome, Italy, which concluded this summer's concert season. Not just a concert, but a two hour mega-show, with Madonna performing her latest, as well as classic hits, such as Like a Virgin and La Isla Bonita. Well worth seeing... Include a few days spent in Rome, and you get a perfect package...

Summer concert season continues...

... with the second in a row - Robbie Williams, 22.7.2006, Milano, Italy. I'll remember this one by the incredible heat (40°C) and the wild crowd. Exciting performance, opening with the Close Encounters theme, lasted for almost two hours, including the introduction of a new song - Rudebox.

Anyway... just a few days more of vacation left, and then... on to handling all of the interesting stuff/news/happenings that keeep on piling around...