Registriert seit: 1. Jan 2010
Ort: Leer
594 Beiträge
Delphi XE3 Professional
|
AW: TConversionFormat in neuen Delphi Versionen
28. Sep 2011, 20:52
Unter XE2 handelt das RichEdit dies selber.
Delphi-Quellcode:
class procedure TCustomRichEdit.RegisterConversionFormat(const AExtension: string;
AConversionClass: TConversionClass);
begin
AppendConversionFormat(AExtension, AConversionClass);
end;
procedure TRichEditStrings.LoadFromFile(const FileName: string; Encoding: TEncoding);
var
I: Integer;
Ext: string;
Convert, LConvert: TConversionFormat;
begin
Ext := WideLowerCase(ExtractFileExt(Filename));
{$IFDEF CLR}
Borland.Delphi.System.Delete(Ext, 1, 1);
{$ELSE}
System.Delete(Ext, 1, 1);
{$ENDIF}
Convert := TextConversionFormat;
for I := 0 to ConversionFormatList.Count - 1 do
begin
{$IFDEF CLR}
LConvert := TConversionFormat(ConversionFormatList[I]);
{$ELSE}
LConvert := PConversionFormat(ConversionFormatList[I])^;
{$ENDIF}
if LConvert.Extension = Ext then
begin
Convert := LConvert;
Break;
end;
end;
if FConverter = nil then
FConverter := Convert.ConversionClass.Create;
try
inherited LoadFromFile(FileName, Encoding);
except
FConverter.Free;
FConverter := nil;
raise;
end;
RichEdit.DoSetMaxLength($7FFFFFF0);
end;
Lars
|
|
Zitat
|