none
Appearance of Windows Forms in Windows 7

    Question

  • I moved directly from XP to Windows 7 recently. I am happy with the Windows 7 Aero Theme apart from in my C# and VB Windows Forms applications. I find it difficult to see which combo box has the focus in the Windows 7 theme. In either Windows XP or Windows Classic, the box turned blue when it had the focus.

    I know I could change the forms' appearance programmatically or through the designer,  but I have a lot of applications and don't want to change each one (and even less individual forms).

    Can I set Visual Studio so all applications get built with the appearance I want (preferably the Windows XP style)?
    Thursday, December 10, 2009 8:34 AM

Answers

  • You can derive the custom combobox from the standard and change the appearance there. Then rename all links to the standard combo in your projects to that custom. Visual Studio doesn`t control the controls appearance.



    Best regards.

    Flexible Treeview - the most flexible treeview-listview-grid hybrid control for .NET!
    • Marked as answer by FryingSaucer Monday, December 14, 2009 8:49 AM
    Thursday, December 10, 2009 9:34 AM
  • Hi FryingSaucer,

    We can create a custom ComboBox. When the ComboBox got focus, we change its BackColor to yellow; when it lost focus, we change its BackColor back to whilte. We can follow the same way to create other custom controls, such as TextBox. This is a code snippet:
        public class MyComboBox : ComboBox
        {
            protected override void OnGotFocus(EventArgs e)
            {
                base.OnGotFocus(e);
                //ComboBox got focus, change back color to yellow.
                this.BackColor = Color.Yellow;
            }
    
            protected override void OnLostFocus(EventArgs e)
            {
                //ComboBox lost focus, change back color back to white.
                this.BackColor = Color.White;
                base.OnLostFocus(e);
            }
        }
    Let me know if this does not help.
    Aland Li
    Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
    • Marked as answer by FryingSaucer Monday, December 14, 2009 8:48 AM
    Monday, December 14, 2009 8:41 AM

All replies

  • You can derive the custom combobox from the standard and change the appearance there. Then rename all links to the standard combo in your projects to that custom. Visual Studio doesn`t control the controls appearance.



    Best regards.

    Flexible Treeview - the most flexible treeview-listview-grid hybrid control for .NET!
    • Marked as answer by FryingSaucer Monday, December 14, 2009 8:49 AM
    Thursday, December 10, 2009 9:34 AM
  • Thanks.

    I've not been able to find where/how to change a custom combo to do this. In XP when the combo got the focus, the drop down box turned blue. In Windows 7 you just get a dotted line around the box which is hard to see. Any idea what I should change so the combo drop down box turns blue when it gets the focus?
    Thursday, December 10, 2009 10:17 PM
  • Hi FryingSaucer,

    We can create a custom ComboBox. When the ComboBox got focus, we change its BackColor to yellow; when it lost focus, we change its BackColor back to whilte. We can follow the same way to create other custom controls, such as TextBox. This is a code snippet:
        public class MyComboBox : ComboBox
        {
            protected override void OnGotFocus(EventArgs e)
            {
                base.OnGotFocus(e);
                //ComboBox got focus, change back color to yellow.
                this.BackColor = Color.Yellow;
            }
    
            protected override void OnLostFocus(EventArgs e)
            {
                //ComboBox lost focus, change back color back to white.
                this.BackColor = Color.White;
                base.OnLostFocus(e);
            }
        }
    Let me know if this does not help.
    Aland Li
    Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
    • Marked as answer by FryingSaucer Monday, December 14, 2009 8:48 AM
    Monday, December 14, 2009 8:41 AM
  • Thanks to both of you for your answers, though I was hoping there was some way to do this without having to change each project. Changing  the personalization from Windows Aero theme to Windows Classic does what I want, without any change being needed to the Visual Studio projects. So  the Windows forms behaviour is changed by the theme. I hoped there might be some way to change the behaviour of all Windows forms without having to either change the theme for everything, or change each individual project.
    Monday, December 14, 2009 5:52 PM