Example #1
0
        private void DragDropService_PreviewDragDrop(object sender, RadDropEventArgs e)
        {
            DiagramListViewVisualItem dragItem   = e.DragInstance as DiagramListViewVisualItem;
            RadDiagramElement         dropTarget = e.HitTarget as RadDiagramElement;

            if (dragItem != null && dropTarget != null && dragItem.Data.Key == "Image")
            {
                e.Handled = true;

                RadDiagramShape shape = dropTarget.Shapes.Last() as RadDiagramShape;
                shape.DiagramShapeElement.Shape = null;
                shape.BackColor = Color.Transparent;


                try
                {
                    OpenFileDialog open = new OpenFileDialog();
                    open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
                    if (open.ShowDialog() == DialogResult.OK)
                    {
                        Bitmap bit = new Bitmap(open.FileName);
                        shape.DiagramShapeElement.Image = bit;
                    }
                }
                catch (Exception)
                {
                    throw new ApplicationException("Failed loading image");
                }


                shape.DiagramShapeElement.ImageLayout = dragItem.ImageLayout;
            }
            ;
        }
Example #2
0
 public MyItemInformationAdorner(RadDiagramElement diagram)
 {
     this.Diagram = diagram;
 }