如何美化VB界面?高手进(不要皮肤控件)
网上看许多高手制作出来的vb透明窗体实在是牛,貌似都是用API实现的,但下载源代码又看不懂所以就想从头学起我想学学如何美化VB,注意,是不要控件的,图片我可以自己制作,问...
网上看许多高手制作出来的vb透明窗体实在是牛,貌似都是用API实现的,但下载源代码又看不懂 所以就想从头学起 我想学学如何美化VB,注意,是不要控件的,图片我可以自己制作,问题就是如何美化
展开
2013-10-27
展开全部
透明窗体并不难 就3个API GetWindowLong SetWindowLong SetLayeredWindowAttributes 可以在API查看器里找到原型 还有几个值 MSDN里或百度上都有关键是设一个透明色这个把红色设为透明(当然也可以换成别的色)如果你的其他控件中的背景颜色或字体颜色为红色 也会变成透明 所以做各种不规则的窗体就是填涂红色了 Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As LongConst WS_EX_LAYERED = &H80000
Const GWL_EXSTYLE = (-20)
Const LWA_COLORKEY = &H1 Private Sub Form_Load()
Me.BackColor = vbRed
Dim rtn As Long
rtn = GetWindowLong(hwnd, GWL_EXSTYLE) '先取窗体的扩展样式值
rtn = rtn Or WS_EX_LAYERED'把扩展的layered样式添加进去
SetWindowLong hwnd, GWL_EXSTYLE, rtn'设置窗体扩展样式值
SetLayeredWindowAttributes hwnd, vbRed, 0, LWA_COLORKEY'设置Layered属性 将vbred设为透明
End Sub
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As LongConst WS_EX_LAYERED = &H80000
Const GWL_EXSTYLE = (-20)
Const LWA_COLORKEY = &H1 Private Sub Form_Load()
Me.BackColor = vbRed
Dim rtn As Long
rtn = GetWindowLong(hwnd, GWL_EXSTYLE) '先取窗体的扩展样式值
rtn = rtn Or WS_EX_LAYERED'把扩展的layered样式添加进去
SetWindowLong hwnd, GWL_EXSTYLE, rtn'设置窗体扩展样式值
SetLayeredWindowAttributes hwnd, vbRed, 0, LWA_COLORKEY'设置Layered属性 将vbred设为透明
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-10-27
展开全部
activeskin4.3
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询