0

在 C# 中,我创建了从 TabPage 继承的 TabControl:

public partial class TabPageControl : TabPage
{
        public AutoScaleMode AutoScaleMode = AutoScaleMode.Inherit;

        private TabPagePanelControl tabControlPanel = new TabPagePanelControl();

        public TabPageControl()
        {
            InitializeComponent();

            tabControlPanel.Dock = DockStyle.Fill;
            this.Controls.Add(tabControlPanel);
        }
    ...
}

此 tabPage 被添加到 TabControl。TabControl 也被创建为 UserControl:

public partial class TabControlControl : TabControl
    {
        public delegate void OnHeaderCloseDelegate(object sender, CloseEventArgs e);
        public event OnHeaderCloseDelegate OnClose;

    public TabControlControl()
    {
        InitializeComponent();
        //SetStyle(System.Windows.Forms.ControlStyles.DoubleBuffer, true);
        this.TabStop = false;
        this.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed;
        this.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.ItemSize = new System.Drawing.Size(230, 24);
    }
...
}

问题出在此控件的显示上。在 TabControl 中,以编程方式将其添加到表单后,按钮和字幕增加了。我想要它们的正常尺寸。

谢谢

4

1 回答 1

0

好吧,问题可能是您以编程方式设置 TabControlControl.ItemSize 正是“获取或设置控件选项卡的大小

于 2011-10-25T08:42:45.433 回答