zoukankan      html  css  js  c++  java
  • 图像移动

    procedure TForm2.Button1Click(Sender: TObject);
    begin
      if(OpenDialog1.Execute)then
      begin
        Edit1.Text:=OpenDialog1.FileName;
        sFileName:=Edit1.Text;
      end;
    end;


    procedure TForm2.Button2Click(Sender: TObject);
    begin
      Bitmap1:=TBitmap.Create;
      Bitmap1.LoadFromFile(sFileName);
      Delta:=Bitmap1.Width/distance;
      for I:=0 to Distance do
      begin
        MidVar:=Round(Delta*I);
        with srcRect do
        begin
          Left:=Bitmap1.Width-MidVar;
          top:=0;
          Right:=Bitmap1.Width;
          Bottom:=Bitmap1.Height;
        end;
        with destRect do
        begin
          Left:=X0;
          top:=Y0;
          Right:=X0+MidVar;
          Bottom:=Y0+Bitmap1.Height;
        end;

        Canvas.CopyRect(destRect,Bitmap1.canvas,srcRect);
      end;

    Bitmap1.Free;
    end;

    Delphi中实现位图的拷贝有三种方法:

    1、TCanvas 对象中的CopyRect方法

    2、Windows API 的Bitblt函数

    3、运行时动态改变Timage的Top和Left等属性


     

  • 相关阅读:
    程序的机器级表示(一)
    virtual memory(1)
    Python定义参数数量可变的method的问题
    存储器结构层次(四)
    CAShapeLayer
    cell
    远程服务器推送
    keyboad
    search搜索
    Cocoopod
  • 原文地址:https://www.cnblogs.com/huking/p/1706735.html
Copyright © 2011-2022 走看看