Drag and Drop

  • Thread starter Thread starter cody
  • Start date Start date
C

cody

I need to implement some kind of panel where the user can put rectangles on
it, move them around and resize them. Is there an API for that or do I have
to code the whole stuff by myself? I don't know anything about drag&drop
yet.
 
Hi Cody,

I needed to drag picture boxes around a panel. I had success using the
following code. Being new to VB.Net I'm still trying to find out how to
resize controls at runtime. Haven't received msg board answers for that one
yet. Hope you do!

Good luck,
Nancy

Private dragging As Boolean = False
Private miceDown As New Point(0, 0)

Private Sub Terminal_MouseDown(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs)

If (e.Button = MouseButtons.Left) Then
dragging = True
miceDown.X = -e.X
miceDown.Y = -e.Y
End If

End Sub

Private Sub Terminal_MouseMove(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs)

If (MouseButtons.Left And dragging) Then
Dim MPosition As New Point
MPosition = MousePosition
MPosition.Offset(miceDown.X, miceDown.Y)
sender.Location = pnlDesignArea.PointToClient(MPosition)
sender.Invalidate()
End If

End Sub

Private Sub Terminal_MouseUp(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs)

If (MouseButtons.Left And dragging) Then
dragging = False
End If

End Sub
 
I needed to drag picture boxes around a panel. I had success using the
following code. Being new to VB.Net I'm still trying to find out how to
resize controls at runtime. Haven't received msg board answers for that one
yet. Hope you do!


Thank you, But I was hoping there is an simpler way.
For your problem:
When the mouse is down on a corner of the Control where resizing is allowed
(arrow cursor)for the first time, store the mouse position in a variable.
when the user now moves the mouse with pressed button,
then do something like the following:

myControl.Width -= storedPoint.X - e.X;
myControl.Height -= storedPoint.Y - e.Y;

where e is the argument passed to the mousemove eventhandler.
 
Cody & Nancy
But I was hoping there is an simpler way.

There is.
I have an EASY solution for you.

Our MetaDraw control is specifically designed for
this kind of application - it is EASY EASY EASY.

I can send you a sample project that will meet
your needs in minutes.

MetaDraw will allow you to drag pictures, rectangles,
other shapes, or text around within a single control window.
When user selects an element he / she will see it selected.
Just 1 line of code to allow user to drag, and resize.
( With a 2nd line you can limit user to drag only )
You can also let user zoom, and scroll, rotate,
draw additional shapes or images.

The entire layout may be saved and reloaded.
The entire layout may be printed
The entire layout may be Zoomed and Scrolled
( in fact it will scroll automatically as
user drags elements around )


Drop me a note if this sounds interesting to you.

I'd be happy to send additional information,
get you an installation kit for evaluation and
answer any questions you may have about MetaDraw.

* * Please include a copy of this note with your reply

Jeff Bennett
(e-mail address removed)

Bennet-Tec Information Systems, Inc
50 Jericho Tpk, Jericho, NY 11753
Phone 516 997 5596, Fax - 5597
WWW.Bennet-Tec.Com

RELIABLE Component Software
and Software Development Services
* TList/Pro * ALLText HT/Pro * MetaDraw *

====================== ======================

From: cody ([email protected])
Subject: Drag and Drop
Newsgroups: microsoft.public.dotnet.framework.drawing,
microsoft.public.dotnet.framework.windowsforms
Date: 2004-02-23 12:47:18 PST


Thank you, But I was hoping there is an simpler way.

.. . . .

================

From: Nancy ([email protected])
Subject: Re: Drag and Drop
Newsgroups: microsoft.public.dotnet.framework.drawing,
microsoft.public.dotnet.framework.windowsforms
Date: 2004-02-23 10:45:42 PST

Hi Cody,

I needed to drag picture boxes around a panel. I had success using the
following code. Being new to VB.Net I'm still trying to find out how
to
resize controls at runtime. Haven't received msg board answers for
that one yet. Hope you do!

Good luck,
Nancy

.. . . . . ( code extract )

================
From: cody ([email protected])
Date: 2004-02-23 09:42:57 PST


I need to implement some kind of panel where the user can
put rectangles on it, move them around and resize them.
Is there an API for that or do I have to code the whole
stuff by myself?
I don't know anything about drag&drop yet.

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk

========================
 
VG.net has an API that makes this easy, and the run-time will be free.

Regards,
Frank Hileman
Prodige Software Corporation

check out VG.net: www.vgdotnet.com
Animated vector graphics system
Integrated VS.net graphics editor
 
VG.NET is a great product. For a Visio style different approach try ERM3

James
 
Back
Top