delphi 把整个窗体保存为图片的方法


本文整理自网络,侵删。

 unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
bit: TBitmap;
begin
bit := TBitmap.Create;
bit.Width := Width;
bit.Height := Height;
BitBlt(bit.Canvas.Handle, 0, 0, Width, Height, GetWindowDC(Handle), 0, 0, SRCCOPY);
bit.SaveToFile('c:\temp\Form1.bmp');
bit.Free;
end;

end.

相关阅读 >>

Delphi杀进程的两种方式

Delphi 实现软件版验证码

Delphi controlcount和componentcount的区别

Delphi 使用tarray.sort对数组排序

Delphi dcc64.exe Delphi64位命令行编译器揭秘

Delphi 最简单的判断数字函数

Delphi xe 10.2.1 fmx平台 在图片上写字方法

Delphi 禁止改变窗口大小和移动窗口

Delphi从memo去重数据

Delphi xe filesizebyname 要引用哪些文件

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...