⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unavigator.pas

📁 简单易用的按件按时计工资管理系统
💻 PAS
字号:
unit uNavigator;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ActnList, ExtCtrls, jpeg{, oxBtns};

type
  TfmNavigator = class(TForm)
    pnlClient: TPanel;
    pnlLeft: TPanel;
    pnlTop: TPanel;
    imgTop: TImage;
    lbltitle: TLabel;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure FormResize(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure WMKeyDown(var Message: TWMKeyDown); message WM_KEYDOWN;
    procedure FormShow(Sender: TObject);
  private
    Title: array of widestring;
    //Buttons: array of ToxButton;
    Buttons: array of TLabel;
    procedure CreateObjects;
    procedure FreeObjects;
    procedure SetButtonsPos;
    procedure OnLbMouseEnter(Sender: TObject);
    procedure OnLbMouseLeave(Sender: TObject);

    procedure SetTitle;
    function GetlanguageRES(iTag: integer = 0): string;
  public
    { Public declarations }
  end;

var
  Pub_Navigator: TfmNavigator;
const
  CS_Sign_Wrap = #10 + #13;
  CS_Sign_Wrap_W = #10 + #13 + #10;
implementation

uses uMain, uGlobal;

{$R *.dfm}

procedure TfmNavigator.OnLbMouseEnter(Sender: TObject);
begin
  (Sender as TLabel).Font.Color := clWhite;
  lblTitle.Caption := TLabel(Sender).Caption + #10#13 + #10#13 + GetLanguageRES((Sender as Tlabel).Tag);
  lblTitle.Repaint;
end;

procedure TfmNavigator.OnLbMouseLeave(Sender: TObject);
begin
  (Sender as TLabel).Font.Color := clNavy;
  lblTitle.Caption := GetLanguageRES;
  lblTitle.Repaint; 
end;

procedure TfmNavigator.SetButtonsPos;
const
  CI_Space = 50;
  CI_ColCount = 3;
  CI_RowCount = 3;
var
  i, iRowCount: integer;
  btnHeight, TopSpace: integer;
begin
  iRowCount:=Length(Buttons);
  if iRowCount=0 then exit;

  btnHeight := (ClientHeight - (iRowCount + 1) * CI_Space) div iRowCount;
  if btnHeight>CI_Space then
    btnHeight:=CI_Space
  else if btnHeight<20 then
    btnHeight:=20;
  TopSpace:= (ClientHeight - btnHeight * iRowCount + (iRowCount-1) * CI_Space) div (CI_RowCount+1);
  for i := 0 to  iRowCount - 1 do
  begin
    with Buttons[i] do
    begin
      //Left := 20;
      Top := TopSpace + i * (btnHeight + CI_Space);
      //width := btnWidth;
      height := btnHeight;
    end;

  end;
end;

procedure TfmNavigator.CreateObjects;
var
  i, iBtnCount: integer;

begin
  iBtnCount := 0;
  for i := 0 to MainForm.actionsFun.ActionCount - 1 do
  begin
    if (not TAction(MainForm.actionsFun.Actions[i]).Visible) or
      (not TAction(MainForm.actionsFun.Actions[i]).Enabled) then
      continue;
    Inc(iBtnCount);
    SetLength(Buttons, iBtnCount);
    //Buttons[iBtnCount - 1] := ToxButton.Create(self);
    Buttons[iBtnCount - 1] := TLabel.Create(self);
    with Buttons[iBtnCount - 1] do
    begin
      Parent := pnlLeft;
      AutoSize:=False;
      AlignMent:= taCenter;
      Width:=Parent.Width ;
      //OnClick := TAction(MainForm.actionsFun.Actions[i]).OnExecute;
      Action:= TAction(MainForm.actionsFun.Actions[i]);
      Enabled := TAction(MainForm.actionsFun.Actions[i]).Enabled;
      //Lines.Text := TAction(MainForm.actionsFun.Actions[i]).Caption;
      Caption:= TAction(MainForm.actionsFun.Actions[i]).Caption;
      Hint:=TAction(MainForm.actionsFun.Actions[i]).Hint ;
      Tag := TAction(MainForm.actionsFun.Actions[i]).Tag;
      OnMouseEnter:=OnLbMouseEnter;
      OnMouseLeave:=OnLbMouseLeave;
      Cursor:=crHandPoint;

      Font.Color := clNavy;
      Font.Size :=16;
      Font.Name :='隶书';
      {MultiLine := True;
      Cursor := crHandPoint;
      PictureDown.Icon.Handle := Application.Icon.Handle;
      PictureUp.Icon.Handle := Application.Icon.Handle;
      PictureDisabled.Icon.Handle := Application.Icon.Handle;
      Style := bsInset;
      Background.Style := oxbGradient;
      Background.Gradient := clSkyBlue;
      Background.Color := clWhite;

      FocusStyle := [fsOutline];
      Font3D := fsInset;}  
      show;
    end;
  end;
  SetButtonsPos;
end;

procedure TfmNavigator.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  MainForm.actNavigator.Caption := '显示导航窗体';
  MainForm.NavigatorVisible:=False;
  Action := caFree;
end;

procedure TfmNavigator.FreeObjects;
{var
  i: integer; }
begin
  {for i := 0 to length(Buttons) - 1 do
    FreeAndNil(Buttons[i]);
  SetLength(Buttons, 0); }
end;

procedure TfmNavigator.FormCreate(Sender: TObject);
begin
  //Color := Mainform.Color;
  CreateObjects;
  SetTitle;
end;

procedure TfmNavigator.FormResize(Sender: TObject);
begin
  SetButtonsPos;
end;

procedure TfmNavigator.FormActivate(Sender: TObject);
begin
  self.WindowState := wsMaximized;
end;

procedure TfmNavigator.FormDestroy(Sender: TObject);
begin
  FreeObjects;
end;

procedure TfmNavigator.WMKeyDown(var Message: TWMKeyDown);
  function DoLabelShortcutMessage(pLabel:Tlabel; var Message: TWMKeyDown):Boolean;
  begin
    Result:=False;
    if (not pLabel.Enabled) or (not pLabel.Visible ) then exit;

    if IsAccel(Message.CharCode, pLabel.Caption) then
    begin
      Result:=True;
      Message.Result := 1;
      pLabel.OnClick (pLabel) ;
    end;
  end;
var
  i:integer;
begin
  for i := 0 to  Length(Buttons) - 1 do
  begin
    if DoLabelShortcutMessage(Buttons[i], Message) then exit;

  end;
end;

procedure TfmNavigator.SetTitle;
begin
 SetLength(Title, 6);
  Title[0] := '工资管理系统主要用于管理工厂员工的计时计件计重等'+  CS_Sign_Wrap
             +'工资的记录核算,以及员工工资的汇总。';

  Title[1] := '提供以下功能:' +  CS_Sign_Wrap_W
  + '① 工资计算单据的查询浏览;' + CS_Sign_Wrap
  + '② 工资计算单据数据的导出; ' + CS_Sign_Wrap
  + '③ 工资计算单的录入修改。';

  Title[2] := '提供以下功能:' +  CS_Sign_Wrap_W
    + '① 按时间按员工统计汇总员工的工资;' + CS_Sign_Wrap
    + '② 汇总数据的导出;' ;

  Title[3] := '提供以下功能:' +  CS_Sign_Wrap_W
    + '① 员工资料的录入修改及查询;' + CS_Sign_Wrap
    + '② 组资料的录入修改及查询;' ;
end;

function TfmNavigator.GetlanguageRES(iTag: integer): string;
begin
  Result := Title[iTag];
end;

procedure TfmNavigator.FormShow(Sender: TObject);
begin
  lblTitle.Caption := GetLanguageRES();
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -