0
votes

In C# I have created TabControl which inherits from TabPage:

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);
        }
    ...
}

This tabPage is added to TabControl. TabControl is created as UserControl too:

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);
    }
...
}

The problem is with the display this controls. In TabControl, after programmatically added it to form, buttons and subtitles are increased. I would like to have them in normal size.

Thanks

1
Hard to guess what this is about. What is a subtitle? Controls normally inherit their Font from their parent, it is an ambient property. You are tinkering with Font in your code.Hans Passant

1 Answers

0
votes

Well, may be the problem is that you programmatically set TabControlControl.ItemSize which is exactly "Gets or sets the size of the control's tabs"