public void DrawConnection(MouseEventArgs e) { if (e.Button == MouseButtons.Left) { setPointA = new Point(rectangleShape4.Location.X, rectangleShape4.Location.Y); } Refresh(); SingletonForm.getFormInstance().DrawOnForm(setPointA, this); }
private void rectangleShape4_MouseClick(object sender, MouseEventArgs e) { newInputRectangle newInputRect = new newInputRectangle(); newRect = newInputRect; SingletonForm.getFormInstance().Controls.Add(newInputRect); // int xPosition = this.rectangleShape4.Location.X + this.rectangleShape4.Parent.Location.X; //int yPosition = this.rectangleShape4.Location.Y + this.rectangleShape4.Parent.Location.Y; // Point p = rectangleShape4.Parent.PointToScreen(rectangleShape4.Location); //newInputRect.Location = new Point((Cursor.Position.X - xPosition), (Cursor.Position.Y - yPosition)); newInputRect.Location = OurLocation; newInputRect.BringToFront(); this.DrawConnection(e); }