delphi之截取整个窗体图片


本文整理自网络,侵删。

 

很简单的代码,:-D

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');{temp目录必须事先存在那里才行。}
bit.Free;
end;

end.

相关阅读 >>

Delphi获取星期几

Delphi 立即停止timer

Delphi用代码实现注册ocx和dll

Delphi xe5实现通过tmemorystream将一个unicodestring写入到一个unicode文本文件

Delphi 锁定系统解锁系统

Delphi 从 exe 或 dll 中获取图标的函数

Delphi-改进获取文件md5 hash方法

Delphi中简单的调用单元unit实例

Delphi 软件welcome窗口代码

Delphi 用拼音首字符检索汉字的源代码

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



打赏

取消

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

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

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

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

评论

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

    正在狠努力加载,请稍候...