TPageControl控件的Tab页头中怎么插入SpeedButton控件?在线等待,谢谢
在 http://expert.csdn.net/Expert/topic/2227/2227115.xml?temp=.8682825
和 http://expert.csdn.net/Expert/topic/2224/2224073.xml?temp=.6878626
也提过。

解决方案 »

  1.   

    我已经把控件插入进去了,但是在关闭FORM的时候总出错,不知道什么原因?
      

  2.   

    SpeedButton1放在Panel1上,
    procedure TForm1.FormShow(Sender: TObject);
    begin
      Panel1.Parent := pagecontrol1;
      SpeedButton1.Parent := pagecontrol1;
    end;
    procedure TForm1.PageControl1DrawTab(Control: TCustomTabControl;
      TabIndex: Integer; const Rect: TRect; Active: Boolean);
    var re: TRect;
    begin
        re := Control.TabRect(0);
        Panel1.Width:= re.Right - re.Left;
        Panel1.Height := re.Bottom -re.Top;
        control.InsertControl(Panel1);
        panel1.Visible := false;
    end;
    procedure TForm1.Panel1Resize(Sender: TObject);
    begin
      SpeedButton1.Width := 20;
      SpeedButton1.Height := panel1.Height + 2;
    end;
      

  3.   

    我要在TAB页中放两个按钮,控制TAB页的选择和关闭。
      

  4.   

    难道不能6用弹出菜单来控制吗?你的speedbutton创建的代码和释放的代码也贴出来看看
      

  5.   

    procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
    action:=cafree;
    end;
      

  6.   

    SpeedButton1放在Panel1上,
    procedure TForm1.FormShow(Sender: TObject);
    begin
      Panel1.Parent := pagecontrol1;
      SpeedButton1.Parent := pagecontrol1;
    end;
    procedure TForm1.PageControl1DrawTab(Control: TCustomTabControl;
      TabIndex: Integer; const Rect: TRect; Active: Boolean);
    var re: TRect;
    begin
        re := Control.TabRect(0);
        Panel1.Width:= re.Right - re.Left;
        Panel1.Height := re.Bottom -re.Top;
    /////////
        control.ReMoveControl(Panel1);
    ////////
        control.InsertControl(Panel1);
        panel1.Visible := false;
    end;
    procedure TForm1.Panel1Resize(Sender: TObject);
    begin
      SpeedButton1.Width := 20;
      SpeedButton1.Height := panel1.Height + 2;
    end;
      

  7.   

    如果只是改变外观的换,用Image控件美化你的Tab的按钮从而达到你预期的目的。
      

  8.   

    control.InsertControl(Panel1);
    前首先应该从Panel1原来的父控件中删除Panel1。假设它原来放在窗体上,那么也就是加上:
      RemoveControl(Panel1);—————————————————————————————————
    宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
    —————————————————————————————————
      

  9.   

    设置PageControl的Style属性,可以让表头是按钮形状的。