1.RichEdit无限撤消已经问了好久了还是没有人解答,今天厚脸皮再问一次网上看到的方法是再Form的Create中加入RichEdit.Perform(EM_SETUNDOLIMIT,100,0)设定100次撤消,然后用RichEdit.Perform(EM_UNDO,0,0)代替RichEdit.Undo经测试无效然后有看到说SendMessage(RichEdit.Handle,EM_SETUNDOLIMIT,100,0)的方法,经测试无效有有人说要先设定EM_SETTEXTMODE和TM_MULTILEVELUNDO,两个设定后还是没有用~~~~~~我确信我用的就是RichEdit2,因为打开Lib文件夹下的RichEdit.pas文件,从开头部分看到了RichEdit2字样.请高手解决一下(不用三方控件)2.RichEdit关键字高亮3.RichEdit复制和粘贴问题只有复制和粘贴事件,怎样控制只复制文本(不复制格式)或复制文本和格式全部呢.(比如Dreamweaver中的"复制"和"复制文本"这样)4.整行高亮5.放图片就是怎么在RichEdit中放图片,我试了很久都不行.
麻烦各位了,分不够我可以再加,很急啊!(以上全是Delphi7)
麻烦各位了,分不够我可以再加,很急啊!(以上全是Delphi7)
解决方案 »
- xe2界面支持unicode吗
- 在ehlib的DBGridEh输入数据时,如何控制一定要先输入某栏位,才能输入另外一个栏位??
- 急,以下代码是delphi访问access有什么错,系统报insert into 语句语法错误
- 没您不行!谁有让StringGrid可以有合并相邻列的源码或办法及免费控件?急!
- 从DLL调用一个窗体时,在Windows的任务栏会多出一个任务,请问如何解决??
- 如何在主线程中等待其它所有线程都执行完成了再继续往下执行
- StringGrid控件,如何按CTRL键行多选(不连续的行),将其设成选中状态
- 如何写代码才能实现这样的功能?
- Delphi6与Delphi5的区别。。。。。。。。。。。。。。。。。。。
- 为什么image在代码里用image.picture.loadfromfile(*.jpg),说不支持jpg,只能用bmp,而在object inspector里却可以load *.jpg?
- delphi database 和 消息问题(50分)
- ListView 删除列的问题
你只要再看仔细些就会发现了。
你所说的那些,都是正确的,只不过是因为delphi中使用的是RICHEDIT 1.0的版本,所以都无效罢了。
使用rx的吧。都有了。不用再自己开发。
但是,我还是非常想知道不用三方控件实现的方法!!!(因为我以前看到过这样一个程序,但是无源码……………………)
例程如下:设Form1上控件RxRichEdit1和Button1。InsertBitmapIntoRxRichEdit使用方法请见Button1Click方法。unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, RxRichEd;type
TForm1 = class(TForm)
Button1: TButton;
RxRichEdit1: TRxRichEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation
uses
JPEG;{$R *.dfm}function ConvertBitmapToRTF(const Bitmap: TBitmap): string;
var
bi, bb: string;
bis, bbs: Cardinal;
achar: string[2];
Buffer: string;
I: Integer;
type
PWord = ^Word;
begin
GetDIBSizes(Bitmap.Handle, bis, bbs);
SetLength(bi, bis);
SetLength(bb, bbs);
GetDIB(Bitmap.Handle, Bitmap.Palette, PChar(bi)^, PChar(bb)^);
SetLength(Buffer, (Length(bb) + Length(bi)) * 2);
i := 1;
for bis := 1 to Length(bi) do
begin
achar := IntToHex(Integer(bi[bis]), 2);
PWord(@Buffer[i])^ := PWord(@achar[1])^;
inc(i, 2);
end;
for bbs := 1 to Length(bb) do
begin
achar := IntToHex(Integer(bb[bbs]), 2);
PWord(@Buffer[i])^ := PWord(@achar[1])^;
inc(i, 2);
end;
Result := '{\rtf1 {\pict\dibitmap ' + Buffer + ' }}';
end;procedure InsertBitmapIntoRxRichEdit(const Bitmap: TBitmap; const RxRichEdit:
TRxRichEdit); overload;
begin
RxRichEdit.SelText := ConvertBitmapToRTF(Bitmap);
RxRichEdit.SelLength := 0;
RxRichEdit.SelStart := RxRichEdit.SelStart + 1;
end;procedure InsertBitmapIntoRxRichEdit(const GraphicFileName: string; const
RxRichEdit: TRxRichEdit); overload;
var
Bitmap: TBitmap; Graphic: TPicture;
begin
Graphic := TPicture.Create;
try
Graphic.LoadFromFile(GraphicFileName); if Graphic.Graphic is TBitmap then
Bitmap := Graphic.Bitmap
else
begin
Bitmap := TBitmap.Create;
Bitmap.Assign(Graphic.Graphic);
end; InsertBitmapIntoRxRichEdit(Bitmap, RxRichEdit);
finally
if Bitmap <> Graphic.Bitmap then
FreeAndNil(Bitmap); FreeAndNil(Graphic);
end;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
//InsertBitmapIntoRxRichEdit('C:\Temp\Untitled.bmp', RxRichEdit1);
InsertBitmapIntoRxRichEdit('C:\Temp\Untitled-8.jpg', RxRichEdit1);
RxRichEdit1.SetFocus;
end;
end.