Changeset 7342
- Timestamp:
- 01/17/12 12:51:52 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/Controls
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/Controls/DragOverTabControl.Designer.cs
r7259 r7342 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 this.components = new System.ComponentModel.Container(); 48 this.timer = new System.Windows.Forms.Timer(this.components); 47 49 this.SuspendLayout(); 50 // 51 // timer 52 // 53 this.timer.Interval = 500; 54 this.timer.Tick += new System.EventHandler(this.timer_Tick); 48 55 // 49 56 // DragOverTabControl … … 56 63 57 64 #endregion 65 66 private System.Windows.Forms.Timer timer; 58 67 } 59 68 } -
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/Controls/DragOverTabControl.cs
r7259 r7342 25 25 namespace HeuristicLab.MainForm.WindowsForms { 26 26 public partial class DragOverTabControl : TabControl { 27 private int destinationTabIndex; 28 27 29 public DragOverTabControl() { 28 30 InitializeComponent(); 29 31 } 30 32 31 private void DragOverTabControl_DragOver(object sender, DragEventArgs e) {33 private int GetTabIndex() { 32 34 Point position = PointToClient(Control.MousePosition); 33 35 int tabIndex = -1; … … 36 38 tabIndex = i; 37 39 } 40 return tabIndex; 41 } 38 42 39 if (tabIndex != SelectedIndex && tabIndex != -1) 43 private void DragOverTabControl_DragOver(object sender, DragEventArgs e) { 44 int tabIndex = GetTabIndex(); 45 46 if (!timer.Enabled && tabIndex != SelectedIndex && tabIndex != -1) { 47 destinationTabIndex = tabIndex; 48 timer.Start(); 49 } 50 } 51 52 private void timer_Tick(object sender, System.EventArgs e) { 53 timer.Stop(); 54 int tabIndex = GetTabIndex(); 55 56 if (tabIndex == destinationTabIndex && tabIndex != SelectedIndex && tabIndex != -1) { 40 57 SelectedIndex = tabIndex; 41 58 } 42 59 } 43 60 }
Note: See TracChangeset
for help on using the changeset viewer.