Export (0) Print
Expand All

ImageAttributes.SetBrushRemapTable Method

Sets the color-remap table for the brush category.

Namespace: System.Drawing.Imaging
Assembly: System.Drawing (in system.drawing.dll)

public void SetBrushRemapTable (
	ColorMap[] map
)
public void SetBrushRemapTable (
	ColorMap[] map
)
public function SetBrushRemapTable (
	map : ColorMap[]
)
Not applicable.

Parameters

map

An array of ColorMap objects.

Return Value

This method does not return a value.

A color-remap table is an array of ColorMap structures. Each ColorMap structure has two Color objects: one that specifies an old color and one that specifies a corresponding new color. During rendering, any color that matches one of the old colors in the remap table is changed to the corresponding new color.

Calling the SetBrushRemapTable method has the same effect as passing Brush to the SetRemapTable method. The specified remap table applies to items in metafiles that are filled with a brush.

This method is intended to be used only with metafiles.

The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. The code performs the following actions:

  1. Creates a single-element ColorMap array that holds red as the old color and green as the new color.

  2. Passes this array to a newly created ImageAttributes object.

public void SetBrushRemapTableExample(PaintEventArgs e)
{
             
    // Create a color map.
    ColorMap[] myColorMap = new ColorMap[1];
    myColorMap[0] = new ColorMap();
    myColorMap[0].OldColor = Color.Red;
    myColorMap[0].NewColor = Color.Green;
             
    // Create an ImageAttributes object, passing it to the myColorMap
             
    // array.
    ImageAttributes imageAttr = new ImageAttributes();
    imageAttr.SetBrushRemapTable(myColorMap);
}

public void SetBrushRemapTableExample(PaintEventArgs e)
{
    // Create a color map.
    ColorMap myColorMap[] = new ColorMap[1];

    myColorMap.set_Item(0, new ColorMap());
    myColorMap[0].set_OldColor(Color.get_Red());
    myColorMap[0].set_NewColor(Color.get_Green());

    // Create an ImageAttributes object, passing it to the myColorMap
    // array.
    ImageAttributes imageAttr = new ImageAttributes();

    imageAttr.SetBrushRemapTable(myColorMap);
} //SetBrushRemapTableExample

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft