BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TImageList::Draw changes TCanvas properties

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics)
View previous topic :: View next topic  
Author Message
Tomasz Piasecki
Guest





PostPosted: Wed Oct 08, 2003 6:45 pm    Post subject: TImageList::Draw changes TCanvas properties Reply with quote



Hi,

I have a problem with TImageList. Drawing image from image list on PaintBox
canvas using Draw method with Enabled=false, such as:

MyImageList->Draw(MyPaintBox->Canvas, xpos, ypos, imageindex, false);

causes chage to canvas state. For example text painted by TextOut on this
canvas after that has different background or is inverted. To make things
worse, even setting again Canvas->Pen->Color, Canvas->Brush->Color,
Canvas->TextMode, Canvas->CopyMode doesn't help much.

There's no problem with drawing enabled images from TImageList.

Any ideas?

TP.

Back to top
Damon Chandler (TeamB)
Guest





PostPosted: Sun Oct 12, 2003 2:26 am    Post subject: Re: TImageList::Draw changes TCanvas properties Reply with quote



Tomasz,
Quote:
MyImageList->Draw(MyPaintBox->Canvas, xpos, ypos, imageindex, false);
causes chage to canvas state. [snip]

You're right. Unfortunately, the TImageList::Draw() method [specifically,
the virtual TCustomImageList::DoDraw() method] does change various
state-properties of the Canvas without restoring them. Try wrapping the
call to Draw() with the SaveDC() and RestoreDC() GDI functions...

HDC const hDC = PaintBox1->Canvas->Handle;
SaveDC(hDC);
ImageList1->Draw(PaintBox1->Canvas, 0, 0, 0, false);
RestoreDC(hDC, -1);

HTH,
Damon (TeamB)

Back to top
Tomasz Piasecki
Guest





PostPosted: Sun Oct 12, 2003 10:30 am    Post subject: Re: TImageList::Draw changes TCanvas properties Reply with quote



Damon Chandler (TeamB) wrote:
Quote:
You're right. Unfortunately, the TImageList::Draw() method [specifically,
the virtual TCustomImageList::DoDraw() method] does change various
state-properties of the Canvas without restoring them. Try wrapping the
call to Draw() with the SaveDC() and RestoreDC() GDI functions...
Thanks, this workaround works fine.


TP.


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Graphics) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.