User32SetLayeredWindowAttributes(IntPtr, UInt32, Int32, LayeredWindowAttributesFlags) Method
Sets the opacity and transparency color key of a layered window.
Namespace: DevCase.Win32.NativeMethodsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("User32.dll", SetLastError = true)]
public static bool SetLayeredWindowAttributes(
IntPtr hWnd,
uint crKey,
int bAlpha,
LayeredWindowAttributesFlags flags
)
<DllImportAttribute("User32.dll", SetLastError := true>]
Public Shared Function SetLayeredWindowAttributes (
hWnd As IntPtr,
crKey As UInteger,
bAlpha As Integer,
flags As LayeredWindowAttributesFlags
) As Boolean
Dim hWnd As IntPtr
Dim crKey As UInteger
Dim bAlpha As Integer
Dim flags As LayeredWindowAttributesFlags
Dim returnValue As Boolean
returnValue = User32.SetLayeredWindowAttributes(hWnd,
crKey, bAlpha, flags)
public:
[DllImportAttribute(L"User32.dll", SetLastError = true)]
static bool SetLayeredWindowAttributes(
IntPtr hWnd,
unsigned int crKey,
int bAlpha,
LayeredWindowAttributesFlags flags
)
[<DllImportAttribute("User32.dll", SetLastError = true)>]
static member SetLayeredWindowAttributes :
hWnd : IntPtr *
crKey : uint32 *
bAlpha : int *
flags : LayeredWindowAttributesFlags -> bool
No code example is currently available or this language may not be supported.
- hWnd IntPtr
-
A handle to the layered window.
A layered window is created by specifying Layered
when creating the window with the CreateWindowEx function
or by setting Layered via SetWindowLongPtr(IntPtr, WindowLongValues, IntPtr) function.
after the window has been created.
- crKey UInt32
-
A COLORREF structure that specifies the transparency color key to be used
when composing the layered window.
All pixels painted by the window in this color will be transparent.
To generate a COLORREF, use the RGB macro.
- bAlpha Int32
-
Alpha value used to describe the opacity of the layered window.
When bAlpha is 0, the window is completely transparent.
When bAlpha is 255, the window is opaque.
- flags LayeredWindowAttributesFlags
-
An action to be taken.
Boolean
If the function succeeds, the return value is
.
If the function fails, the return value
.
To get extended error information, call
GetLastWin32Error.