DirectX SDK

DirectDrawSurface7.SetColorKey

The DirectDrawSurface7.SetColorKey method sets the color key value for the DirectDrawSurface object if the hardware supports color keys on a per-surface basis.

object.SetColorKey( _ 
    flags As CONST_DDCKEYFLAGS, _ 
    val As DDCOLORKEY)

Parameters

object
Object expression that resolves to a DirectDrawSurface7 object.
flags
One of the constants of the CONST_DDCKEYFLAGS enumeration specifying the type of color key requested.
val
DDCOLORKEY type that contains the new color key values for the DirectDrawSurface object. This value can be Nothing to remove a previously set color key.

Error Codes

If the method fails, it raises an error, and Err.Number can be set to one of the following values:

DDERR_GENERIC
DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS
DDERR_INVALIDSURFACETYPE
DDERR_NOOVERLAYHW
DDERR_NOTAOVERLAYSURFACE
DDERR_SURFACELOST
DDERR_UNSUPPORTED
DDERR_WASSTILLDRAWING

Remarks

For transparent blits and overlays, set destination color on the destination surface and source color on the source surface.

See Also

DirectDrawSurface7.GetColorKey