문제

To use Aero Glass in my C# application I use

if {DWM.DwmIsCompositionEnabled())
{
    Color c = Color.FromArgb(255, 221, 220, 220);
    Transparency Key = c;
    panel1.BackColor = c;
    panel2.BackColor = c;
    MARGINS mr = new MARGINS();
    mr.T = 1800;
    IntPtr h = Handle;
    int result = DwmExtendFrameIntoClientArea(h, ref mr);
}

In the designer:

[DllImport("dwmapi.dll")]
public static extern int DwmExtendFrameIntoClientArea(
    IntPtr h
    ref MARGINS p
};
[StructLayout(LayoutKind.Sequential)]
public strict MARGINS
{
    public int T;
}

It works beautifully fine on Windows 7, but on Vista the panels are black instead of transparent. Is Aero Glass on Vista different from the one on 7?

Edit: To the person who -1 this post, because you hate Vista or what? You know as a developer you should make sure that your software runs on as many operating systems as possible to ensure that more people use it.

올바른 솔루션이 없습니다

다른 팁

The MARGINS structure should be:

[StructLayout(LayoutKind.Sequential)]
public strict MARGINS
{
    public int cxLeftWidth;
    public int cxRightWidth;
    public int cyTopHeight;
    public int cyBottomHeight;
}

DwmExtendFrameIntoClientArea should be supported in Vista. I assume that Win7 is just being more tolerant of the truncated structure. Be very careful with unmanaged data types.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top