private static Bitmap GetAsBitmapSnapshot( DraggableLayoutControlItem draggableItem, Point offset, Size size) { RadElement associatedItem = (RadElement)draggableItem.AssociatedItem; if (associatedItem.ElementState != ElementState.Loaded) { return((Bitmap)null); } if (size.Width <= 0 || size.Height <= 0) { return((Bitmap)null); } LayoutControlDraggableOverlay control = draggableItem.ElementTree.Control as LayoutControlDraggableOverlay; if (control == null) { return((Bitmap)null); } Bitmap cachedSnapshot = control.CachedSnapshot; Bitmap bitmap = new Bitmap(size.Width, size.Height); using (Graphics graphics = Graphics.FromImage((Image)bitmap)) { Rectangle boundingRectangle = associatedItem.ControlBoundingRectangle; boundingRectangle.Offset(offset); boundingRectangle.Size = size; graphics.DrawImage((Image)cachedSnapshot, new Rectangle(Point.Empty, size), boundingRectangle, GraphicsUnit.Pixel); } return(bitmap); }
public LayoutControlDragDropService( RadLayoutControl owner, LayoutControlDraggableOverlay overlay) { this.owner = owner; this.overlay = overlay; try { Bitmap bitmap = new Bitmap(typeof(LayoutControlDragDropService).Assembly.GetManifestResourceStream("Telerik.WinControls.UI.RadLayoutControl.Editing.Remove.png")); this.deleteCursor = new Cursor(bitmap.GetHicon()); bitmap.Dispose(); } catch { } }
protected virtual void HandleDropOnEmptyContainer( DraggableLayoutControlOverlayElement overlayElement, BaseListViewVisualItem draggedItem) { LayoutControlDraggableOverlay control = overlayElement.ElementTree.Control as LayoutControlDraggableOverlay; LayoutControlItemBase layoutControlItemBase; if (draggedItem.Data.Group == this.hiddenItemsGroup) { LayoutControlItemBase tag = draggedItem.Data.Tag as LayoutControlItemBase; if (tag == null) { return; } this.layoutControl.HiddenItems.Remove((RadItem)tag); layoutControlItemBase = tag; } else { layoutControlItemBase = this.CreateNewItem(draggedItem); } control.Owner.Items.Add((RadItem)layoutControlItemBase); control.Owner.ContainerElement.RebuildLayoutTree(); }