能用gdi+ 将一jpg或bmp图片显示成半透明吗?
rt
[解决办法]
http://msdn.microsoft.com/msdnmag/issues/05/12/catwork/default.aspx
[解决办法]
var G:TGPGraphics;
image:TGPImage;
imageArr:TGPImageAttributes;
const
ColorMatrix: TColorMatrix =
((1.0, 0.0, 0.0, 0.0, 0.0),
(0.0, 1.0, 0.0, 0.0, 0.0),
(0.0, 0.0, 1.0, 0.0, 0.0),
(0.0, 0.0, 0.0, 0.5, 0.0),
(0.0, 0.0, 0.0, 0.0, 1.0));
begin
G:=TGpGraphics.Create(Self.Canvas.Handle);
Image:=TGpimage.Create( 'c:\1.bmp ')
imageArr:=TGPImageAttributes.Create;
imageArr.SetColorMatrix(colorMatrix, ColorMatrixFlagsDefault,ColorAdjustTypeBitmap);
g.DrawImage(
image,
MakeRect(30, Height, Width, Height), // Destination rectangle
0, // Source rectangle X
0, // Source rectangle Y
Width, // Source rectangle width
Height, // Source rectangle height
UnitPixel,
imageArr
);
G.free ;
image.free ;
imageArr.free;
end;
[解决办法]
MakeRect(30, Height, Width, Height),//////MakeRect(0,0,Width,Height);