如何在TabControl中更改大小和图像 [英] How to change size and image in TabControl

查看:185
本文介绍了如何在TabControl中更改大小和图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的 TabControl 中更改 TabPage 的大小,

I want to change size of TabPage in my TabControl,

每个标签页应位于一行中,且不能滚动。

each tab should be in one line without scroll.

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

the second question is about how to change Text into Image like here (Please, ignore the green line):

编辑。我使用Winforms。

edit. I used Winforms.

推荐答案

广告1。

没有调整标签页宽度以自动适应所需宽度的方法,因此您只需做一些数学即可实现。

There is no way to adjust width of tab pages to fit width you want automatically, so you just have to do some maths to achieve this.

Ad2。

首先,您必须创建一个 ImageList 对象,然后将其传递给您的 TabControl

First you have to create an ImageList object, which you will then pass to your TabControl:

ImageList il = new ImageList();
il.Images.Add("your_graphics_name", Image.FromFile(@"C:\Graphics\example.png"));
(...)
yourTabControl.ImageList = il;

然后,您可以在标签页的图像列表中输入密钥来设置特定图像:

Then you can set specific image from your image list on your tab page by giving it's key:

yourTabControl.TabPages.Add("title", "text", "your_graphics_name");

这篇关于如何在TabControl中更改大小和图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆