• 利用FMX控件的MakeScreenshot过程实现WAIT效果


    原理:

     1、新建一个waitform,添加控件:

        背景图片BACKPIC:Timage控件;

        再叠加一个WAIT图标(TAniIndicato控件)。

     2、在要实现wait效果的form上添加一个控件作为背景工作区(例如TPANEL)。

        需要实现wait效果时,调用TPANEL.MakeScreenshot,替换waitform上的BACKPIC,显示WAIT图标。

        结束时,关闭waitform。

    关键代码如下:

    unit waitform;

    interface

    uses......;

    type

    Twaitform= class(TForm)
       WorkingPanel: TRectangle;
       GrayBox: TRectangle;
       WorkingLBL: TLabel;
       AniIndicator: TAniIndicator;
       bgImage: TImage;
    private
    { Private declarations }
    public
    { Public declarations }
    end;

    调用主程序:

    procedure  waitingMsg(Text: String; Working: Boolean);

    begin
    if Working=True then
    begin
    Application.ProcessMessages;
    {$IFDEF ANDROID}
    waitform.bgImage.Bitmap.Assign(PANEL1.MakeScreenshot);
    {$ENDIF}
    waitform.Show;
    waitform.AniIndicator.Enabled := True;
    waitform.WorkingLBL.Text := Text;
    end
    else
    begin
    waitform.AniIndicator.Enabled := False;
    waitform.WorkingLBL.Text := Text;
    waitform.Close;
    {$IFDEF ANDROID}
    waitform.bgImage.Bitmap.Assign(nil);
    {$ENDIF}
    mainform.Show;
    end;
    end;

    procedure Tmainform.Button1Click(Sender: TObject);
    begin
    waitingMsg('wait...',True);
    end;

        

  • 相关阅读:
    通过应用程序域AppDomain加载和卸载程序集(转自张逸)
    Asp.net 2.0 中获取控件输出的Html代码 (转)
    工作和学习
    查询数据库中的所有表
    观活动板房感怀
    温心之旅
    读书无用论是21世纪最大的阴谋
    我渴望女人,但我更渴望成功
    外面比家里亮
    近来,可好?
  • 原文地址:https://www.cnblogs.com/happyhills/p/3549003.html
Copyright © 2020-2023  润新知