ImageAttributes.SetBrushRemapTable 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
SetBrushRemapTable(ColorMap[]) |
设置画笔类别的颜色重新映射表。 |
SetBrushRemapTable(ReadOnlySpan<ColorMap>) | |
SetBrushRemapTable(ReadOnlySpan<ValueTuple<Color,Color>>) |
SetBrushRemapTable(ColorMap[])
- Source:
- ImageAttributes.cs
- Source:
- ImageAttributes.cs
- Source:
- ImageAttributes.cs
- Source:
- ImageAttributes.cs
- Source:
- ImageAttributes.cs
设置画笔类别的颜色重新映射表。
public:
void SetBrushRemapTable(cli::array <System::Drawing::Imaging::ColorMap ^> ^ map);
public:
void SetBrushRemapTable(... cli::array <System::Drawing::Imaging::ColorMap ^> ^ map);
public void SetBrushRemapTable (System.Drawing.Imaging.ColorMap[] map);
public void SetBrushRemapTable (params System.Drawing.Imaging.ColorMap[] map);
member this.SetBrushRemapTable : System.Drawing.Imaging.ColorMap[] -> unit
Public Sub SetBrushRemapTable (map As ColorMap())
Public Sub SetBrushRemapTable (ParamArray map As ColorMap())
参数
示例
下面的代码示例设计用于 Windows 窗体,它需要 PaintEventArgse
,这是 Paint 事件处理程序的参数。 该代码执行以下操作:
创建一个单元素 ColorMap 数组,该数组将红色保留为旧颜色,绿色作为新颜色。
将此数组传递给新创建的 ImageAttributes 对象。
void SetBrushRemapTableExample( PaintEventArgs^ /*e*/ )
{
// Create a color map.
array<ColorMap^>^myColorMap = gcnew array<ColorMap^>(1);
myColorMap[ 0 ] = gcnew ColorMap;
myColorMap[ 0 ]->OldColor = Color::Red;
myColorMap[ 0 ]->NewColor = Color::Green;
// Create an ImageAttributes object, passing it to the myColorMap
// array.
ImageAttributes^ imageAttr = gcnew ImageAttributes;
imageAttr->SetBrushRemapTable( myColorMap );
}
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 Sub SetBrushRemapTableExample(ByVal e As PaintEventArgs)
' Create a color map.
Dim myColorMap(0) As ColorMap
myColorMap(0) = New ColorMap
myColorMap(0).OldColor = Color.Red
myColorMap(0).NewColor = Color.Green
' Create an ImageAttributes object, passing it to the myColorMap
' array.
Dim imageAttr As New System.Drawing.Imaging.ImageAttributes
imageAttr.SetBrushRemapTable(myColorMap)
End Sub
注解
颜色重新映射表是 ColorMap 结构的数组。 每个 ColorMap 结构都有两个 Color 对象:一个指定旧颜色,一个指定相应的新颜色。 在呈现期间,与重新映射表中一种旧颜色匹配的任何颜色都更改为相应的新颜色。
调用 SetBrushRemapTable 方法的效果与将 Brush 传递给 SetRemapTable 方法的效果相同。 指定的重新映射表适用于用画笔填充的图元文件中的项。
此方法仅用于图元文件。
适用于
SetBrushRemapTable(ReadOnlySpan<ColorMap>)
- Source:
- ImageAttributes.cs
- Source:
- ImageAttributes.cs
public:
void SetBrushRemapTable(ReadOnlySpan<System::Drawing::Imaging::ColorMap ^> map);
public void SetBrushRemapTable (scoped ReadOnlySpan<System.Drawing.Imaging.ColorMap> map);
member this.SetBrushRemapTable : ReadOnlySpan<System.Drawing.Imaging.ColorMap> -> unit
Public Sub SetBrushRemapTable (map As ReadOnlySpan(Of ColorMap))
参数
- map
- ReadOnlySpan<ColorMap>
适用于
SetBrushRemapTable(ReadOnlySpan<ValueTuple<Color,Color>>)
- Source:
- ImageAttributes.cs
- Source:
- ImageAttributes.cs
public:
void SetBrushRemapTable(ReadOnlySpan<ValueTuple<System::Drawing::Color, System::Drawing::Color>> map);
public void SetBrushRemapTable (scoped ReadOnlySpan<(System.Drawing.Color OldColor, System.Drawing.Color NewColor)> map);
member this.SetBrushRemapTable : ReadOnlySpan<ValueTuple<System.Drawing.Color, System.Drawing.Color>> -> unit
Public Sub SetBrushRemapTable (map As ReadOnlySpan(Of ValueTuple(Of Color, Color)))
参数
- map
- ReadOnlySpan<ValueTuple<Color,Color>>