AdvancedLauncher.Tools.Interop.WindowBase.SetLayeredWindowAttributes C# (CSharp) Method

SetLayeredWindowAttributes() public method

public SetLayeredWindowAttributes ( byte alpha, Color colorKey = null ) : void
alpha byte
colorKey Color
return void
        public void SetLayeredWindowAttributes(byte? alpha, Color? colorKey = null)
        {
            LWA flags = 0;
            byte bAlpha = 0;
            uint crKey = 0;

            if (alpha != null) {
                bAlpha = alpha.Value;
                flags |= LWA.ALPHA;
            }

            if (colorKey != null) {
                uint r = (uint)colorKey.Value.R;
                uint g = (uint)colorKey.Value.G;
                uint b = (uint)colorKey.Value.B;

                crKey = r + (g << 8) + (b << 16);
                flags |= LWA.COLORKEY;
            }

            NativeMethods.SetLayeredWindowAttributes(_hwnd, crKey, bAlpha, flags);
        }