⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 re2bmpf.~pas

📁 很多 delphi 精彩小例子。供大家参考。
💻 ~PAS
字号:
unit RE2BMPF;
interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls, ComCtrls;

type
  TForm1 = class(TForm)
    RichEdit1: TRichEdit;
    Image1: TImage;
    SaveDialog1: TSaveDialog;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var newBitmap: TBitmap;
    ScreenDC: HDC;
    REOrg: TPoint;
begin
newBitmap:=TBitmap.Create;
try
    Image1.Picture.Graphic:=newBitmap;
    Image1.Picture.Graphic.Width:=RichEdit1.ClientWidth;
    Image1.Picture.Graphic.Height:=RichEdit1.ClientHeight;
    REOrg:=RichEdit1.ClientToScreen(Point(0,0));
    ScreenDC:=GetDC(0);
    try
        BitBlt(Image1.Picture.Bitmap.Canvas.Handle,0,0,RichEdit1.ClientWidth,RichEdit1.ClientHeight,ScreenDC,REOrg.X, REOrg.Y, SRCCOPY);
    finally
        ReleaseDC(0, ScreenDC);
    end;
finally
    newBitmap.Free;
end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
if SaveDialog1.Execute then
    Image1.Picture.SaveToFile(SaveDialog1.FileName);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -