昨日のエントリ:どうすれば良いのだろうか??の続きです。
どうにも我慢できず、中博俊さんから教えてもらった、えムナウさんのVista API を用いたコード( C# ) を試してみました。
とはいえ、このままでは面白くないので、一応、Visual Basic 2008 ( Orcas Beta 2 )?に変換しました。
Visual Basic 2008 Code
Imports System.Runtime.InteropServices
Imports System.Windows.Interop
Class HelloWorld
Private Structure MARGINS
Public Sub New(ByVal t As Thickness)
Left = CInt(t.Left)
Right = CInt(t.Right)
Top = CInt(t.Top)
Bottom = CInt(t.Bottom)
End Sub
Public Left As Integer
Public Right As Integer
Public Top As Integer
Public Bottom As Integer
End Structure
<DLLIMPORT("DWMAPI.DLL", PreserveSig:="False)"> _
Private Shared Sub DwmExtendFrameIntoClientArea(ByVal hwnd As IntPtr, ByRef margins As MARGINS)
End Sub
<DLLIMPORT("DWMAPI.DLL", PreserveSig:="False)"> _
Private Shared Function DwmIsCompositionEnabled() As Boolean
End Function
Protected Overrides Sub OnSourceInitialized(ByVal e As EventArgs)
MyBase.OnSourceInitialized(e)
If Not DwmIsCompositionEnabled() Then
Return
End If
Dim hwnd As IntPtr = New WindowInteropHelper(Me).Handle
If hwnd = IntPtr.Zero Then
Return
End If
Me.Background = Brushes.Transparent
HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent
Dim margins As New MARGINS(New Thickness(-1))
DwmExtendFrameIntoClientArea(hwnd, margins)
End Sub
エ~… ほぼ何にもいじってないのと一緒です。^^;
で、これを使って、作成したのが↓の画像です。
えムナウさん、中さん、お二方のおかげで直ぐに実現することができました。本当にありがとうございます。
[ 7/30 15:30 えムナウさんのコメントを受けて若干の修正 ]
[7/30 21:50 さらに修正:危うい情報流して申し訳ないッス!]