Form - Stile Form!!!! (1)




Option Explicit
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 Const GWL_EXSTYLE = (-20)
Private 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 Const SWP_FRAMECHANGED = &H20
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOZORDER = &H4
Private Const SWP_NOSIZE = &H1
Const WS_EX_DLGMODALFRAME = &H1
Const WS_EX_NOPARENTNOTIFY = &H4
Const WS_EX_TOPMOST = &H8
Const WS_EX_ACCEPTFILES = &H10
Const WS_EX_TRANSPARENT = &H20
' #if(WINVER >= 0x0400)

Const WS_EX_MDICHILD = &H40
Const WS_EX_TOOLWINDOW = &H80
Const WS_EX_WINDOWEDGE = &H100
Const WS_EX_CLIENTEDGE = &H200
Const WS_EX_CONTEXTHELP = &H400
Const WS_EX_RIGHT = &H1000
Const WS_EX_LEFT = &H0
Const WS_EX_RTLREADING = &H2000
Const WS_EX_LTRREADING = &H0
Const WS_EX_LEFTSCROLLBAR = &H4000
Const WS_EX_RIGHTSCROLLBAR = &H0
Const WS_EX_CONTROLPARENT = &H10000
Const WS_EX_STATICEDGE = &H20000
Const WS_EX_APPWINDOW = &H40000
Const WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE + WS_EX_CLIENTEDGE
Const WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE + WS_EX_TOOLWINDOW + WS_EX_TOPMOST
Private StyleName() As String
Private StyleValue() As Long
Private NumStyles As Long
Private Sub AddStyle(ByVal style_name As String, ByVal style_value As Long)
NumStyles = NumStyles + 1
ReDim Preserve StyleName(1 To NumStyles)
ReDim Preserve StyleValue(1 To NumStyles)
StyleName(NumStyles) = style_name
StyleValue(NumStyles) = style_value
Load Check1(NumStyles)
Check1(NumStyles).Top = Check1(NumStyles - 1).Top + Check1(NumStyles - 1).Height + 30
Check1(NumStyles).Caption = style_name
Check1(NumStyles).Visible = True
If LCase$(style_name) = "ws_ex_transparent" Or _
LCase$(style_name) = "ws_ex_toolwindow" Or _
LCase$(style_name) = "ws_ex_clientedge" Or _
LCase$(style_name) = "ws_ex_staticedge" _
Then
Check1(NumStyles).ForeColor = vbRed
End If
End Sub

Private Sub Check1_Click(Index As Integer)
Dim new_style As Long
Dim i As Integer
For i = 1 To NumStyles
If Check1(i).Value = vbChecked Then _
new_style = new_style Or StyleValue(i)
Next i
SetWindowLong hwnd, GWL_EXSTYLE, new_style
SetWindowPos hwnd, 0, 0, 0, 0, 0, _
SWP_FRAMECHANGED Or SWP_NOMOVE Or _
SWP_NOZORDER Or SWP_NOSIZE
Refresh
End Sub

Private Sub Form_Load()
AddStyle "WS_EX_DLGMODALFRAME", WS_EX_DLGMODALFRAME
AddStyle "WS_EX_NOPARENTNOTIFY ", WS_EX_NOPARENTNOTIFY
AddStyle "WS_EX_TOPMOST", WS_EX_TOPMOST
AddStyle "WS_EX_ACCEPTFILES", WS_EX_ACCEPTFILES
AddStyle "WS_EX_TRANSPARENT", WS_EX_TRANSPARENT
AddStyle "WS_EX_MDICHILD", WS_EX_MDICHILD
AddStyle "WS_EX_TOOLWINDOW", WS_EX_TOOLWINDOW
AddStyle "WS_EX_WINDOWEDGE", WS_EX_WINDOWEDGE
AddStyle "WS_EX_CLIENTEDGE", WS_EX_CLIENTEDGE
AddStyle "WS_EX_CONTEXTHELP", WS_EX_CONTEXTHELP
AddStyle "WS_EX_RIGHT", WS_EX_RIGHT
AddStyle "WS_EX_LEFT", WS_EX_LEFT
AddStyle "WS_EX_RTLREADING", WS_EX_RTLREADING
AddStyle "WS_EX_LTRREADING", WS_EX_LTRREADING
AddStyle "WS_EX_LEFTSCROLLBAR", WS_EX_LEFTSCROLLBAR
AddStyle "WS_EX_RIGHTSCROLLBAR", WS_EX_RIGHTSCROLLBAR
AddStyle "WS_EX_CONTROLPARENT", WS_EX_CONTROLPARENT
AddStyle "WS_EX_STATICEDGE", WS_EX_STATICEDGE
AddStyle "WS_EX_APPWINDOW", WS_EX_APPWINDOW
AddStyle "WS_EX_OVERLAPPEDWINDOW", WS_EX_OVERLAPPEDWINDOW
AddStyle "WS_EX_PALETTEWINDOW", WS_EX_PALETTEWINDOW
Height = Check1(NumStyles).Top + _
Check1(NumStyles).Height + 170 + _
Height - ScaleHeight
End Sub











( formstileform1.html )- by Paolo Puglisi - Modifica del 17/12/2023