ImageAttributes.SetColorKey Method( Color, Color, ColorAdjustType )
Sets the Color key ( transparency range ) for a specified category.
Namespace: System.Drawing.Imageing
Assembly: System.Drawing ( in System.Drawing.dll )
Syntax:
Public:
void SetColorKey(
Color colorLow,
Color colorHigh,
ColorAdjustType type
)
示例代码:
CString str;
str.Format(_T("%s"), moveinfo->picfilepath );
Image image( str );
ImageAttributes imAtt;
imAtt.SetColorKey(
Color( 0, 0, 0),
Color( 0, 0, 0),
ColorAdjustTypeBitmap );
int iwidth,iheight;
iwidth = image.GetWidth();
iheight = image.GetHeight();
m_graphics.get()->DrawImage( &image, Rect(moveinfo->ptPosition.X - iwidth/2
, moveinfo->ptPosition.Y - iheight/2, iwidth, iheight), 0,0,iwidth,iheight,UnitPixel, &imAtt );