Windows Forms color variation between Windows 7 an

2019-09-22 09:08发布

I have a vb.net Windows Forms app using the 4.0 framework. When I run the application on an XP machine, the color of my controls all match what the are set to in my IDE, which is also an XP machine.

When I run this application on a Windows 7 machine, the colors are all changed.

Any ideas why this is and how I can make Windows 7 match my Development machine?

David

3条回答
欢心
2楼-- · 2019-09-22 09:17

I found this too. My VB6 project was fine in Windows XP. I just moved to Windows 7 and copied the project folder to this machine. My splashscreen backcolour was supposed to be white but it was black now. The backcolour had been set to &H80000009& which was white in winXP but in Windows 7 it gives black. So I changed backcolour to &H80000005& and it is now white again.

查看更多
▲ chillily
3楼-- · 2019-09-22 09:20

Windows forms are going to take on whatever "theme" the machine they are running on has enabled - which is by design. Honestly, it wouldn't make sense for a windows form running on Windows 7 to look like an XP windows form. Could you give some sort of context for why you want your windows form to look like it's always running on XP?

查看更多
Explosion°爆炸
4楼-- · 2019-09-22 09:40

You can use the BackColor property of the button to change the background color. The ForeColor property will change the text color.

Edit: added the below after playing around some.

Try ensuring the "UseVisualStyleBackColor" property on your button is set to False. Playing around I noticed that when this is true, the system ignores my background color selection and uses the machine default. When False, my background color was used.

查看更多
登录 后发表回答