-1
양식을 통해 클릭 연결 해제 여기에서 검색 한 코드를 사용하여 : VB.net Click through form, 마침내 "클릭 연결"이 작동하지만 클릭 연결을 해제하는 방법이 여전히 혼란 스럽습니다.VB.NET
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, 0, 255 * PercentVisible, &H2)
Me.BackColor = Color.Red
Me.TopMost = True
End Sub
<DllImport("user32.dll", EntryPoint:="GetWindowLong")> Public Shared Function GetWindowLong(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As Integer
End Function
<DllImport("user32.dll", EntryPoint:="SetWindowLong")> Public Shared Function SetWindowLong(ByVal hWnd As IntPtr, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
End Function
<DllImport("user32.dll", EntryPoint:="SetLayeredWindowAttributes")> 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
내가 안 함이이 코드 내에서 아마 알고,하지만 난 그것을 작동되지 수, 도움의 종류는 크게 감사합니다 :
Public Sub BlaButton_click (blah blah) handles bla bla
SetWindowLong(Me.Handle, -20, InitialStyle Or &H80000 Or &H20)
SetLayeredWindowAttributes(Me.Handle, 0, 255 * PercentVisible, &H2)
End Sub
일반적으로 마법 번호에 Const 선언문을 사용하는 것이 현명합니다. 그렇게 실수로 -16을 사용하지 않았고 InitialStyle 만 사용하여 스타일을 재설정 한 것으로 보았을 것입니다. –