多谢。
其实这个问题也很简单,大把的Delphi源码可以用(C++ Builder可以直接编译大多数Object Pascal源程序):
看看这个有没有启发:
procedure ImageListDrawDisabled(Images: TImageList;
Canvas: TCanvas;
X, Y, Index: Integer;
HighlightColor, GrayColor: TColor;
DrawHighlight: Boolean);
var
Bmp: TBitmap;
SaveColor: TColor;
begin
SaveColor := Canvas.Brush.Color;
Bmp := TBitmap.Create;
try
Bmp.Width := Images.Width;
Bmp.Height := Images.Height;
with Bmp.Canvasdo
begin
Brush.Color := clWhite;
FillRect(Rect(0, 0, Images.Width, Images.Height));
ImageList_Draw(Images.Handle, Index, Handle, 0, 0, ILD_MASK);
end;
Bmp.Monochrome := True;
if DrawHighlight then
begin
Canvas.Brush.Color := HighlightColor;
SetTextColor(Canvas.Handle, clWhite);
SetBkColor(Canvas.Handle, clBlack);
BitBlt(Canvas.Handle, X + 1, Y + 1, Images.Width,
Images.Height, Bmp.Canvas.Handle, 0, 0, ROP_DSPDxax);
end;
Canvas.Brush.Color := GrayColor;
SetTextColor(Canvas.Handle, clWhite);
SetBkColor(Canvas.Handle, clBlack);
BitBlt(Canvas.Handle, X, Y, Images.Width,
Images.Height, Bmp.Canvas.Handle, 0, 0, ROP_DSPDxax);
finally
Bmp.Free;
Canvas.Brush.Color := SaveColor;
end;
end;