BSOne.SFC/eCrmHE/EXE_eCrmHomeEdition/Messages/DPrintProg.pas

176 lines
4.2 KiB
Plaintext

unit DPrintProg;
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, System.ImageList, Vcl.ImgList, PngImageList;
type
TDlgPrintProg = class(TForm)
imgMain: TImage;
imgChk1: TImage;
lbStep1: TLabel;
imgDot1: TImage;
lbMsg1: TLabel;
imgChk2: TImage;
lbStep2: TLabel;
imgDot2: TImage;
lbMsg2: TLabel;
imgChk3: TImage;
lbStep3: TLabel;
imgDot3: TImage;
lbMsg3: TLabel;
imgChk4: TImage;
lbStep4: TLabel;
imgDot4: TImage;
lbMsg4: TLabel;
imgChk5: TImage;
lbStep5: TLabel;
imgDot5: TImage;
lbMsg5: TLabel;
imgList: TPngImageList;
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure lbMsg1DblClick(Sender: TObject);
private
{ Private declarations }
arrChkImg_,
arrDotImg_: array [0 .. 4] of TImage;
arrStep_,
arrMsg_: array [0 .. 4] of TLabel;
nCurPos_,
nMaxStep_: Integer;
public
{ Public declarations }
Constructor Create(aOwner: TComponent); override;
procedure CreateParams(var Params: TCreateParams); override;
procedure SetProg(arrStr: array of String);
procedure SetMsg(sMsg: String);
procedure NextStep;
end;
var
DlgPrintProg: TDlgPrintProg;
implementation
resourcestring
RS_Complete = '완료';
RS_Prog = '진행중...';
{$R *.dfm}
Constructor TDlgPrintProg.Create(aOwner: TComponent);
begin
Inherited Create(aOwner);
arrChkImg_[0] := imgChk1;
arrChkImg_[1] := imgChk2;
arrChkImg_[2] := imgChk3;
arrChkImg_[3] := imgChk4;
arrChkImg_[4] := imgChk5;
arrDotImg_[0] := imgDot1;
arrDotImg_[1] := imgDot2;
arrDotImg_[2] := imgDot3;
arrDotImg_[3] := imgDot4;
arrDotImg_[4] := imgDot5;
arrStep_[0] := lbStep1;
arrStep_[1] := lbStep2;
arrStep_[2] := lbStep3;
arrStep_[3] := lbStep4;
arrStep_[4] := lbStep5;
arrMsg_[0] := lbMsg1;
arrMsg_[1] := lbMsg2;
arrMsg_[2] := lbMsg3;
arrMsg_[3] := lbMsg4;
arrMsg_[4] := lbMsg5;
nCurPos_ := 0;
nMaxStep_ := 4;
end;
procedure TDlgPrintProg.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams( Params );
Params.ExStyle := WS_EX_APPWINDOW;
Params.WindowClass.Style := Params.WindowClass.Style or CS_DROPSHADOW;
end;
procedure TDlgPrintProg.SetProg(arrStr: array of String);
var
i: Integer;
begin
for i := Low(arrStr) to High(arrStr) do
begin
if i >= 5 then
break;
arrStep_[i].Caption := arrStr[i];
end;
nMaxStep_ := i - 1;
while i < 5 do
begin
arrStep_[i].Visible := false;
arrMsg_[i].Visible := false;
arrChkImg_[i].Visible := false;
arrDotImg_[i].Visible := false;
Inc(i);
end;
end;
procedure TDlgPrintProg.SetMsg(sMsg: String);
begin
arrMsg_[nCurPos_].Caption := sMsg;
Application.ProcessMessages;
end;
procedure TDlgPrintProg.NextStep;
begin
imgList.GetIcon(1, arrChkImg_[nCurPos_].Picture.Icon);
arrStep_[nCurPos_].Font.Color := $979797;
arrStep_[nCurPos_].Font.Style := arrMsg_[nCurPos_].Font.Style - [fsBold];
arrMsg_[nCurPos_].Caption := RS_Complete;
arrMsg_[nCurPos_].Font.Color := $979797;
arrMsg_[nCurPos_].Font.Style := arrMsg_[nCurPos_].Font.Style - [fsBold];
if nCurPos_ < nMaxStep_ then
begin
Inc(nCurPos_);
imgList.GetIcon(0, arrChkImg_[nCurPos_].Picture.Icon);
arrStep_[nCurPos_].Font.Color := $DB6646;
arrStep_[nCurPos_].Font.Style := arrMsg_[nCurPos_].Font.Style + [fsBold];
arrMsg_[nCurPos_].Caption := RS_Prog;
arrMsg_[nCurPos_].Font.Color := $DB6646;
arrMsg_[nCurPos_].Font.Style := arrMsg_[nCurPos_].Font.Style + [fsBold];
Application.ProcessMessages;
end else Hide;
end;
procedure TDlgPrintProg.FormClose(Sender: TObject; var Action: TCloseAction);
begin
// Action := TCloseAction.caFree;
end;
procedure TDlgPrintProg.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
end;
procedure TDlgPrintProg.lbMsg1DblClick(Sender: TObject);
begin
{$IFDEF DEBUG}
NextStep;
{$ENDIF}
end;
end.