コード例 #1
0
 private void paintPanle1_DragDrop(object sender, DragEventArgs e)
 {
     string itemtype = e.Data.GetData(typeof(string)).ToString();
     if (itemtype == "A")
     {
         Point lefttoppoint = this.PointToScreen(this.paintPanle1.Location);
         PaintUnit item = new PaintUnit("未命名", FlowChartDemo.Properties.Resources.ContactFlow,
             ItemStatus.Actived,
             new Point(e.X - lefttoppoint.X - FlowChartDemo.Properties.Resources.ContactFlow.Width / 2,
                 e.Y - lefttoppoint.Y - FlowChartDemo.Properties.Resources.ContactFlow.Height / 2), new Pen(Color.Gray), this.Font);
         this.paintPanle1.PaintItems.Add(item);
         this.paintPanle1.Refresh();
     }
     else if (itemtype == "B")
     {
         Point lefttoppoint = this.PointToScreen(this.paintPanle1.Location);
         PaintUnit item = new PaintUnit("未命名", FlowChartDemo.Properties.Resources.GMail,
             ItemStatus.Actived,
             new Point(e.X - lefttoppoint.X - FlowChartDemo.Properties.Resources.GMail.Width / 2,
                 e.Y - lefttoppoint.Y - FlowChartDemo.Properties.Resources.GMail.Height / 2), new Pen(Color.Gray), this.Font);
         this.paintPanle1.PaintItems.Add(item);
         this.paintPanle1.Refresh();
     }
     else if (itemtype == "C")
     {
         Point lefttoppoint = this.PointToScreen(this.paintPanle1.Location);
         PaintUnit item = new PaintUnit("未命名", FlowChartDemo.Properties.Resources.Phone,
             ItemStatus.Actived,
             new Point(e.X - lefttoppoint.X - FlowChartDemo.Properties.Resources.Phone.Width / 2,
                 e.Y - lefttoppoint.Y - FlowChartDemo.Properties.Resources.Phone.Height / 2), new Pen(Color.Gray), this.Font);
         this.paintPanle1.PaintItems.Add(item);
         this.paintPanle1.Refresh();
     }
 }
コード例 #2
0
        private void paintPanle1_DragDrop(object sender, DragEventArgs e)
        {
            string itemtype = e.Data.GetData(typeof(string)).ToString();

            if (itemtype == "A")
            {
                Point     lefttoppoint = this.PointToScreen(this.paintPanle1.Location);
                PaintUnit item         = new PaintUnit("未命名", FlowChartDemo.Properties.Resources.ContactFlow,
                                                       ItemStatus.Actived,
                                                       new Point(e.X - lefttoppoint.X - FlowChartDemo.Properties.Resources.ContactFlow.Width / 2,
                                                                 e.Y - lefttoppoint.Y - FlowChartDemo.Properties.Resources.ContactFlow.Height / 2), new Pen(Color.Gray), this.Font);
                this.paintPanle1.PaintItems.Add(item);
                this.paintPanle1.Refresh();
            }
            else if (itemtype == "B")
            {
                Point     lefttoppoint = this.PointToScreen(this.paintPanle1.Location);
                PaintUnit item         = new PaintUnit("未命名", FlowChartDemo.Properties.Resources.GMail,
                                                       ItemStatus.Actived,
                                                       new Point(e.X - lefttoppoint.X - FlowChartDemo.Properties.Resources.GMail.Width / 2,
                                                                 e.Y - lefttoppoint.Y - FlowChartDemo.Properties.Resources.GMail.Height / 2), new Pen(Color.Gray), this.Font);
                this.paintPanle1.PaintItems.Add(item);
                this.paintPanle1.Refresh();
            }
            else if (itemtype == "C")
            {
                Point     lefttoppoint = this.PointToScreen(this.paintPanle1.Location);
                PaintUnit item         = new PaintUnit("未命名", FlowChartDemo.Properties.Resources.Phone,
                                                       ItemStatus.Actived,
                                                       new Point(e.X - lefttoppoint.X - FlowChartDemo.Properties.Resources.Phone.Width / 2,
                                                                 e.Y - lefttoppoint.Y - FlowChartDemo.Properties.Resources.Phone.Height / 2), new Pen(Color.Gray), this.Font);
                this.paintPanle1.PaintItems.Add(item);
                this.paintPanle1.Refresh();
            }
        }