将图像添加到 TabControl 上的其中一个选项卡会阻止我的选项卡文本
在 Windows XP 上使用 Visual Studio 2005 (vb.net)(Windows 窗体),我有一个标准的 Microsoft TabControl。
单击按钮可从 1 个选项卡添加/删除图像。
似乎图像被放置在我的选项卡文本上方,使其无法读取。 为什么它不像它应该的那样:左边的图像。接下来是右侧的文字。
为什么图像被放置在我的选项卡文本之上?我是否需要进行某种“刷新”或“重画”才能使其按预期显示?
我没有看到任何方法“使图像出现在选项卡的左边缘”。 (不是标签页。)...然后将文本放置在图像的右侧。 (就像普通的图像+文本选项卡一样。)
代码非常简单,它只是从我的 ImageList 中获取图像:
cfgTab.ImageKey = "PadLockClosed.png" ' Show CLOSED PadLock
选项卡的文本从: 更改
This is my tab text
为:
T(IMAGE HERE)is my tab text
图像出现 OVER 的开头我的文字。但是,如果我移至另一个选项卡,然后返回,图像将显示在正确的位置:
(IMAGE HERE) This is my tab text
Using Visual Studio 2005 (vb.net) (windows forms) on Windows XP, I have a standard Microsoft TabControl.
A button click adds/removes an image from 1 of the Tabs.
Seems like the image is placed OVER my tab's text, making it unreadable.
Why isn't it like it should be: Image on the left. Followed by text on the right.
Why is the image being placed OVER my tab's text? Do I need to do some kind of "refresh" or "redraw" before it will appear as it should?
I don't see any way to "make the image appear on the left edge of the tab". (NOT the tab-page.) ... and then place the text just to the right of the image. (Just like a normal image+text tab can do.)
The code is pretty simple, it just gets an image from my ImageList:
cfgTab.ImageKey = "PadLockClosed.png" ' Show CLOSED PadLock
The tab's text changes from:
This is my tab text
to:
T(IMAGE HERE)is my tab text
The image appears OVER the beginning of my text. But if I move to another tab, then move back, the image appears in the correct position:
(IMAGE HERE) This is my tab text
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在 Control 属性上使用停靠和锚定,以便它将根据您希望显示的内容进行放置。
使用 Anchor 管理 WinForm 控件和 Dock 属性
调整 WinForms 中单个控件的
大小
You can use docking and anchoring on your Control property so it will be placed according on what you want it to display.
Manage WinForm controls using the Anchor and Dock properties
Resizing a Single Control In WinForms
Regards