public SetColorKey ( Color clrLow, Color clrHigh ) : void | ||
clrLow | Color | |
clrHigh | Color | |
return | void |
ImageAttributes imageAttributes = new ImageAttributes(); Color transparentColor = Color.FromArgb(255, 0, 255, 255); // Set transparent color imageAttributes.SetColorKey(transparentColor, transparentColor); // Now any pixel with the RGB values of (0, 255, 255) will be replaced with transparencyIn this example, we create a new ImageAttributes object and set the transparent color to be the color with RGB values of (0, 255, 255). Then, we pass this color value to the SetColorKey method along with itself. This sets up the color key value and replaces any pixel with those RGB values with transparency. Package Library: This method is part of the System.Drawing.Imaging namespace in the System.Drawing assembly, which is part of the .NET Framework.