Delphi 7 TRichTextEdit框中的文本无法正确显示

编程入门 行业动态 更新时间:2024-10-28 08:22:27
本文介绍了Delphi 7 TRichTextEdit框中的文本无法正确显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

使用delphi 7 TRichEdit组件,正在通过复制和粘贴从msword文档中导入RTF数据,但是如果数据包含在框中,则无法正确显示,即

Using delphi 7 TRichEdit component, RTF data is being imported from a msword document through copy and paste, but if data is contained in a box, it is not displaying correctly i.e.

请协助

推荐答案

尝试使用以下内容,它应该将 TRichEdit 类到版本4.1。但是我不知道Delphi 7是否支持插入的类,因此只需尝试粘贴以下代码并尝试构建项目。如果它可以编译,则可以放置 TRichEdit 组件并运行项目,您应该获得RichEdit 4.1。 / p>

Try to use the following, it should subclass the TRichEdit class to version 4.1. However I don't know if Delphi 7 supports interposed classes, so just try to paste the following code and try to build the project.If it compiles then if you put a TRichEdit component and run the project you should get 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.

更多推荐

Delphi 7 TRichTextEdit框中的文本无法正确显示

本文发布于:2023-07-26 18:18:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1217741.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:框中   文本   正确   Delphi   TRichTextEdit

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!