RSS订阅 | 匿名投稿
您的位置:网站首页 > 图像 > 正文

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

作者:admin 来源: 日期:2018/1/12 22:32:18 人气: 标签: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;

读完这篇文章后,您心情如何?
0
0
0
0
0
0
0
0
本文网址:
下一篇:没有资料