Changeset 7195
- Timestamp:
- 12/16/11 15:00:24 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Core.Views/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/CheckedItemCollectionView.cs
r6233 r7195 20 20 #endregion 21 21 22 using System.Linq; 22 23 using System.Drawing; 23 24 using System.Windows.Forms; … … 85 86 doubleClick = true; 86 87 } 88 89 protected override void itemsListView_DragEnter(object sender, DragEventArgs e) { 90 validDragOperation = false; 91 if (Locked || ReadOnly) return; 92 93 var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as ICheckedItemCollection<T>; 94 if (data != null) 95 validDragOperation = Content.Select(x => x.ToString()).SequenceEqual(data.Select(x => x.ToString())); 96 else 97 base.itemsListView_DragEnter(sender, e); 98 } 99 100 protected override void itemsListView_DragOver(object sender, DragEventArgs e) { 101 e.Effect = DragDropEffects.None; 102 if (!validDragOperation) return; 103 104 var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as ICheckedItemCollection<T>; 105 if (data != null) 106 e.Effect = DragDropEffects.Copy; 107 else 108 base.itemsListView_DragOver(sender, e); 109 } 110 111 protected override void itemsListView_DragDrop(object sender, DragEventArgs e) { 112 if (e.Effect == DragDropEffects.None) return; 113 var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as ICheckedItemCollection<T>; 114 if (data != null) { 115 for (int i = 0; i < Content.Count; i++) { 116 Content.SetItemCheckedState(Content.ElementAt(i), data.ItemChecked(data.ElementAt(i))); 117 } 118 } else 119 base.itemsListView_DragDrop(sender, e); 120 } 87 121 #endregion 88 122 -
trunk/sources/HeuristicLab.Core.Views/3.3/CheckedItemListView.cs
r6233 r7195 20 20 #endregion 21 21 22 using System.Linq; 22 23 using System.Drawing; 23 24 using System.Windows.Forms; … … 54 55 private Color backupColor = Color.Empty; 55 56 protected override void SetEnabledStateOfControls() { 56 if (backupColor == Color.Empty) backupColor = base.itemsListView.BackColor;57 if (backupColor == Color.Empty) backupColor = base.itemsListView.BackColor; 57 58 base.SetEnabledStateOfControls(); 58 59 if (ReadOnly || Locked) … … 88 89 doubleClick = true; 89 90 } 91 92 protected override void itemsListView_DragEnter(object sender, DragEventArgs e) { 93 validDragOperation = false; 94 if (Locked || ReadOnly) return; 95 96 var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as ICheckedItemList<T>; 97 if (data != null) 98 validDragOperation = Content.Select(x => x.ToString()).SequenceEqual(data.Select(x => x.ToString())); 99 else 100 base.itemsListView_DragEnter(sender, e); 101 } 102 103 protected override void itemsListView_DragOver(object sender, DragEventArgs e) { 104 e.Effect = DragDropEffects.None; 105 if (!validDragOperation) return; 106 107 var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as ICheckedItemList<T>; 108 if (data != null) 109 e.Effect = DragDropEffects.Copy; 110 else 111 base.itemsListView_DragOver(sender, e); 112 } 113 114 protected override void itemsListView_DragDrop(object sender, DragEventArgs e) { 115 if (e.Effect == DragDropEffects.None) return; 116 var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as ICheckedItemList<T>; 117 if (data != null) { 118 for (int i = 0; i < Content.Count; i++) { 119 Content.SetItemCheckedState(Content[i], data.ItemChecked(data[i])); 120 } 121 } else 122 base.itemsListView_DragDrop(sender, e); 123 } 90 124 #endregion 91 125
Note: See TracChangeset
for help on using the changeset viewer.