private void dragDrop(object sender, DragEventArgs e) { if (!e.Data.GetDataPresent("Text")) { return; } string str = e.Data.GetData("Text") as string; if (!str.Equals("MovedEditor")) { return; } TextBox tf = new MovedTextBox(); int x = 0, y = 0; FormTools.GetCoordinates(control, ref x, ref y); tf.Left = e.X - x; tf.Top = e.Y - y; control.Controls.Add(tf); }
private void dragDrop(object sender, DragEventArgs e) { if (!e.Data.GetDataPresent("Text")) { return; } string str = e.Data.GetData("Text") as string; if (!str.Equals("MovedPicture")) { return; } PictureBox box = new MovedPictureBox(); int x = 0, y = 0; FormTools.GetCoordinates(control, ref x, ref y); box.Left = e.X - x; box.Top = e.Y - y; box.Image = ResourceImage.CommentPicture.ToBitmap(); control.Controls.Add(box); }