zoukankan      html  css  js  c++  java
  • Image进度条 图片


     

    unit Unit1;

    interface

    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Imaging.pngimage,
      Vcl.ExtCtrls;

    type
      TForm1 = class(TForm)
        Image1: TImage;
        Button1: TButton;
        Timer1: TTimer;
        procedure Timer1Timer(Sender: TObject);
        procedure Button1Click(Sender: TObject);
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;

    var
      Form1: TForm1;

    implementation

    {$R *.dfm}
    procedure ImageProgress(current:Integer;max:Integer; ImageWidth:integer;Image:TImage);
    begin
        if Max<>0 then Image.Width:=Trunc((current/max)*ImageWidth);
    end;

    var
      i:Integer=0;
    procedure TForm1.Button1Click(Sender: TObject);
    begin
       i:=0;
    end;

    procedure TForm1.FormCreate(Sender: TObject);
    begin
      Form1.DoubleBuffered:=true;
    end;

    procedure TForm1.Timer1Timer(Sender: TObject);
    begin
       i:=i+3;
       sleep(50);
       ImageProgress( i,100,144,Image1);
    end;

    end.









     
    //image       
     
     
     
    //width
    {
    min    =      //image1.=0;
    max    =       //image1.=172;//Image1的宽度是172
    position=      //pos=trunc((min/max)*100*1.72)=trunc((min/max)*ImageWidth);
     
    }
     
    procedure ImageProgress(min:Integer;max:Integer;ImageWidth:integer;Image:TImage);
    begin
        if Max<>0 then Image.Width:=Trunc((min/max)*ImageWidth);
    end;
     
    ImageProgress(StrToInt(Edit1.Text),StrToInt(Edit2.Text),172,Image1);
    /////////////////////////////////////////
     
     
    unit Unit1;

    interface

    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ComCtrls, ExtCtrls;

    type
      TForm1 = class(TForm)
        Image1: TImage;
        Timer1: TTimer;
        Bevel1: TBevel;
        Button3: TButton;
        Edit1: TEdit;
        Edit2: TEdit;
        Button2: TButton;
        Memo1: TMemo;
        procedure Timer1Timer(Sender: TObject);
        procedure FormCreate(Sender: TObject);
        procedure Button2Click(Sender: TObject);
        procedure Button3Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;

    var
      Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TForm1.Timer1Timer(Sender: TObject);
    var min,max,p:integer;
    begin
      memo1.Clear;
      ///////////////////////////////////////
      min:=StrToInt(Edit1.Text);
      max:=StrToInt(Edit2.Text);
      if Image1.Width<0 then Image1.Width:=0;
      if Image1.Width>172 then Image1.Width:=172;

      p:=Trunc((min / max)*100*1.72);
      Image1.Width:=p;

      ///////////////////////////////////////
      memo1.Lines.Add(Format('µ±Ç°image1.width=%d',[p]));
      memo1.Lines.Add(       'image1.width MIN=0');
      memo1.Lines.Add(       'image1.width MAX=172');
    end;

    procedure TForm1.FormCreate(Sender: TObject);
    begin
    Image1.Width:=0;
    Edit1.Text:='50';
    Edit2.Text:='100';
    end;

    procedure TForm1.Button2Click(Sender: TObject);
    begin
      if (Image1.Width>=0)and(Image1.Width<=172) then  Edit1.Text:=IntToStr(StrtoInt(Edit1.text)+1);
    end;
                      // 0=<image.width<=172
    procedure TForm1.Button3Click(Sender: TObject);
    begin
      if (Image1.Width>=0)and(Image1.Width<=172) then  Edit1.Text:=IntToStr(StrtoInt(Edit1.text)-1);
    end;

    end.




  • 相关阅读:
    android ListView几个比较特别的属性
    一.反编译Apk得到Java源代码
    android 正确获取屏幕像素大小
    android 动态添加控件
    动态加控件
    android ListView的美化涉及到的一些属性
    ASP.NET中的状态管理(转载)
    ASP.NET 2.0使用user profile储存信息前,如何部署aspnetdb.mdf和连接
    ASP.NET中防止Access数据库下载
    个性化用户配置概述、Profile配置节详细介绍
  • 原文地址:https://www.cnblogs.com/xe2011/p/2543407.html
Copyright © 2011-2022 走看看