本文整理自网络,侵删。
Image设为足够大,即可得到RichEdit中的所有内容,然后再
Image1.Picture.SaveToFile输出到一个BMP文件即可:
uses RichEdit;
procedure TForm1.Button1Click(Sender: TObject);
var
Range: TFormatRange;
LastChar, MaxLen, LogX, LogY: Integer;
begin
FillChar(Range, SizeOf(TFormatRange), 0);
with Image1, Range do
begin
LogX := GetDeviceCaps(Canvas.Handle, LOGPIXELSX);
LogY := GetDeviceCaps(Canvas.Handle, LOGPIXELSY);
hdc := Canvas.Handle;
hdcTarget := hdc;
rc.right := Image1.ClientWidth * 1440 div LogX;
rc.bottom := Image1.ClientHeight * 1440 div LogY;
rcPage := rc;
LastChar := 0;
MaxLen := GetTextLen;
chrg.cpMax := -1;
repeat
chrg.cpMin := LastChar;
LastChar := SendMessage(RichEdit1.Handle, EM_FORMATRANGE, 1,
Longint(@Range));
until (LastChar >= MaxLen) or (LastChar = -1);
end;
SendMessage(RichEdit1.Handle, EM_FORMATRANGE, 0, 0);
Image1.Refresh;
end;
相关阅读 >>
Delphi firedac 下的 sqlite [12] - 备忘录
Delphi 从indy9升级到indy10时idtcpserver的变化
android实例-拍摄和分享照片、分享文本(xe8+小米2)
Delphi sysutils.lastdelimiter - 判断一个字符串在另一个字符串中最后出现的位置
Delphi mediaplayer android 下播放 mp4 的问题
更多相关阅读请进入《Delphi》频道 >>