简体   繁体   English

将复选框添加到TabControl(WinForms)中的Tab头中

[英]Adding CheckBoxes to a Tab header in TabControl (WinForms)

I would like to add checkboxes to the place (don't know the formal name) where the text representing the tab appears. 我想在代表标签的文本出现的地方(不知道正式名称)添加复选框。 I am attaching a sample image of how I want it to look like: 我正在附上我希望它看起来像的示例图像:

在此处输入图片说明

Does anyone know how I might be able to achieve this? 有谁知道我怎么能做到这一点? Feel free to use any .NET language that you are comfortable with - I can easily translate to what I need. 随意使用任何您喜欢的.NET语言-我可以轻松地转换为我需要的语言。

If I had to do this now, I would code 如果我现在必须这样做,我会编写代码

  • A class "myTab inherits System.Windows.FormsTabControl". 类“ myTab继承System.Windows.FormsTabControl”。
  • Add a "Protected Overrides Sub WndProc" to capture the WM_PAINT message, in order to perform a custom paint. 添加一个“ Protected Overrides Sub WndProc”以捕获WM_PAINT消息,以便执行自定义绘制。

But I would sure try things like that, before: WinForms TabControl - Add New Tab Button (+) 但是我肯定会尝试类似的事情,然后再执行以下操作: WinForms TabControl-添加新的Tab按钮(+)

or 要么

http://www.codeproject.com/Articles/91387/Painting-Your-Own-Tabs-Second-Edition http://www.codeproject.com/Articles/91387/Painting-Your-Own-Tabs-Second-Edition

I am thinking a HACKEY way to do this is to use the escape character for "checked" checkbox and "unchecked" checkbox in the tab HEADER string. 我在想,这样做的HACKEY方式是对HEADER标签中的“选中”复选框和“未选中”复选框使用转义字符。 (Don't know if this will work yet). (不知道这是否行得通)。 When the user's mouse is clicked on the "unchecked" checkbox character then change the character to a "checked" checkbox or vice versa. 当用户的鼠标单击“未选中”复选框字符时,然后将该字符更改为“选中”复选框,反之亦然。 Just simulating the checkbox checked/unchecked visual. 只是模拟复选框选中/未选中的视觉效果。 There must be a cleaner way to do this. 必须有一种更清洁的方法来执行此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM