ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 About OnImageDraw
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

lago

40 Posts

Posted - Mar 15 2016 :  21:42:38  Show Profile  Reply
Hello all, see if someone can help me:
In a TImageFolderMView I want to show a different background color for each thumbnail depending on a condition that I pick up a query to a BDD.

1: OnImageDraw:
Trying I see this event is called several times and consultation BDD is repeated unnecessarily. Any idea to make this more optimized?

2nd: Strange problem when I try to set the background color thumbnail:


// Example:
onImageDraw(Sender: TObject; idx: Integer; Left, Top: Integer; Canvas: TCanvas)
{
  if (idx == 1)
  {
     Canvas->Rectangle(x,x,x,x);
     ImageenView->ThumbnailsBackground = clRed;
  }
}





At first, Canvas draw well a rectangle line when idx = 1, but ThumbnailsBackground set a background for the next thumbnail.
When idx = 1, ThumbnailBackground affect the idx+1, its extrange.

I just want to establish a different background color for thumbnails looking for that color in a database. I'm on the right track? Any suggestions?

Thanks alot.

Jorge.

xequte

38686 Posts

Posted - Mar 16 2016 :  03:28:29  Show Profile  Reply
Hi

1. After you have retrieved the value store it with the thumbnail, using one the custom properties such as ImageTag or ImageUserPointer:

http://www.imageen.com/help/TImageEnMView.ImageTag.html


2. It is risky to change the value of a property such as ThumbnailsBackground midway through a draw procedure (as it has not been designed for that).

Rather, you should use one of the Before Draw events to draw the canvas yourself:

http://www.imageen.com/help/TImageEnMView.OnBeforeImageDrawEx.html
http://www.imageen.com/help/TImageEnMView.OnBeforeImageDraw.html


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

lago

40 Posts

Posted - Mar 16 2016 :  09:58:55  Show Profile  Reply
Thanks alot Nigel, nice tips, i will try.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: