我想在我的 TabControl
中更改 TabPage
的大小,
每个选项卡应排成一行,不能滚动。
第二个问题是关于如何像这里一样将文本更改为图像(请忽略绿线):
编辑。我用的是 Winforms。
最佳答案
广告 1。
无法自动调整标签页的宽度以适应您想要的宽度,因此您只能通过一些数学运算来实现。
广告 2。
首先,您必须创建一个 ImageList
对象,然后将其传递给您的 TabControl
:
ImageList il = new ImageList();
il.Images.Add("your_graphics_name", Image.FromFile(@"C:\Graphics\example.png"));
(...)
yourTabControl.ImageList = il;
然后您可以通过给它的键从您的标签页上的图像列表中设置特定图像:
yourTabControl.TabPages.Add("title", "text", "your_graphics_name");
关于c# - 如何在 TabControl 中更改大小和图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13953792/