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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 About OnImageDraw

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
lago Posted - Mar 15 2016 : 21:42:38
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.
2   L A T E S T    R E P L I E S    (Newest First)
lago Posted - Mar 16 2016 : 09:58:55
Thanks alot Nigel, nice tips, i will try.
xequte Posted - Mar 16 2016 : 03:28:29
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