TabPageControl作为UserControl:增加了字幕和按钮
在 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中,以编程方式将其添加到表单后,增加了按钮和字幕。我想要正常尺寸的它们。
谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,问题可能是您以编程方式设置 TabControlControl.ItemSize ,它恰好是“获取或设置控件选项卡的大小"
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"