如何在界面上移动图片?试了一下,感觉:
  1、程序控制TImage控件的话比较好操作,但是cpu占用率太多,达50%。看某些网页上的图片漂浮移动,基本不太占用cpu,不知道是怎么做的。所以我想delphi也应该可以;  但问题是怎么做?  2、用画的办法把图片重新绘制或者拷贝到显示区域,发现cpu就不是太占用了。
但是不太好控制,我想是我没用掌握这个方法。  望高手指教;关键是如何擦除原来绘制的图片内容,还原为背景;

解决方案 »

  1.   

    创建一个线程来控制的话可能不会那么占cpu
      

  2.   

    Visual Graph是一套强大的交互图形开发平台,她能非常方便地建造基于图形的界面、制作各种图形元件、实现图形管理、图形建模、制作监控系统、表单系统、绘图系统、流程设计、CAD软件等。她提供功能非常强大的ActiveX控件,和其他流行的编程语言共同工作,极大地弥补了这些语言在图形处理方面的不足。也可以嵌入IE浏览器中,实现网上图形编辑和控制等。http://www.visual-graph.com
      

  3.   

    使用TCAD
    http://www.codeidea.com/cn/
      

  4.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, ExtCtrls, StdCtrls, Buttons;type
      TForm1 = class(TForm)
        Panel1: TPanel;
        Image1: TImage;
        B_up: TBitBtn;
        B_down: TBitBtn;
        B_left: TBitBtn;
        B_right: TBitBtn;
        procedure B_upClick(Sender: TObject);
        procedure B_downClick(Sender: TObject);
        procedure B_leftClick(Sender: TObject);
        procedure B_rightClick(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;
      bmp: TBitmap;
      bmpwidth,bmpheight: integer;  //图片的宽度和高度
    implementation{$R *.dfm}procedure TForm1.B_upClick(Sender: TObject);
    var
     i:integer;
    begin
     bmp:=TBitmap.Create;
     bmp.Width:=Image1.Width;
     bmp.Height:=Image1.Height;
     bmpwidth:=Image1.Width;
     bmpheight:=Image1.Height;
     Image1.Visible:=False;
     for i:=0 to bmpheight do
      begin
       bmp.Canvas.CopyRect(Rect(0,bmpheight-i,bmpwidth,bmpheight),image1.Canvas,
                           Rect(0,0,bmpwidth,i));  //上拉效果
       Form1.Canvas.Draw(16,16,bmp); //在坐标(16,16)处显示位图
      end;
     bmp.Free;
     Image1.Visible:=True;
    end;procedure TForm1.B_downClick(Sender: TObject);
    var
     i:integer;
    begin
     bmp:=TBitmap.Create;
     bmp.Width:=Image1.Width;
     bmp.Height:=Image1.Height;
     bmpwidth:=Image1.Width;
     bmpheight:=Image1.Height;
     Image1.Visible:=False;
     for i:=0 to bmpheight do
      begin
       bmp.Canvas.CopyRect(Rect(0,0,bmpwidth,i),image1.Canvas,
                           Rect(0,bmpheight-i,bmpwidth,bmpheight));  //下拉效果
       Form1.Canvas.Draw(16,16,bmp);  //在坐标(16,16)处显示位图
      end;
     bmp.Free;
     Image1.Visible:=True;
    end;procedure TForm1.B_leftClick(Sender: TObject);
    var
     i:integer;
    begin
     bmp:=TBitmap.Create;
     bmp.Width:=Image1.Width;
     bmp.Height:=Image1.Height;
     bmpwidth:=Image1.Width;
     bmpheight:=Image1.Height;
     Image1.Visible:=False;
     for i:=0 to bmpwidth do
      begin
       bmp.Canvas.CopyRect(Rect(bmpwidth-i,0,bmpwidth,bmpheight),image1.Canvas,
                           Rect(0,0,i,bmpheight));  //左移效果
       Form1.Canvas.Draw(16,16,bmp);  //在坐标(16,16)处显示位图
      end;
     bmp.Free;
     Image1.Visible:=True;
    end;procedure TForm1.B_rightClick(Sender: TObject);
    var
     i:integer;
    begin
     bmp:=TBitmap.Create;
     bmp.Width:=Image1.Width;
     bmp.Height:=Image1.Height;
     bmpwidth:=Image1.Width;
     bmpheight:=Image1.Height;
     Image1.Visible:=False;
     for i:=0 to bmpwidth do
      begin
       bmp.Canvas.CopyRect(Rect(0,0,i,bmpheight),image1.Canvas,
                           Rect(bmpwidth-i,0,bmpwidth,bmpheight));  //右移效果
       Form1.Canvas.Draw(16,16,bmp);  //在坐标(16,16)处显示位图
      end;
     bmp.Free;
     Image1.Visible:=True;
    end;end.
    加个timer时间间隔多少就可以实现你说的问题