c# - 如何在 TabControl 中更改大小和图像

标签 c# user-interface size tabcontrol designer

我想在我的 TabControl 中更改 TabPage 的大小,enter image description here

每个选项卡应排成一行,不能滚动。

第二个问题是关于如何像这里一样将文本更改为图像(请忽略绿线):

enter image description here

编辑。我用的是 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/

相关文章:

android - 如何在 WallpaperService 中设置 webview 的大小?

javascript - 分配多个元素随机大小和随机位置,同时遵循连续的 div 顺序

html - 如何在边界半径变化时停止元素移动?

c# - ASP.NET HttpServerUtility.Transfer 如何中断控制流?

c# - 使用 MemoryStream 写出到 XML

user-interface - 如何在没有GUI的情况下运行MATLAB并获得图形结果?

javascript - 如何用单选按钮点击填充 Jquery UI 进度条

iOS 我应该为大文本使用 UILabel

c# - GeoJson c# example 解析世界各国并为每个国家生成Geojson

c# - 检查自签名证书(SSL、C#)