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
 How to color the whole line with OnGetTextEx
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

swestner

17 Posts

Posted - Dec 03 2015 :  03:01:44  Show Profile  Reply
Hello,

I use OnGetTextEx in TImageENMView to paint the background of the bottom-text in red.

procedure TfamScanner.ImageViewGetTextEx(Sender: TObject; Index: integer; Position: TIEMTextPos;
var Text: WideString; Font: TFont; var BackgroundStyle: TBrushStyle; var BackgroundColor: TColor; var TruncSide: TIEMTruncSide);
begin
if Position = iemtpBottom then begin
if Text <> '' then begin
BackgroundColor := clRed;
BackgroundStyle := bsSolid;
end;
end;
end;

With previous versions of ImageEn the whole line under the image was painted red. With the actual version only the background of the text is painted red.

How could I paint the whole text-line under the image with background-red?

Please see the attached file. The red background of the text is painted but I want the area which is blue in red too.

Greetings

Stefan

xequte

39053 Posts

Posted - Dec 03 2015 :  19:26:24  Show Profile  Reply
Hi Stefan

You could custom draw the cell, but probably the easiest way is simply to pad the text to the width of the cell.

procedure TMainForm.ImageEnMView1GetTextEx(Sender: TObject; Index: Integer; Position: TIEMTextPos; var Text: WideString; Font: TFont; var
    BackgroundStyle: TBrushStyle; var BackgroundColor: TColor; var TruncSide: TIEMTruncSide);
var
  iTextWidth: Integer;
  aBMP: TBitmap;
begin
  BackgroundColor := clRed;
  BackgroundStyle := bsSolid;

  // Expand text to width of the thumbnail cell
  aBMP := TBitmap.create;
  aBMP.Canvas.Font.Assign( Font );
  iTextWidth := aBMP.Canvas.TextWidth( ' ' + Text + ' ' );
  while iTextWidth < ImageEnMView1.ThumbWidth - 2 * ImageEnMView1.TextMargin - 2 * ImageEnMView1.HorizBorder do
  begin
    Text := ' ' + Text + ' ';
    iTextWidth := aBMP.Canvas.TextWidth( ' ' + Text + ' ' );
  end;
  aBMP.Free;
end;


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