private void OnSourceGalleryMouseDown(object sender, MouseEventArgs e) { GalleryControl galControl = (GalleryControl)sender; RibbonHitInfo hitInfo = galControl.CalcHitInfo(e.Location); if (hitInfo.InGalleryItem) { dragItemHitInfo = hitInfo; return; } dragItemHitInfo = null; }
private void OnGalleryControlDragOver(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(typeof(List <GalleryItem>))) { e.Effect = DragDropEffects.Move; } GalleryControl gallery = (GalleryControl)sender; RibbonHitInfo hitInfo = gallery.CalcHitInfo(gallery.PointToClient(new Point(e.X, e.Y))); targetHighlightItem = hitInfo.GalleryItem; gallery.Invalidate(); }
private void galleryControl1_MouseDown(object sender, MouseEventArgs e) { GalleryControl gc = sender as GalleryControl; RibbonHitInfo hInfo = gc.CalcHitInfo(e.Location); if (hInfo.InGalleryItem) { dragItemHitInfo = hInfo; ((DXMouseEventArgs)e).Handled = true; return; } dragItemHitInfo = null; }
private void OnGalleryControlMouseDown(object sender, MouseEventArgs e) { GalleryControl gallery = (GalleryControl)sender; RibbonHitInfo hitInfo = gallery.CalcHitInfo(e.Location); if (hitInfo.InGalleryItem) { DragItemHitInfo = hitInfo; DragSource = gallery; } else { DragItemHitInfo = null; } }
private void galleryControl1_DragDrop(object sender, DragEventArgs e) { if (!(e.Data.GetDataPresent(typeof(GalleryItem)))) { return; } GalleryItem draggedItem = e.Data.GetData(typeof(GalleryItem)) as GalleryItem; GalleryControl galControl = (GalleryControl)sender; RibbonHitInfo hitInfo = galControl.CalcHitInfo(galControl.PointToClient(new Point(e.X, e.Y))); if (hitInfo.InGalleryGroup) { draggedItem.GalleryGroup.Items.Remove(draggedItem); hitInfo.GalleryItemGroup.Items.Add((GalleryItem)draggedItem); } dragItemHitInfo = null; galleryControlClient1.Invalidate(); }
private void OnTargetGalleryDragDrop(object sender, DragEventArgs e) { if (!(e.Data.GetDataPresent(typeof(GalleryItem)))) { return; } GalleryItem draggedItem = e.Data.GetData(typeof(GalleryItem)) as GalleryItem; GalleryControl galControl = (GalleryControl)sender; RibbonHitInfo hitInfo = galControl.CalcHitInfo(galControl.PointToClient(new Point(e.X, e.Y))); if (hitInfo.InGalleryGroup) { hitInfo.GalleryItemGroup.Items.Add((GalleryItem)draggedItem.Clone()); } else { int groupIndex = galControl.Gallery.Groups.Add(new GalleryItemGroup()); galControl.Gallery.Groups[groupIndex].Caption = draggedItem.GalleryGroup.Caption; galControl.Gallery.Groups[groupIndex].Items.Add((GalleryItem)draggedItem.Clone()); } }
private void OnGalleryControlDragDrop(object sender, DragEventArgs e) { if (!e.Data.GetDataPresent(typeof(List <GalleryItem>)) || DragSource == null) { return; } GalleryControl dragTarget = (GalleryControl)sender; RibbonHitInfo hitInfo = dragTarget.CalcHitInfo(dragTarget.PointToClient(new Point(e.X, e.Y))); GalleryItem targetItem = hitInfo.GalleryItem; if (targetItem != null) { GalleryItemCollection target = targetItem.GalleryGroup.Items; int index = target.IndexOf(targetItem); List <GalleryItem> draggedItems = (List <GalleryItem>)e.Data.GetData(typeof(List <GalleryItem>)); foreach (GalleryItem item in draggedItems) { GalleryItemCollection source = item.GalleryGroup.Items; source.Remove(item); target.Insert(index++, item); } } targetHighlightItem = null; }