1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
| Imports System.Runtime.InteropServices
Public Class Form1
'DPD-APP (r) 2012
Public Shared Function IsAeroGlassStyleSupported() As Boolean
Dim isDWMEnable As Boolean = False
Try
' Check that the glass is enabled by using the DwmIsCompositionEnabled.
' It is supported in version 6.0 or above of the operating system.
If Environment.OSVersion.Version.Major >= 6 Then
' Make sure the Glass is enabled by the user.
DwmIsCompositionEnabled(isDWMEnable)
End If
Catch
End Try
Return isDWMEnable
End Function
'igiguide.blogspot.it
<StructLayout(LayoutKind.Sequential)> _
Public Structure MARGINS
Public Destra As Integer
Public Sinistra As Integer
Public Su As Integer
Public Giu As Integer
End Structure
Declare Auto Function DwmIsCompositionEnabled Lib "dwmapi.dll" Alias "DwmIsCompositionEnabled" (ByRef pfEnabled As Boolean) As Integer
Declare Auto Function DwmExtendFrameIntoClientArea Lib "dwmapi.dll" Alias "DwmExtendFrameIntoClientArea" (ByVal hWnd As IntPtr, ByRef pMargin As Margins) As Integer
Dim pMargins As New MARGINS With {.Su = -1, .Sinistra = -1, .Destra = -1, .Giu = -1}
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Form1.IsAeroGlassStyleSupported() Then
Dim en As Boolean = False
DwmIsCompositionEnabled(en)
If en Then
DwmExtendFrameIntoClientArea(Me.Handle, pMargins)
End If
Me.TransparencyKey = Color.FromKnownColor(KnownColor.ActiveCaption)
Me.BackColor = Me.TransparencyKey
Me.BackgroundImage = Nothing
' ELSE facoltativo: aggiungi qui le azioni da fare
'se il computer non ha attivo l' aero
End If
' DPD- 2013
End Sub
End Class
|
Nessun commento:
Posta un commento
Si prega di non commentare in modo volgare e/o offensivo.