Example #1
0
 private void IdeCanvas_DragOver(object sender, DragEventArgs e)
 {
     Point mouse = new Point(e.X, e.Y);
     mouse = this.PointToClient(mouse);
     mouse.Offset(panDisplacement);
     List<Classes.ICodeBlock> actions = new List<Classes.ICodeBlock>();
     actions.Add(page as Classes.Task);
     insertionPoint = CheckBlock(mouse, actions);
     if (insertionPoint != null)
         e.Effect = DragDropEffects.Copy;
     else
         e.Effect = DragDropEffects.None;
     actions.Clear();
     Invalidate();
     this.Update();
 }
Example #2
0
        private void IdeCanvas_DragDrop(object sender, DragEventArgs e)
        {
            //insert at insertion point...
            Console.WriteLine(e.Data.ToString());
            string data = (string)e.Data.GetData(typeof(string));
            data = data.Remove(0, Global.DragDropIdent.Length);
            if (data == "while")
                page.InsertBlock(insertionPoint, new Classes.GenericCodeElement("While", "while (true)\r\n{\r\n{CODE}}", Color.GreenYellow, true));
            else if (data == "USInit")
                page.InsertBlock(insertionPoint, new Classes.GenericCodeElement("Set Ultrasonic Sensor (Port 1)", "SetSensorUltrasonic(S1);", Color.LightBlue));

            insertionPoint = null;
            Invalidate();
        }