After the Vista system, Microsoft provided the Aero matte effect for the form program, such. C # is used as an example.
How can we achieve this matte effect?
Code:
System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms; System.Reflection; System.Runtime.InteropServices; WindowsFormsApplication1{ partial Form1 : Form { [StructLayout(LayoutKind.Sequential)] MARGINS { Left; Right; Top; Bottom; } [DllImport("", PreserveSig = )] DwmExtendFrameIntoClientArea(IntPtr hwnd, MARGINS margins); [DllImport("", PreserveSig = )] DwmIsCompositionEnabled(); OnLoad(EventArgs e) { (DwmIsCompositionEnabled()) { MARGINS margins = MARGINS(); margins.Right = margins.Left = margins.Top = margins.Bottom = .Width + .Height; DwmExtendFrameIntoClientArea(.Handle, margins); } .OnLoad(e); } OnPaintBackground(PaintEventArgs e) { .OnPaintBackground(e); (DwmIsCompositionEnabled()) { e.Graphics.Clear(Color.Black); } } Form1() { InitializeComponent(); } }}
In this example, the system's dwmapi. dll is called.
Dwmapi. dll is a dynamic link library of the Microsoft Desktop Window Manager API (the common interface of the Desktop Window Manager DWM). It is a normal file and is mainly used as an api for Desktop effect.
DWM is a new interface that provides DWM interfaces in all Windows Vista versions except Windows Vista Home Basic. Therefore, this effect can only be used in systems after Vista.