窗口等待

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;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章