\'Hvordan en form gøres gennemsigtig \'1. Opret et modul og tilføj denne kode
Public Const GWL_EXSTYLE = (-20) Public Const WS_EX_TRANSPARENT = &H20& Public Const SWP_FRAMECHANGED = &H20 Public Const SWP_NOMOVE = &H2 Public Const SWP_NOSIZE = &H1 Public Const SWP_SHOWME = SWP_FRAMECHANGED Or _ SWP_NOMOVE Or SWP_NOSIZE Public Const HWND_NOTOPMOST = -2 Declare Function SetWindowLong Lib \"user32\" _ Alias \"SetWindowLongA\" _ (ByVal hwnd As Long, ByVal nIndex As Long, _ ByVal dwNewLong As Long) As Long Declare Function SetWindowPos Lib \"user32\" _ (ByVal hwnd As Long, ByVal hWndInsertAfter _ As Long, ByVal x As Long, ByVal y As Long, _ ByVal cx As Long, ByVal cy As Long, _ ByVal wFlags As Long) As Long
Private Sub Command1_Click() \'2. Tilføj en commandbutton med denne kode til form1 Form1.BorderStyle = 0 SetWindowLong Me.hwnd, GWL_EXSTYLE, _ WS_EX_TRANSPARENT SetWindowPos Me.hwnd, HWND_NOTOPMOST, _ 0&, 0&, 0&, 0&, SWP_SHOWME End Sub
Private Declare Function CreateRectRgn Lib \"gdi32\" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long Private Declare Function CombineRgn Lib \"gdi32\" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long Private Declare Function SetWindowRgn Lib \"user32\" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long
Public Sub TransparentForm(frm As Form) frm.ScaleMode = vbPixels Const RGN_DIFF = 4 Const RGN_OR = 2
Dim outer_rgn As Long Dim inner_rgn As Long Dim wid As Single Dim hgt As Single Dim border_width As Single Dim title_height As Single Dim ctl_left As Single Dim ctl_top As Single Dim ctl_right As Single Dim ctl_bottom As Single Dim control_rgn As Long Dim combined_rgn As Long Dim ctl As Control
Private Sub Form_Resize() TransparentForm Me End Sub \'------------------------------------------------ Form1 ------------------------------------------------
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.