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

📄 tfrmmainmenu.pas

📁 这个是去年写的东东。 以前公司一直使用易飞ERP
💻 PAS
📖 第 1 页 / 共 2 页
字号:
  Except
    Exit;
  end;
end;

procedure TForm1.TreeView1Change(Sender: TObject; Node: TTreeNode);
var i,i1,i2,n:integer;
    s,muf2:string;
    {ct:integer;
    ft:string;}
begin
  //
try
  Screen.Cursor := crHourGlass ;

  i1:=Node.Level ;
  i2:=Node.Index ;
  for n:=0 to Sessions1-1 do begin
    if (Session1[n].level=i1) AND (Session1[n].index=i2) AND
      (Node.Text=Session1[n].mmu1) then begin
      i:=n;
      break;
    end;
  end ;
  if i<0 then i:=0;
   //showmessage( Session1[i].mmu1 +'-' +inttostr(i)+#13+'Index:'+inttostr(Node.Index)+#13+'Level:'+inttostr(Node.Level) ) ;
   RichEdit1.Clear ;
   RichEdit1.Visible := False ;
   pnlBrowser.Visible := False ;
   //WebBrowser.Navigate('about:blank') ;
   if Length(Session1[i].mmu3)=0 then Exit;
   s:=Before('|',Session1[i].mmu3);
   case StrToInt(Session1[i].mmu2) of
     1:begin //图文档
       if UpperCase(Before('\',s))= 'C_DATA' then s:='..\'+s ;
       if FileExists(s) then Image1.Picture.Bitmap.LoadFromFile(s);
       end;
     2:begin //文字档
         RichEdit1.Align := alClient ;
         if FileExists(s) then
            RichEdit1.Lines.LoadFromFile(s);
         RichEdit1.Visible := True ;
       end;
     3:begin //HTML档
         pnlBrowser.Align := alClient ;
         pnlBrowser.Visible := True ;
         WebBrowser.Navigate(s);
         
       end;
     4: begin  //地图档
        if UpperCase(Before('\',s))= 'C_DATA' then s:='..\'+s ;
        if Not FileExists(s) then Exit ;

        Inifile := TIniFile.Create(s);//读InI文件

        muf2 := IniFile.ReadString('Picture','File','');
        if UpperCase(Before('\',muf2))= 'C_DATA' then muf2:='..\'+muf2 ;
        if Length(muf2)>0 then Image1.Picture.Bitmap.LoadFromFile(muf2);

        {
        [Picture]
        File=c_data\ACT_2Frame.bmp
        [Buttons]
        1=237,129,97,21|资产负债表|1,ACTR22
        2=238,150,97,26|损益表|1,ACTR46
        3=152,203,99,19|多期财务报表对比|1,ACTR24
        }
        for n:=0 to 30 do begin   //开始添加按钮
           if Session2[n].mmu25<>'' then begin
             Session2[n].mmu25 := '' ;
             Session2[n].mmu20.Free ;
           end;
           muf2 := IniFile.ReadString('Buttons',inttostr(n+1),'');
           if muf2<>'' then begin
             {
             1=81,149,108,21|神州数码工作流|4,C_Data\EasyFlowFrame.MMU
             11=34,142,37,32|神州数码工作流|4,C_Data\EasyFlowFrame.MMU
             }
             
             Session2[n].mmu21 := StrToInt(Before(',',muf2)) ; //坐标LEFT
             muf2:=After(',',muf2) ;
             Session2[n].mmu22 := StrToInt(Before(',',muf2)) ; //坐标TOP
             muf2:=After(',',muf2) ;
             Session2[n].mmu23 := StrToInt(Before(',',muf2)) ; //坐杯Width
             muf2:=After(',',muf2) ;
             Session2[n].mmu24 := StrToInt(Before('|',muf2)) ; //坐标Heigth
             muf2:=After('|',muf2) ;
             Session2[n].mmu25 := Before('|',muf2) ;  //名称
             muf2:=After('|',muf2) ;
             Session2[n].mmu26 := Before(',',muf2) ;  //标识类
             Session2[n].mmu27 :=After(',',muf2) ;    //文件位置
             Session2[n].mmu20 := TSpeedButton.Create(Self) ;
             Session2[n].mmu20.Parent := Panel2 ;
             Session2[n].mmu20.Flat := True ;
             Session2[n].mmu20.Cursor := crHandPoint ;
             Session2[n].mmu20.OnClick := SpeedButtonClick ;
             Session2[Sessions2].mmu20.Tag := n ;
             Session2[n].mmu20.Left := Session2[n].mmu21 ;
             Session2[n].mmu20.Top := Session2[n].mmu22 ;
             Session2[n].mmu20.Width := Session2[n].mmu23 ;
             Session2[n].mmu20.Height := Session2[n].mmu24 ;
             Session2[n].mmu20.Hint := Session2[n].mmu25 ;
             //inc(Sessions2) ;
           end;{ else begin
             if Session2[n].mmu20<>NIL then
              Session2[n].mmu20:=NIL;}
         end;
         //Inifile.Free ;
        end;

     else exit ;
   end;
Finally

  Screen.Cursor := crDefault ;
end;
end;

procedure TForm1.SpeedButtonClick(Sender: TObject);
begin
  //showmessage('您选择了:'+Session2[(Sender as TSpeedButton).tag].mmu25) ;
  showmessage('您选择了:'+(Sender as TSpeedButton).Hint ) ;
end;

procedure TForm1.mnuPropEditClick(Sender: TObject);
var n,i,i1,i2:integer;
    node:TTreeNode;
begin
  i1:=TreeView1.Selected.Level ;
  i2:=TreeView1.Selected.Index ;
  node := TreeView1.Selected;
  i:= Node.StateIndex ;
  if i<0 then i:=0;
  form4.Edit1.Text := Session1[i].mmu1 ;
  case StrToint(Session1[i].mmu2) of
    0:begin //无
      Form4.RadioButton1.Checked := True ;
      Form4.Edit2.Text := '' ;
      end;
    1:begin  //图形档
      Form4.RadioButton1.Checked := True ;
      if Length(Session1[i].mmu3)>0 then
        if Session1[i].mmu3[1]<>'|' then
          Form4.Edit2.Text := Session1[i].mmu3 ;
      end;
    2:begin //文字档
      Form4.RadioButton2.Checked := True ;
      if Length(Session1[i].mmu3)>0 then
        if Session1[i].mmu3[1]<>'|' then
          Form4.Edit2.Text := Session1[i].mmu3 ;
      end;
    3:begin //HTML
      Form4.RadioButton3.Checked := True ;
      if Length(Session1[i].mmu3)>0 then
        if Session1[i].mmu3[1]<>'|' then
          Form4.Edit2.Text := Session1[i].mmu3 ;
      end;
    4:begin //地图档
      Form4.RadioButton4.Checked := True ;
      if Length(Session1[i].mmu3)>0 then
        if Session1[i].mmu3[1]<>'|' then
          Form4.Edit2.Text := Session1[i].mmu3 ;
      end;
  end;
  Form4.lblProgramID.Caption := '' ;
  //根据各种显示TAB页
  Form4.TabSheet1.PageControl := Nil ;
  Form4.TabSheet2.PageControl := Nil ;
  if Length(Session1[i].mmu3)>0 then
  begin
    if (Session1[i].mmu3[1]='|') AND (Session1[i].mmu3[2]='1') then //自统自带
    begin
      Form4.lblProgramID.Caption := Session1[i].mmu4 ;
      Form4.TabSheet1.PageControl := Form4.PageControl1 ;
    end ;
    if (Session1[i].mmu3[1]='|') AND (Session1[i].mmu3[2]='2') then //自统自带
    begin
      Form4.EdtExeFile.Text := Session1[i].mmu4 ;
      Form4.TabSheet2.PageControl := Form4.PageControl1 ;
    end ;
  end;
  Form4.PageControl1.ActivePage := Form4.edtName ;
  form4.Visible := True ;
end;

procedure TForm1.TreeView1Expanding(Sender: TObject; Node: TTreeNode; //展开子树形目录
  var AllowExpansion: Boolean);
var
  i,n1,n2,n3,n4,n5,n : Integer;
  muf2,s,s2 : string ;
  pnode:TTreeNode;
begin
  {showmessage(inttostr(Node.Index)+#13+
     inttostr(Node.Level)+#13 ) ;
  }
  n:=Node.Level ; //是第几级
  n1:=Node.Index ;
  s:='' ;
  case  n of
    1: s := IntToStr(n1+1) ;
    2: begin
         n2:=Node.Parent.Index ;
         s := IntToStr(n2+1) + '-' + IntToStr(n1+1) ;
       end;
    3: begin
         n2:=Node.Parent.Index ;
         n3:=Node.Parent.Parent.Index ;
         s := IntToStr(n3+1) + '-' + IntToStr(n2+1) + '-' + IntToStr(n1+1) ;
       end;
    4: begin
         n2:=Node.Parent.Index ;
         n3:=Node.Parent.Parent.Index ;
         n4:=Node.Parent.Parent.Parent.Index ;
         s := IntToStr(n4+1) + '-' + IntToStr(n3+1) + '-' + IntToStr(n2+1) +
            '-' + IntToStr(n1+1) ;
       end;
    5: begin
         n2:=Node.Parent.Index ;
         n3:=Node.Parent.Parent.Index ;
         n4:=Node.Parent.Parent.Parent.Index ;
         n5:=Node.Parent.Parent.Parent.Parent.Index ;
         s := IntToStr(n5+1) + '-' + IntToStr(n4+1) + '-' + IntToStr(n3+1)
            + '-' + IntToStr(n2+1) + '-' + IntToStr(n1+1) ;
       end;
  end ;

  // 分散导入树形目录
  if Node.Data<>nil then begin       //没有读入,则读入
    TreeView1.Items.BeginUpdate;
    Node.Data:=nil;             //做个标记,第二级数据已经读入
    Node.DeleteChildren;

    Inifile := TIniFile.Create(muf);//读InI文件
    for i:= 1 to 30 do begin
      muf2 := IniFile.ReadString('Folder',s+'-'+inttostr(i),'');
      if muf2<>'' then begin
        s2:=muf2;
        muf2 := Before(',',muf2) ;
        s2:=After(',',s2);
        Session1[Sessions1].mmu1:=muf2; //名称
        Session1[Sessions1].mmu2:=Before(',',s2);  //是什么档,1-4
        Session1[Sessions1].mmu3:=After(',',s2); //菜单文件
        Session1[Sessions1].mmu4 := '';
        //showmessage(Session1[Sessions1].mmu3) ;

        pnode:=TreeView1.Items.AddChild(Node, Session1[Sessions1].mmu1);
        Session1[Sessions1].level := pnode.Level ;
        Session1[Sessions1].index := pnode.Index ;
        pnode.StateIndex := Sessions1 ;
        pnode.Data := Pointer(1);      //做个标记,第二级数据是否已经读入

        pnode.HasChildren := true;
        inc(Sessions1);

      end else break;
    end;  //结束 FOR

    for i:= 1 to 30 do begin
      muf2 := IniFile.ReadString('Item'+s,inttostr(i),'');

      if muf2<>'' then begin
        s2:=muf2;
        muf2 := Before(',',muf2) ;
        s2:=After(',',s2);
        Session1[Sessions1].mmu1:=muf2; //名称
        Session1[Sessions1].mmu2:=Before(',',s2);  //是什么档,1-4
        Session1[Sessions1].mmu3:=After(',',s2); //菜单文件
        if Length(Session1[Sessions1].mmu3[1])>0 then
        if Session1[Sessions1].mmu3[1]='|' then
          Session1[Sessions1].mmu4 := After(',',Session1[Sessions1].mmu3)  //程序名称
        else
          Session1[Sessions1].mmu4 := '';

        pnode:=TreeView1.Items.AddChild(Node, Session1[Sessions1].mmu1);
        Session1[Sessions1].level := pnode.Level ;
        Session1[Sessions1].index := pnode.Index ;
        pnode.StateIndex := Sessions1 ;
        pnode.ImageIndex := 1 ;
        pnode.SelectedIndex := 1;
        inc(Sessions1);
      end else break;
    end;  //结束 FOR

  end; //结束 IF
  TreeView1.Items.EndUpdate ;
end;

procedure TForm1.N5Click(Sender: TObject);
begin
  if fmAbout<>nil then begin
    fmAbout.Close ;
    fmAbout:=nil;
  end;
  Application.CreateForm(TfmAbout, fmAbout);
  fmAbout.Visible := True ;
end;

procedure TForm1.mnuDeleteClick(Sender: TObject);
begin
  TreeView1.Selected.Delete ;
end;

end.

⌨️ 快捷键说明

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