如何将按钮添加到 Winforms 中 TabControl 的空白区域?
从 WPF 中的类似问题中获取了图像。基本上我希望额外的按钮可以执行不同的操作,而不是创建或删除选项卡。与当前选项卡相关的操作对于单个 TabControl 中的所有选项卡都是相同的。
当我尝试将按钮放在该区域时,视觉工作室设计师将我的控制扔回原来的位置。它不允许我在那里放任何东西。
这可以做到吗?
替代文本 http://www.freeimagehosting.net/uploads/92ca1b0a8c.png
< a href="http://www.freeimagehosting.net/uploads/ff0d08e0ed.png" rel="nofollow noreferrer">替代文本 http://www.freeimagehosting.net/uploads/ff0d08e0ed.png
Grabbed the images from a similar question in WPF. Basically I want the extra buttons to do different things, not create or delete tabs. Actions related to the current tab which are gonna be the same for all the tabs in a single TabControl.
When I try to place my buttons on that area, the visual studio designer throws my control away, back to their original position. It doesn't allow me to put anything there.
Can this be done?
alt text http://www.freeimagehosting.net/uploads/92ca1b0a8c.png
alt text http://www.freeimagehosting.net/uploads/ff0d08e0ed.png
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
特别是为了视觉体验,我只需创建一个带有标题“+”的单独选项卡,并在切换时添加一些逻辑 - 这样它将执行一些其他操作而不是切换。我想,使用多个选项卡也可以完成同样的操作。
更新
实际代码:
For specifically that visual experience I'd just create a separate tab with header "+" and add some logic on switching to it - so it will perform some other action instead of switching. The same can be done with multiple tabs I guess.
UPDATE
Actual code for this:
所以看起来他们在这里使用选项卡作为按钮。我想象他们让选项卡控件索引更改事件将新选项卡触发到选项卡控件中并强制将焦点集中到它。
So it looks like they are using a tab as a button here. I would imagine they have the tab controls index change event fire a new tab into the tab control and force focus to it.