ImageEn, unit iemview

TIEGetTextExEvent


Declaration

type TIEGetTextExEvent = procedure(Sender: TObject; Index: integer; Position : TIEMTextPos; var Text: WideString;
                                   Font : TFont; var BackgroundStyle: TBrushStyle; var BackgroundColor: TColor;
                                   var TruncSide: TIEMTruncSide) of object;


Description

Occurs before text is output when drawing a thumbnail allowing you to insert or modify the displayed text or change its formatting.

Position Description
iemtpTop Overrides the text specified for ImageTopText
iemtpInfo Overrides the text specified for ImageInfoText
iemtpBottom Overrides the text specified for ImageBottomText

Note:
Ensure that you have set UpperGap/BottomGap to allow space for the text
Setting Text only modifies the text that is displayed, not the value in ImageTopText/ImageInfoText/ImageBottomText
Font.Color cannot be overriden for selected or disabled frames


Example

// Display the file as bold if it is JPEG
procedure TForm1.IEFolderMViewGetTextEx(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
    exit;
  sFileExt := ExtractFileExt( Text );
  if IEExtToFileFormat( sFileExt ) = ioJPEG then
    Font.Style := [fsBold]
  else
    Font.Style := [];
end;

// Give text on every thumb a random background color
procedure TForm1.IEFolderMViewGetTextEx(Sender: TObject; Index: Integer; Position: TIEMTextPos; var Text: WideString;
                                        Font : TFont; var BackgroundStyle: TBrushStyle; var BackgroundColor: TColor;
                                        var TruncSide: TIEMTruncSide);
begin
  BackgroundColor := RGB(Random(255), Random(255), Random(255));
  BackgroundStyle := bsSolid;
end;