用Delphi 7 TRichEdit部件,RTF数据正在从通过复制和粘贴一个文件MSWORD进口,但是,如果数据包含在一个盒子里,它未正确显示即
请协助
用Delphi 7 TRichEdit部件,RTF数据正在从通过复制和粘贴一个文件MSWORD进口,但是,如果数据包含在一个盒子里,它未正确显示即
请协助
尝试使用以下,就应该继承的TRichEdit
级到4.1版本。 但是我不知道是否德尔福7支持插入的班,所以只是尝试粘贴下面的代码,并尝试建立该项目。
如果它编译,然后如果你把一个TRichEdit
组件并运行你应该得到的RichEdit 4.1的项目。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, RichEdit;
type
TRichEdit = class(ComCtrls.TRichEdit)
protected
procedure CreateParams(var Params: TCreateParams); override;
end;
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
FRichEditModule: THandle;
implementation
{$R *.dfm}
{ TRichEdit }
procedure TRichEdit.CreateParams(var Params: TCreateParams);
const
RichEditClassName = 'RICHEDIT50A';
RichEditModuleName = 'MSFTEDIT.DLL';
HideScrollBarsStyle: array[Boolean] of DWORD = (ES_DISABLENOSCROLL, 0);
HideSelectionsStyle: array[Boolean] of DWORD = (ES_NOHIDESEL, 0);
begin
if FRichEditModule = 0 then
begin
FRichEditModule := LoadLibrary(RichEditModuleName);
if FRichEditModule <= HINSTANCE_ERROR then
FRichEditModule := 0;
end;
inherited CreateParams(Params);
CreateSubClass(Params, RichEditClassName);
Params.Style := Params.Style or HideScrollBarsStyle[HideScrollBars] or
HideSelectionsStyle[HideSelection];
Params.WindowClass.style := Params.WindowClass.style and
not (CS_HREDRAW or CS_VREDRAW);
end;
initialization
finalization
if FRichEditModule <> 0 then
FreeLibrary(FRichEditModule);
end.
最后得到它的工作,
这是因为添加的Riched20.dll(最新版本)的应用程序文件夹一样简单