窗口等待

来源:互联网 发布:vb中sum=0是什么意思 编辑:程序博客网 时间:2024/06/10 02:38

procedure ShowWaitWindow(TmpStr: string; Okay: Boolean);
var
  Rect: TRect;
begin
  if not Assigned(frm_Start) then
  begin
    if Okay then frm_Start := THintWindowEx.Create(Application)
    else Exit;
  end
  else
    if not Okay then begin frm_Start.Free; frm_Start := nil; Exit; end;
  Rect.Left := Round((Screen.Width - 300) / 2);
  Rect.Top := Round((Screen.Height - 150) / 2);
  Rect.Right := Round((Screen.Width - 300) / 2) + 300;
  Rect.Bottom := Round((Screen.Height - 150) / 2) + 60;
  //     frm_Start.Color := clSilver;
  frm_Start.Color := $00B57F03;
  frm_Start.ActivateHint(Rect, TmpStr);
  frm_Start.BringToFront;
  frm_Start.Repaint;
end;

 

type

  THintWindowEx = class(THintWindow)
    procedure Paint; override;
  end;

 

frm_Start: THintWindow;

 

procedure THintWindowEx.Paint;
var
  R: TRect;
begin
  R := ClientRect;
  Inc(R.Left, 2);
  Inc(R.Top, 2);
  Canvas.Font.Size := 10;
  Canvas.Font.Name := '宋体';
  Canvas.Font.Color := clWhite;
  DrawText(Canvas.Handle, PChar(Caption), -1, R, DT_LEFT or DT_NOPREFIX or
    DT_WORDBREAK or DrawTextBiDiModeFlagsReadingOnly);
end;

原创粉丝点击