Block coding

Asked

Viewed 78 times

1

I’m trying to develop an application of Block coding. I found it difficult to develop this type of application.

With the events below, I can identify when there is a collision between other controls and drag the controls. However, I could not identify when I "get out" of the collision and when I release the control that I am dragging on top of another, in this case, it should reposition itself in a way that identifies the control tree. In the end, I will create a code based on the added controls.

Am I doing it the right way? Is there any other tool simpler to develop applications of this type?

Mousedown Event

     private void DynamicButton_MouseDown(object sender, MouseEventArgs e)
        {

                if (e.Button == System.Windows.Forms.MouseButtons.Left)
                MouseDownLocation = e.Location;
        }

Mousemove Event

     private void DynamicButton_MouseMove(object sender, MouseEventArgs e)
            {
                Button btn = (Button)sender;

            foreach (Control item in Controls)
            {
                if (btn.Bounds.IntersectsWith(item.Bounds) && (item.Name != btn.Name))
                {
                    item.BackColor = Color.Yellow;



                }
            }


                if (e.Button == System.Windows.Forms.MouseButtons.Left)
                {

                    btn.Left = e.X + btn.Left - MouseDownLocation.X;
                    btn.Top = e.Y + btn.Top - MouseDownLocation.Y;
                }
            }
  • Are you developing in Windows Forms ? Are you developing this from scratch, ie all graphical iterations are you doing ? Wouldn’t it be more interesting to get a component ready ?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.