欢迎访问服务器技术网-www.fuwuqijishu.com

使form1的颜色设为透明的VB语言是什么?

程序设计 fuwuqijishu 2年前 (2022-10-01) 18次浏览 0个评论 扫描二维码

关于

他们说要这样:

要用API
先添加一个模块~~ 代码如下:
Public Declare Function SetLayeredWindowAttributes Lib “user32” (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Public Const WS_EX_LAYERED = &H80000
Public Const GWL_EXSTYLE = (-20)
Public Const LWA_ALPHA = &H2
Public Const LWA_COLORKEY = &H1
Public Declare Function GetWindowLong Lib “user32” Alias “GetWindowLongA” (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib “user32” Alias “SetWindowLongA” (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Private Sub Form_Load()
Dim sty As Long

sty = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
sty = sty Or WS_EX_LAYERED
SetWindowLong Me.hwnd, GWL_EXSTYLE, sty
SetLayeredWindowAttributes Me.hwnd, 0, 192, LWA_ALPHA
End Sub

我试过可不行啊!的问题

这是一段很好的代码,你可将SetLayeredWindowAttributes Me.hwnd, 0, 192, LWA_ALPHA 修改为:
SetLayeredWindowAttributes Me.hwnd, 0, 12, LWA_ALPHA
再观看其窗体加载的效果.

喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

Warning: error_log(/www/wwwroot/fuwiqijishu/wp-content/plugins/spider-analyser/#log/log-2411.txt): failed to open stream: No such file or directory in /www/wwwroot/fuwiqijishu/wp-content/plugins/spider-analyser/spider.class.php on line 2900