Delphi 7 + GDIPlus 简单实现双缓冲绘制移动图形


本文整理自网络,侵删。

 
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Gdiplus,
  GdipTypes,
  StdCtrls,
  Dialogs, ExtCtrls, jpeg;

type
  TForm1 = class(TForm)
    btn1: TButton;
    btn2: TButton;
    procedure FormCreate(Sender: TObject);
    procedure btn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    GGraphic: TGpGraphics; //保存图形
    FBitMapBuff: TImage; //缓冲区
    FlyBitmap,radarbitmap:TGpImage;
  end;
var
  Form1:TForm1;
  y:Integer;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  DoubleBuffered := True;
  FBitMapBuff:=TImage.Create(nil);
end;

procedure TForm1.btn1Click(Sender: TObject);
begin
   FBitMapBuff.Height:=650;
   FBitMapBuff.Width:=650;
   GGraphic:=TGpGraphics.Create(FBitMapBuff.Canvas.Handle);
   radarbitmap:=TGpImage.Create('noname.jpg');
   FlyBitmap:=TGpImage.Create('fly16.png');
   GGraphic.DrawImage(radarbitmap,0,0,650,650);
   GGraphic.DrawImage(FlyBitmap,y*10,y*10,16,16);
   Canvas.Draw(0,0,FBitMapBuff.Picture.Bitmap);
   inc(y);
end;

相关阅读 >>

Delphi 如何在webservice中获取客户端的ip地址

Delphi parent属性的另类用法

Delphi 中让嵌入窗体的 webbrowser 控件无边框

Delphi 过滤字符串首位特殊符号

Delphi 获取随机字符串的方法 thash.getrandomstring

如何为Delphi程序添加事件和事件处理器

Delphi6-xe5 中的md5实现方法

Delphi 在windows平台下实现进程隐藏

Delphi 中英文字符怎么按固定长度截断

Delphi 过滤字符串特殊符号的函数

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



打赏

取消

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

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

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

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

评论

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