Archive for February, 2009|Monthly archive page

Text in Windows 7

In OS on 21 February, 2009 at 7:00 am

WPF has been providing a feature that people wanted for a very long time.  Have you ever wonder why a screen with a very high resolution will give you application and text that are too small to use and read properly.  If you take a look at printed material, no matter how big the medium is or how high the dpi used for printing, a 10 point text will always appear as a 10 point text, the higher dpi will just make it appear so much smoother and nicer.  WPF set out to mimic that, thus a WPF application will always appear the same size no matter where you view it.  This is achieved by making the graphic display truly device independent.  A 10cm line will appear as a 10cm line no matter how big the screen or how high the resolution.

Windows 7 will finally bring this feature to the masses, you don’t need to run a WPF application to get this benefit for text.  And I hope that this will also be true for other elements in the Windows.  If this is true, that Vaio P will definitely be good to ship in Windows 7, since the current one under Vista shows text that are way too small to read properly (cause Sony choose to put a high resolution screen on a 8.9” screen).


Vista is fast on HP Mini

In Electronic, OS on 20 February, 2009 at 7:00 am

I’ve always been wondering why netbook can’t run Vista properly.  Somehow a lot of review have put it that if a netbook is using Vista it will take a performance hit.  A modern processor at 1.6Ghz and 1GB of RAM can’t run a modern Vista OS?  I know that Vista is resource hungry but I don’t think it is that resource hungry.  After some thoughts, I felt that the reason might be due to the slow hard disk that most netbook are using, since Vista is always doing file indexing on the fly and will thus cause a performance dip if the hard disk is slow.

After trying out Sony Vaio P at the Sony shop, it is confirmed that Vista felt sluggish on the Vaio P which is using a 1.3Ghz Atom but with 2GB of RAM.  But I still have my doubts. Then when I get my hand on a HP Mini 1000 (1012TU), I’ve decided to install a dual boot Vista on top of the XP to try out the theory.  I was thinking that if it is slow then I’ll just turn off the file indexing and see whether the speed will become decent.  However, after successfully getting Vista installed, I feel that it is fast, as fast as the XP that was originally installed and I did not do any tweaking and this is even with Aero turn on!  This confirm the theory that with 1GB of RAM Vista should be as fast as XP.

So why is it that people are saying that netbook can’t take Vista?  I feel that this is because the manufacturer want to sell the netbook cheap, the first netbook came installed with Linux but Linux is not something that people are comfortable to use (not all people, at least) and soon people are asking for a Window version.  But if HP, Dell, Lenovo and what not put Vista on their netbook, the cost will be much higher than those netbook that comes with Linux.  Thus Windows XP came into the scene.  Being cheaper than Vista, manufacturer can thus keep the price range of netbook.  To justify the choice, they make use of the negative image of Vista, since netbook comes with cheap setup, it can’t run Vista.  And it seems like they are successful in this marketing gimmick.

Reluctance of Microsoft to make it simple

In OS on 11 February, 2009 at 7:00 am

The latest information out for Windows 7 is that there are basically 3 editions for consumers to purchase, Windows 7 Home Premium, Windows 7 Professional and Windows 7 Ultimate.  However, the other editions are still available, Windows 7 Starter and Windows 7 Home Basic are available for OEM builder and Windows 7 Enterprise is for those Enterprise customer who wants volume licensing.  Although off the shelf consumer will only get to see 3 edition of Windows 7, when buying or using computer system, be it desktop or laptop or netbook, personal or belonging to the company, there are still 5 edition that user will see.  Thus this is definitely still confusing to the average Joe.

I would think that Microsoft should ditch all other editions and stay with only 3, Home, Professional and Ultimate.  Windows 7 Home is for home users and it will include special license that will limit some of the features, for example, Windows 7 Home found on netbook will not have Aero and some other features that are not available under the previous Home Basic.  Users who want these features can purchase a full Home license from Microsoft and these features will then unlock (as what Windows 7 upgrade will currently do).  Windows 7 Ultimate is also the edition for the Enterprise customers.  In this case there are really just 3 editions of Windows 7 and it serve the purpose of the previous 6.

Windows 7, Vista on steroid

In OS on 6 February, 2009 at 7:00 am

After using Windows 7 for a few weeks, the one thing that keep surprising me is that it is so much faster.  The start up is faster, the shut down is faster, opening of application is also much faster.  This is even when compared to Windows XP.  I can say that it is as fast if not faster than the Mac OS X in terms of start up and shut down of course.

The new taskbar is also much easier to use, as it is no longer cramp up by all those windows titles.  Only application icon is left on the taskbar.  The mixture of pin up application and already launched application also make the taskbar simpler and more efficient.  No longer does the launch bar needs to fight for spaces with the active taskbar.  Further you can move all this icons around on the taskbar to suit your personal taste even when the application has been launched.

All features of the Windows has also been made much more accessible.  For example you can now change the resolution of the display by simply right clicking on the desktop.

But speed will still be the one reason why I will switch to Windows 7 as soon as it is launched.  It is really like using a Vista that is on steroid.

Maximizing a borderless/no-caption window

In Programming on 5 February, 2009 at 7:00 am

When you choose to have a WPF application without border or caption, you need to provide your own maximize button and your own code to maximize the window.  Normally you can just do:

    this.WindowState = WindowState.Maximized;

and the window will be maximized.  But this call will cause the window to cover up the taskbar.  Thus we will need to set the maximum height and width of the window to a size where the window will not cover the taskbar before you call the above stage change.

    MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight;
    MaxWidth = SystemParameters.MaximizedPrimaryScreenWidth;

This will work at first glance until you test the application on a system with an extended secondary display that has a higher resolution than your primary display.  When you drag your application to the secondary display and maximize it, the height and width will be limited to the primary display’s height and width.  Thus you will see a blank area not cover by your application while it is maximized.  Another thing will happen is that if you try to expand your application while it is on the secondary display, the height and width will also be limited by that of the primary display.

To solve this I’ve immediately thought of finding a way to get the height and width of the secondary display and also to detect whether the application is on a secondary display.  This is all quite complicated.  Then something hit me, this problem only occur on an extended secondary display and on this kind of display there isn’t any taskbar, thus a much easier way is to detect whether the current display is a primary display and then set or reset the MaxHeight and MaxWidth accordingly.  Thus I implement 2 methods RestoreWindow() and MaximizeWindow().

    private void RestoreWindow()
        // reset the max width and height so that you can expand
        // the window properly while on a secondary window
        MaxHeight = double.PositiveInfinity;
        MaxWidth = double.PositiveInfinity;
        // set the window back to normal state
        this.WindowState = WindowState.Normal;
    private void MaximizeWindow()
        // Get the current display, whether it is on primary or 
        // secondary
        System.Drawing.Point pt = 
        System.Windows.Forms.Screen currentScreen;
        currentScreen = 
        // test whether the screen is a primary display
        if (currentScreen.Primary) 
            // if it is a primary display, set the max width and
            // height so that the maximize window will not cover 
            // the taskbar
            MaxHeight = 
            MaxWidth = 
            // if it is not a primary display, reset the max 
            // width and height
            MaxHeight = double.PositiveInfinity;
            MaxWidth = double.PositiveInfinity;
        // set window to become maximized
        this.WindowState = WindowState.Maximized;