Exemple #1
0
        public DNDForm()
        {
            test_name          = new Label();
            test_name.Location = new Point(5, 5);
            test_name.AutoSize = true;
            test_name.Font     = new Font(Font, FontStyle.Bold | Font.Style);
            test_name.Text     = Text;

            instructions_tb            = new TextBox();
            instructions_tb.Multiline  = true;
            instructions_tb.ScrollBars = ScrollBars.Vertical;
            instructions_tb.Location   = new Point(5, test_name.Bottom + 5);
            instructions_tb.Size       = new Size(460, 180);

            drag_control               = new DragDropControl();
            drag_control.Location      = new Point(5, instructions_tb.Bottom + 10);
            drag_control.Size          = new Size(220, 180);
            drag_control.BackColor     = Color.LightYellow;
            drag_control.DragDropColor = Color.Yellow;
            drag_control.Text          = "Drag Control";
            drag_control.DoDrag        = true;

            drop_control               = new DragDropControl();
            drop_control.Location      = new Point(drag_control.Right + 20, instructions_tb.Bottom + 10);
            drop_control.Size          = new Size(220, 180);
            drop_control.BackColor     = Color.LightGreen;
            drop_control.DragDropColor = Color.Green;
            drop_control.Text          = "Drop Control";
            drop_control.AllowDrop     = true;

            Controls.AddRange(new Control [] { test_name, instructions_tb, drag_control, drop_control });

            Size = new Size(480, 440);
        }
Exemple #2
0
        void DragControl_QueryContinueDrag(object sender, QueryContinueDragEventArgs e)
        {
            DragDropControl c = (DragDropControl)sender;
            DNDForm         f = (DNDForm)c.Parent;

            if (f.DropControl.EnterFiredCount == 0)
            {
                return;
            }

            // Cancel dnd operation AFTER we have reached the drop control
            if (query_counter++ >= 32)
            {
                e.Action = DragAction.Cancel;
            }
        }
		public DNDForm ()
		{
			test_name = new Label ();
			test_name.Location = new Point (5, 5);
			test_name.AutoSize = true;
			test_name.Font = new Font (Font, FontStyle.Bold | Font.Style);
			test_name.Text = Text;

			instructions_tb = new TextBox ();
			instructions_tb.Multiline = true;
			instructions_tb.ScrollBars = ScrollBars.Vertical;
			instructions_tb.Location = new Point (5, test_name.Bottom + 5);
			instructions_tb.Size = new Size (460, 180);

			drag_control = new DragDropControl ();
			drag_control.Location = new Point (5, instructions_tb.Bottom + 10);
			drag_control.Size = new Size (220, 180);
			drag_control.BackColor = Color.LightYellow;
			drag_control.DragDropColor = Color.Yellow;
			drag_control.Text = "Drag Control";
			drag_control.DoDrag = true;

			drop_control = new DragDropControl ();
			drop_control.Location = new Point (drag_control.Right + 20, instructions_tb.Bottom + 10);
			drop_control.Size = new Size (220, 180);
			drop_control.BackColor = Color.LightGreen;
			drop_control.DragDropColor = Color.Green;
			drop_control.Text = "Drop Control";
			drop_control.AllowDrop = true;

			Controls.AddRange (new Control [] { test_name, instructions_tb, drag_control, drop_control });

			Size = new Size (480, 440);
		}
Exemple #4
0
        void DragControl_MouseDown(object sender, MouseEventArgs e)
        {
            DragDropControl ctrl = (DragDropControl)sender;

            ctrl.DoDragDrop(ctrl.DragData, ctrl.AllowedEffects);
        }
Exemple #5
0
        void DropControl_DragDrop(object sender, DragEventArgs e)
        {
            DragDropControl c = (DragDropControl)sender;

            c.ResetEventCounters();
        }