如何创建、编写一个主窗体中的左侧有一竖排类似按钮,点击出现下拉小项,点击小项,在右侧出现具体功能窗体!!!

解决方案 »

  1.   

    1、“竖排按钮”你可以随便做,Panel、Button、BitBtn(推荐)、SpeedButton等,都可以很方便地实现。
    2、下拉小项可以用PopupMenu,计算一下弹出位置X和Y,在“竖排按钮”的OnClick事件中加入代码:SomePopupMenu.Popup(X, Y);即可。弹出菜单也可以是多级的。
    3、在弹出菜单项的OnClick事件加入你要处理的事情(如显示相关的窗口)。
    应该搞掂了吧。
      

  2.   

    treeview就可以,我在这个论坛里发现有这样用的代码,正好copy了,你看看类似oicq代码如下(摘录的):procedure TfrmClientMng.TVClientCustomDrawItem(Sender: TCustomTreeView;
      Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
     var
     NodeRect: TRect;
      X, Y, W: integer;
      ss:String;
      Icon1:TIcon; }
    begin
    inherited;
       //有点像oicq样式的treeview
       {ss:=Trim(Node.Text);
       System.Delete(ss,1,Pos('^',ss));
       if Node.Level>1 then ss:=Copy(ss,1,Pos('^',ss)-1);
       Icon1:=TIcon.Create;   try
         with TVClient.Canvas do
         begin
           DefaultDraw := False;
           NodeRect := Node.DisplayRect(False);
           if (Node.Level = 0) then
           begin
             Brush.Color := clBtnFace;
             FillRect(NodeRect);
             Pen.Color   := clBtnHighlight;
             MoveTo(NodeRect.Right, NodeRect.Top);
             LineTo(NodeRect.Left, NodeRect.Top);
             LineTo(NodeRect.Left, NodeRect.Bottom - 1);
             Pen.Color := clBlack;
             LineTo(NodeRect.Right - 1, NodeRect.Bottom - 1);
             LineTo(NodeRect.Right - 1, NodeRect.Top);
             Pen.Color := clWindowText;
             Font.Color := clWindowText;
           end
           else
           begin
             NodeRect := Node.DisplayRect(False);
             Brush.Color := RGB(136,172,255);
             Brush.Style := bsSolid;
             FillRect(NodeRect);
             if cdsSelected in State then
             begin
               Pen.Color   := clBlack;
               MoveTo(NodeRect.Right, NodeRect.Top);
               LineTo(NodeRect.Left, NodeRect.Top);
               LineTo(NodeRect.Left, NodeRect.Bottom - 1);
               Pen.Color := clBtnHighlight;
               LineTo(NodeRect.Right - 1, NodeRect.Bottom - 1);
               LineTo(NodeRect.Right - 1, NodeRect.Top);
               Pen.Color := clWindowText;
             end;
           end;
           W := TextWidth(Trim(ss));
           //X := ((NodeRect.Right - NodeRect.Left)-W-TreeV.Images.Width) div 2;
           X := (TVclient.Width-W-TVclient.Images.Width) div 2;
           Y := NodeRect.Top + 1;
           if Node.Level=0 then begin
             TVClient.Images.GetIcon(Node.ImageIndex,Icon1);
             Draw(X-8,NodeRect.Top,Icon1);
             TextOut(X - 8+TVClient.Images.Width, NodeRect.Top+4, ss);
           end else begin          if Node.HasChildren then begin
                 if Node.Expanded then begin
                    TVClient.Images.GetIcon(1,Icon1);
                 end else begin
                    TVClient.Images.GetIcon(2,Icon1);
                 end;
              end else begin
                 TVClient.Images.GetIcon(3,Icon1);
              end;
              Draw(NodeRect.Left+Node.Level*20,NodeRect.Top,Icon1);
              TextOut(NodeRect.Left+Node.Level*20+TVClient.Images.Width,NodeRect.Top+4,ss);
              if (TComponent(Node).Tag=0)and(Node.Level>1) then begin
                 TVClient.Images.GetIcon(4,Icon1);
                 Draw(NodeRect.Left+Node.Level*20+TVClient.Images.Width+TextWidth(ss)+5,NodeRect.Top,Icon1);
              end;
           end;     end;
       finally
          Icon1.Free;
       end; end;
      

  3.   

    有没有详细的源码?无论是在mdi中的,还是框架中的都可以!但要声明适用哪个,谢谢!感谢中……问题解决立刻结帖