vb.net html里的表格,VB.net点击表格

我从这个代码项目帖子中删除了代码:

http://www.codeproject.com/Articles/12877/Transparent-Click-Through-Forms

这是一个复杂的版本,包含所有评论 – 优点:

Imports System.Runtime.InteropServices

Public Class Form1

Private InitialStyle As Integer

Dim PercentVisible As Decimal

Private Sub Form_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles MyBase.Load

' Grab the Extended Style information

' for this window and store it.

InitialStyle = GetWindowLong(Me.Handle,GWL.ExStyle)

PercentVisible = 0.8

' Set this window to Transparent

' (to the mouse that is!)

' This creates a new Extended Style

' for our window,which takes effect

' immediately upon being set,that

' combines the initial style of our window

' (saved in Form.Load) and adds the ability

' to be Transparent to the mouse.

' Both Layered and Transparent must be

' turned on for this to work AND have

' the window render properly!

SetWindowLong(Me.Handle,GWL.ExStyle,InitialStyle Or WS_EX.Layered Or WS_EX.Transparent)

' Don't forget to set the Alpha

' for the window or else you won't be able

' to see the window! Possible values

' are 0 (visibly transparent)

' to 255 (visibly opaque). I'll set

' it to 70% visible here for show.

' The second parameter is 0,because

' we're not using a ColorKey!

SetLayeredWindowAttributes(Me.Handle,255 * PercentVisible,LWA.Alpha)

' Just for giggles,set this window

' to stay on top of all others so we

' can see what's happening.

Me.TopMost = True

Me.BackColor = Color.Red

End Sub

Public Enum GWL As Integer

ExStyle = -20

End Enum

Public Enum WS_EX As Integer

Transparent = &H20

Layered = &H80000

End Enum

Public Enum LWA As Integer

ColorKey = &H1

Alpha = &H2

End Enum

_

Public Shared Function GetWindowLong( _

ByVal hWnd As IntPtr,_

ByVal nIndex As GWL _

) As Integer

End Function

_

Public Shared Function SetWindowLong( _

ByVal hWnd As IntPtr,_

ByVal nIndex As GWL,_

ByVal dwNewLong As WS_EX _

) As Integer

End Function

EntryPoint:="SetLayeredWindowAttributes")> _

Public Shared Function SetLayeredWindowAttributes( _

ByVal hWnd As IntPtr,_

ByVal crKey As Integer,_

ByVal alpha As Byte,_

ByVal dwFlags As LWA _

) As Boolean

End Function

End Class

这是我正在使用的简化版本对我来说更有意义:

Imports System.Runtime.InteropServices

Public Class Form1

Private InitialStyle As Integer

Dim PercentVisible As Decimal

Private Sub Form_Load(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles MyBase.Load

InitialStyle = GetWindowLong(Me.Handle,-20)

PercentVisible = 0.8

SetWindowLong(Me.Handle,-20,InitialStyle Or &H80000 Or &H20)

SetLayeredWindowAttributes(Me.Handle,&H2)

Me.BackColor = Color.Red

Me.TopMost = True

End Sub

Public Shared Function GetWindowLong(ByVal hWnd As IntPtr,ByVal nIndex As Integer) As Integer

End Function

Public Shared Function SetWindowLong(ByVal hWnd As IntPtr,ByVal nIndex As Integer,ByVal dwNewLong As Integer) As Integer

End Function

Public Shared Function SetLayeredWindowAttributes(ByVal hWnd As IntPtr,ByVal crKey As Integer,ByVal alpha As Byte,ByVal dwFlags As Integer) As Boolean

End Function

End Class

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值