如何在vb.net应用程序中更改标题栏的颜色 [英] How to change the color of the title bar in a vb.net application

查看:204
本文介绍了如何在vb.net应用程序中更改标题栏的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我创建了一个VB.net项目,该项目在win7中看起来很棒,但在winXP中却很糟糕,我的要求是更改应用程序标题栏的颜色-我知道它取决于您选择的Windows主题,我仍然在寻找一个选项.我是.net的新手,请帮助

Hi,
I have created a VB.net project which looks great in win7 but its awful in winXP, my requirement is to change the color of the title bar of the application- i know that it depend on the Windows theme you select, still i m looking for an option. I m new to .net , please help

推荐答案

以下是一些代码:


Here is some code:


Option Explicit
Private Const COLOR_ACTIVECAPTION = 2
Private Declare Function GetSysColor Lib _
  "user32" (ByVal nIndex As Long) As Long
Private Declare Function SetSysColors Lib "user32" _
  (ByVal nChanges As Long, lpSysColor As Long, _
   lpColorValues As Long) As Long









Public Function GetTitleBarColor() As Long
    GetTitleBarColor = GetSysColor(COLOR_ACTIVECAPTION)
End Function
Public Function ChangeTitleBarColor(NewColor As Long) As Boolean
    Dim lRet As Long
    lRet = SetSysColors(1, COLOR_ACTIVECAPTION, NewColor)
    ChangeTitleBarColor = lRet > 0
End Function



希望对您有帮助



Hope that helps


这篇关于如何在vb.net应用程序中更改标题栏的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆