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
 Example code for ImageDraw2 not labelling each image.
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

bmesser

United Kingdom
250 Posts

Posted - Nov 06 2025 :  04:42:27  Show Profile  Reply
Hi Nigel

I just copied this code from the help into one of my apps to label each thumbnail.

It only appears to work the once, putting just a single label at the bottom-right, and not labelling each thumbnail as I would like.

Am I missing something?

Bruce.

// Output the image size in the bottom left of the thumbnail (with a semi transparent background)
procedure TMainForm.ImageEnMView1ImageDraw2(Sender: TObject; idx, Left, Top: Integer; ImageRect: TRect; Canvas: TCanvas);
const
  Right_Margin  = 8;
  Bottom_Margin = 8;
  Text_Margin   = 2;
var
  x1, y1, x2, y2: integer;
  iec: TIECanvas;
  ss: string;
  sz: TSize;
begin
  ss := format( '%d x %d', [ ImageEnMView1.ImageWidth[idx],  ImageEnMView1.ImageHeight[idx] ]);

  // Create our TIECanvas from the regular TCanvas
  iec := TIECanvas.Create( Canvas );
  try
    iec.Font.Size  := 8;
    iec.Font.Color := clWhite;
    iec.Font.Style := [fsBold];

    sz := iec.TextExtent( ss );

    x1 := Left + ImageEnMView1.ThumbWidth - sz.cx - Right_Margin;
    y1 := Top + ImageEnMView1.ThumbHeight - sz.cy - Bottom_Margin;
    x2 := Left + ImageEnMView1.ThumbWidth - Right_Margin;
    y2 := Top + ImageEnMView1.ThumbHeight - Bottom_Margin;

    iec.Brush.Color := clBlack;
    iec.Brush.Style := bsSolid;
    iec.Brush.Transparency := 196;
    iec.Pen.Style := psClear;
    iec.Rectangle( x1 - Text_Margin, y1, x2 + Text_Margin, y2 );
    iec.TextOut( x1, y1, ss );
  finally
    iec.Free();
  end;
end;

bmesser

United Kingdom
250 Posts

Posted - Nov 06 2025 :  04:46:19  Show Profile  Reply
Please ignore!

It works fine, it's just my eyes and this new 4k monitor!
Go to Top of Page

xequte

39275 Posts

Posted - Nov 08 2025 :  03:28:46  Show Profile  Reply


Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: