473,379 Members | 1,317 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Visual effects with DragDrop

KS
I have a Button I want to pull to a Label.

I want the Button visualy to move when I pull it.

When I drop the button on the Label I want to test some data coming with the
Button - f.ex is the Button.Text="The right one!".

I have some code that can do the DragDrop-effect BUT this code disables the
visual effect og the Button visualy moving to the Label.

How can I combine the two effects so that when the Button is pulled it is
visualy moved AND when it's dropped on the Label - f.ex the Label.Text is
set to Button.Text ?

KS, Denmark
Nov 22 '05 #1
10 2200
KS
I forgot - it's VB.NET 2002 !

KS, Denmark
Nov 22 '05 #2
Cor
Hi KS,

You can use for that one of the timers
(mostly I don't say that but I think for this system.forms.timer will do it)
(You can drag that from the windows.form toolbox on your form)
Set it to enable and set the tick to 1 or 2
And then use that to change the position on the form do in the timer.tick
event

Button1.Location = New Point(IntegerX, IntegerY)

And add then something (1 is enough) to the Integers in the direction you
want to let it go
(you have to do something for if you want to have it curves, but that is
just trying).

I think it looks nice?

Cor
....
I have a Button I want to pull to a Label.

I want the Button visualy to move when I pull it.

When I drop the button on the Label I want to test some data coming with the Button - f.ex is the Button.Text="The right one!".

I have some code that can do the DragDrop-effect BUT this code disables the visual effect og the Button visualy moving to the Label.

How can I combine the two effects so that when the Button is pulled it is
visualy moved AND when it's dropped on the Label - f.ex the Label.Text is
set to Button.Text ?

KS, Denmark

Nov 22 '05 #3
KS
Thanks for the idea but it don't work very well.

I want the button to follow the mousepointer and it seems as though the sign
for DragDrop-effect COPY is disabled by the following button - the COPY-sign
is momentarily to see ...

No, it don't look very nice.

KS, Denmark
Nov 22 '05 #4
Cor
HI KS

No, it don't look very nice.

With me it did

Cor
Nov 22 '05 #5
KS
It did ?

It LOOKs good enough but it wont work !

With me it looks like the 'following button' disables the
DragDrop-functions - the DragDrop just don't work !

KS
Nov 22 '05 #6
Cor
Hi KS,

If you dont send any part of code, it will be imposible to get an impression
what you are doing for others.

And not a total program but just the essentials.

Cor

With me it looks like the 'following button' disables the
DragDrop-functions - the DragDrop just don't work !

Nov 22 '05 #7
KS
I think I must accept NOT to visualy move the button while I'm pulling it
and then focus on getting the DragDrop to work - and it works fine !

But if I can drag and drop the Button as an OBJECT to the label I think I
can move the Button afterwards.

I know in this sample I just can reference the Button directly but in my
application I want to work on with the object that was DROPPED on the
label - the WHOLE object - how can I do that ?

In the MouseDown-event it IS posible to Drag an whole object - and CAN write
(without getting any syntax error):

Private Sub Button1_MouseDown(ByVal sender As Object, _
ByVal e As
System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown
If e.Button = MouseButtons.Left Then
Button1.DoDragDrop(Button1, DragDropEffects.Move) ' Here it is -
the whole object Button1 !!!!!!!!!
End If
End Sub

But what skall I do in:

Private Sub Label1_DragEnter(ByVal sender As Object, _
ByVal e As
System.Windows.Forms.DragEventArgs) Handles Label1.DragEnter
If (e.Data.GetDataPresent(DataFormats.Text ) Then ' How shall I test if
the whole object is present ?
e.Effect = DragDropEffects.Move
End If
End Sub

And when I drop:

Private Sub label1_DragDrop(ByVal sender As Object, _
ByVal e As
System.Windows.Forms.DragEventArgs) Handles Label1.DragDrop
If e.Data.GetData(DataFormats.Text).ToString = "Button1" Then ' What
shall I write here ? - I think like this:
'If <dropped object>.text="Butten1" then
' but the <dropped object> is the problem !
' this CAN move the Button - but the Button is referenced directly
!!!
Button1.Location = PointToClient(MousePosition)
Button1.BringToFront()
' I'm think something like this:
' <dropped object>.Location = PointToClient(MousePosition)
' <dropped object>.BringToFront()
' but how can I get this <dropped object> ?
MessageBox.Show("Yes - it worked !")
End If
End Sub

Hope you can read my 'thinking' !

KS, Denmark
Nov 22 '05 #8
KS
Can or shall I just drag an drop a REFERENCE (or pointer) to the Button1 - I
think the .NET CAN do this for me - right ?

How ?

KS, Danmark

"KS" <ke************@os.dk> skrev i en meddelelse
news:ub**************@tk2msftngp13.phx.gbl...
I think I must accept NOT to visualy move the button while I'm pulling it
and then focus on getting the DragDrop to work - and it works fine !

But if I can drag and drop the Button as an OBJECT to the label I think I
can move the Button afterwards.

I know in this sample I just can reference the Button directly but in my
application I want to work on with the object that was DROPPED on the
label - the WHOLE object - how can I do that ?

In the MouseDown-event it IS posible to Drag an whole object - and CAN write (without getting any syntax error):

Private Sub Button1_MouseDown(ByVal sender As Object, _
ByVal e As
System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown
If e.Button = MouseButtons.Left Then
Button1.DoDragDrop(Button1, DragDropEffects.Move) ' Here it is -
the whole object Button1 !!!!!!!!!
End If
End Sub

But what skall I do in:

Private Sub Label1_DragEnter(ByVal sender As Object, _
ByVal e As
System.Windows.Forms.DragEventArgs) Handles Label1.DragEnter
If (e.Data.GetDataPresent(DataFormats.Text ) Then ' How shall I test if the whole object is present ?
e.Effect = DragDropEffects.Move
End If
End Sub

And when I drop:

Private Sub label1_DragDrop(ByVal sender As Object, _
ByVal e As
System.Windows.Forms.DragEventArgs) Handles Label1.DragDrop
If e.Data.GetData(DataFormats.Text).ToString = "Button1" Then ' What shall I write here ? - I think like this:
'If <dropped object>.text="Butten1" then
' but the <dropped object> is the problem !
' this CAN move the Button - but the Button is referenced directly
!!!
Button1.Location = PointToClient(MousePosition)
Button1.BringToFront()
' I'm think something like this:
' <dropped object>.Location = PointToClient(MousePosition)
' <dropped object>.BringToFront()
' but how can I get this <dropped object> ?
MessageBox.Show("Yes - it worked !")
End If
End Sub

Hope you can read my 'thinking' !

KS, Denmark

Nov 22 '05 #9
Cor
Hi KS,

I cannot get what you are doing.
Are you trying to put a button on a label, so it can be pushed from that
label?

Or just the text from that button?

Cor
Nov 22 '05 #10
KS
I'm tring to drag a button to drop it on a label - when I depress the
mousebutton I
want some data from the button to be shown in a Msgbox (or just in the
label.text).

I can get the ordinary DragDrop sequense to function - but I think this
method is limited
to some text and some other types but NOT objects!

I want to drop a WHOLE OCJECT (or a pointer to an object) so that I can work
with THE WHOLE object
in the DragDrop-event.

In my simplefied sample code I 'think' it as a <dropped object> (in this
example a Button) so that I can do somethink like

<dropped object>.Location= new point(50,50)
<dropped object>.Text = "Just moved !"
ect
ect

instead of referencing the Button1 directly with Button1.Text="Just mobed !"

In the application where I plan to use this specified DragDrop-sequence I
can NOT reference the Button directly - that's why.

Do you get it ?

KS, Denmark
Nov 22 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Kate | last post by:
Hi: I have a form with a picture box and some command buttons to make certain shapes appear in the picture box. The shapes are drawn on blank UserControls added like this: 'at top of form...
10
by: KS | last post by:
I have a Button I want to pull to a Label. I want the Button visualy to move when I pull it. When I drop the button on the Label I want to test some data coming with the Button - f.ex is the...
1
by: KS | last post by:
In want to visualy drag a Button to a Label and when I depress the mousebutton on top of the label I want to show some dato from the Button in a MsgBox - that's my primary goal. I have made a...
0
by: Flack | last post by:
Hello, Is it possible to find out how many methods are listening to a certain event? For example, if a number of methods subscribed to a controls DragDrop event using +=, can I find out how many...
7
by: Victor S. | last post by:
1. What is System.Windows.Forms.VisualStyles.TextMetricsCharacterSet good for? 2. Are the Indic scripts supported? Are all supported scripts fully supported? (for printing and fine measuring)...
0
by: Gene Hubert | last post by:
Well, it seems fundamental to me anyway. Hopefully it is simple enough. The question is for when the source for the dragdrop is a different application that the target for the dragdrop. How...
0
by: Landers | last post by:
I am trying change the effect illustrated in the cursor depending on what node the mouse is currently over. It appears as though you cannot change the dragdrop effects outside of the dragging...
3
by: Gary Dunne | last post by:
I'm writing an app that requires drag and drop operation between a ListView and a TreeView control. (The source is the ListView). During the drag drop operation I want to be able to detect the...
7
by: JohnR | last post by:
I am using dragdrop to drag and drop a custom class instance. When I drag/drop from one window to another window in the same application everything works fine. But when trying to move between the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.