在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中,以编程方式将其添加到窗体后,按钮和副标题都会增加。我想要正常尺寸的。
谢谢
发布于 2011-10-25 16:42:45
嗯,可能的问题是,您以编程方式将TabControlControl.ItemSize设置为"Gets or sets the size of the control's tabs“
https://stackoverflow.com/questions/7886097
复制相似问题