Exemplo n.º 1
0
        private static void SetWindowEffect(IntPtr window, AccentPolicy accent)
        {
            var accentStructSize = Marshal.SizeOf(accent);
            var accentPtr        = Marshal.AllocHGlobal(accentStructSize);

            Marshal.StructureToPtr(accent, accentPtr, false);
            var data = new WindowCompositionAttributeData
            {
                Attribute  = WindowCompositionAttribute.WCA_ACCENT_POLICY,
                SizeOfData = accentStructSize,
                Data       = accentPtr
            };

            PInvoke.SetWindowCompositionAttribute(window, ref data);
            Marshal.FreeHGlobal(accentPtr);
        }