<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Verdana; font-size: 12pt; color: #000000'>I Howard,<br><br>>
Difficult to be sure based on an uncompilable code snippet. Presumably
TImgList is a TImage (not a TImageList)?<br>
>
But you carefully create a bitmap and draw it on the component's
canvas, and then draw over it again with a call to inherited Paint.<br>
<br>ImgList is a TImageList.<br><br>In my application I first load images in TImageList and after, with an 'index', I want to display an image from this list. <br>The class I use is inherited from a TCustomControl.<br><br>This is not for me easy for me to works with graphics. So this code is inspired from examples founded over the net.<br>I probably not used the best way to this job.<br><br>If you have an example that do this, send it to me. <br><br>Thanks in advance.<br><br>--<br>Pierre Delore<br><br>http://datalinkwristapps.free.fr<br>http://dpsite.free.fr<br><br>----- "Howard Page-Clark" <hdpc@talktalk.net> a écrit :
<br>>
<title></title>
On 21/2/10 6:57, Pierre Delore wrote:
<blockquote cite="mid:1216601162.2059581266778646429.JavaMail.root@spooler8-g27.priv.proxad.net">
<style>p { margin: 0; }</style>
<div style="font-family: Verdana; font-size: 12pt; color: rgb(0, 0, 0);">> Hi,<br>>
<br>>
I have a transparency problem when I try to display a bitmap stored in
a TImagList. <br>>
The bitmap I want to display is a green arrow with a white background.
I want to display it without transparency. <br>>
With the code below the bitmap is displayed but the background is not
white (it's a copy of a part of the screen). If I uncomment the 2 lines
with the fillrect, the background is set to green. <br>>
<br>>
Any ideas?<br>>
<br>>
>--------------------------------------------------------------------------------------------------------<br>>
procedure TImgList.Paint;<br>>
var<br>>
Bitmap: TBitmap;<br>>
begin<br>>
Bitmap := TBitmap.Create;<br>>
try<br>>
Bitmap.Height := pHeight;<br>>
Bitmap.Width := pWidth;<br>>
<br>>
TImgListItem(ListImg.Items[index]).ImgList.GetBitmap(tagv,Bitmap);
//the image is a green arrow with a white background<br>>
<br>>
Bitmap.Transparent:=False;<br>>
//Canvas.Brush.Color := clGreen; If I uncomment this part
the background is set to green<br>>
//Canvas.FillRect(0,0,pwidth,pheight);<br>>
Canvas.Draw(0, 0, Bitmap);<br>>
finally<br>>
Bitmap.Free;<br>>
end;<br>>
<br>>
inherited Paint;<br>>
end; <br>>
</div>
</blockquote>
<br>>
Difficult to be sure based on an uncompilable code snippet. Presumably
TImgList is a TImage (not a TImageList)?<br>>
But you carefully create a bitmap and draw it on the component's
canvas, and then draw over it again with a call to inherited Paint.<br>>
<br>>
HTH<br>>
<br>>
Howard<br>>
<br>> --
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
</div></body></html>