首页  编辑  

改造RichEdit控件支持2.0

Tags: /超级猛料/VCL/Memo&Edit&Richedit/RichEdit、RxRichEdit/   Date Created:

unit pbRichEdit20;

interface

uses

 SysUtils, Classes, Controls, StdCtrls, ComCtrls;

type

 TPBRichEdit20 = class(TRichEdit)

 protected

   Procedure CreateParams( Var params: TCreateParams ); override;

 end;

procedure Register;

implementation

uses windows, richedit;

procedure Register;

begin

 RegisterComponents('PBGoodies', [TPBRichEdit20]);

end;

{ TPBRichEdit20 }

Var

 FRichEditModule: THandle;

procedure TPBRichEdit20.CreateParams(var params: TCreateParams);

const

 RichEditModuleName = 'RICHED20.DLL';

begin

 if FRichEditModule = 0 then

 begin

   FRichEditModule := LoadLibrary(RichEditModuleName);

   if FRichEditModule <= HINSTANCE_ERROR then FRichEditModule := 0;

 end;

 inherited CreateParams(Params);

 CreateSubClass(Params, RICHEDIT_CLASS);

 params.WindowClass.style := params.WindowClass.style and not (CS_HREDRAW or CS_VREDRAW);

end;

initialization

finalization

 if FRichEditModule <> 0 then FreeLibrary(FRichEditModule);

end.