ウインドウ全体を半透明にする(Vista以降)
WPFアプリケーションを新規作成し、MainWindowクラスを以下のように書き換えます。
public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); this.Loaded += delegate { IntPtr hWnd = new System.Windows.Interop.WindowInteropHelper(this).Handle; this.Background = Brushes.Transparent; System.Windows.Interop.HwndSource.FromHwnd(hWnd).CompositionTarget.BackgroundColor = Colors.Transparent; DwmExtendFrameIntoClientArea(hWnd, new MARGINS()); }; } [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)] public class MARGINS { public int cxLeftWidth = -1; public int cxRightWidth; public int cyTopHeight; public int cyBottomHeight; }; [System.Runtime.InteropServices.DllImport("DwmApi")] public static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, MARGINS pMarInset); }