TabController控件测试

下载及安装参照:http://www.cnblogs.com/dragon/archive/2005/03/24/124771.html

测试:拖动标签、双击关闭标签

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
'关闭按钮触发
   Private Sub TabController_ClosePressed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabController.ClosePressed
       MsgBox("ClosePressed--" & TabController.SelectedTab.Name.ToString)
   End Sub
 
 
 
   'Tab Drag and Drop
   Dim TabDragging As Boolean
 
   Private Sub TabController_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabController.MouseLeave
       If TabDragging = True Then
           'Debug.Print("stop drag")
           TabDragging = False
           Me.Cursor = Cursors.Default
       End If
   End Sub
 
   Private Sub TabController_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TabController.MouseMove
       If e.Button = Windows.Forms.MouseButtons.Left Then
           'Debug.Print("dragging")
           TabDragging = True
           Me.Cursor = Cursors.SizeWE
       ElseIf e.Button = Windows.Forms.MouseButtons.None Then
           If TabDragging = True Then
               'Debug.Print("stop drag")
               TabDragging = False
               Me.Cursor = Cursors.Default
           End If
       End If
   End Sub
 
   Private Sub TabController_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TabController.MouseUp
       If e.Button = Windows.Forms.MouseButtons.Left Then
           If TabDragging = True Then
               Dim sourceTab As Crownwood.Magic.Controls.TabPage = TabController.SelectedTab
               Dim targetTab As Crownwood.Magic.Controls.TabPage = TabController.TabPageFromPoint(e.Location)
               Dim targetIndex As Integer = -1
 
               For i = 0 To TabController.TabPages.Count - 1
                   If TabController.TabPages(i) Is targetTab Then
                       targetIndex = i
                   End If
               Next
 
               If sourceTab IsNot targetTab And targetIndex > -1 Then
                   TabController.TabPages.Remove(sourceTab)
                   TabController.TabPages.Insert(targetIndex, sourceTab)
                   TabController.SelectedTab = sourceTab
               End If
           End If
       ElseIf e.Button = Windows.Forms.MouseButtons.Middle Then
           If TabDragging = False Then
               '   Tabs.Action.CloseActiveTab()
           End If
       End If
   End Sub
 
 
   '双击标签触发
   Public Sub TabController_DoubleClickTab(ByVal sender As Crownwood.Magic.Controls.TabControl, ByVal page As Crownwood.Magic.Controls.TabPage) Handles TabController.DoubleClickTab
       MsgBox("DoubleClickTab--" & page.Name.ToString)
   End Sub

 

posted @   大力  阅读(373)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· 什么是nginx的强缓存和协商缓存
· 一文读懂知识蒸馏
· Manus爆火,是硬核还是营销?
点击右上角即可分享
微信分享提示