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
 How to color the whole line with OnGetTextEx

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
swestner Posted - Dec 03 2015 : 03:01:44
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

1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Dec 03 2015 : 19:26:24
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