Gdi32DeleteObject(IntPtr) Method

Deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object.

After the object is deleted, the specified handle is no longer valid.

Do not delete a drawing object (pen or brush) while it is still selected into a DC.

When a pattern brush is deleted, the bitmap associated with the brush is not deleted. The bitmap must be deleted independently.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("GDI32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static bool DeleteObject(
	IntPtr hObject
)

Parameters

hObject  IntPtr
A handle to a logical pen, brush, font, bitmap, region, or palette.

Return Value

Boolean
If the function succeeds, the return value is .

If the specified handle is not valid or is currently selected into a DC, the return value is .

Remarks

See Also