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="Th e 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 10 2224
I forgot - it's VB.NET 2002 !
KS, Denmark
Hi KS,
You can use for that one of the timers
(mostly I don't say that but I think for this system.forms.ti mer 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.Locatio n = 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="Th e 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
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
HI KS No, it don't look very nice.
With me it did
Cor
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
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 !
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_MouseDo wn(ByVal sender As Object, _
ByVal e As
System.Windows. Forms.MouseEven tArgs) Handles Button1.MouseDo wn
If e.Button = MouseButtons.Le ft Then
Button1.DoDragD rop(Button1, DragDropEffects .Move) ' Here it is -
the whole object Button1 !!!!!!!!!
End If
End Sub
But what skall I do in:
Private Sub Label1_DragEnte r(ByVal sender As Object, _
ByVal e As
System.Windows. Forms.DragEvent Args) Handles Label1.DragEnte r
If (e.Data.GetData Present(DataFor mats.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.DragEvent Args) Handles Label1.DragDrop
If e.Data.GetData( DataFormats.Tex t).ToString = "Button1" Then ' What
shall I write here ? - I think like this:
'If <dropped object>.text="B utten1" then
' but the <dropped object> is the problem !
' this CAN move the Button - but the Button is referenced directly
!!!
Button1.Locatio n = PointToClient(M ousePosition)
Button1.BringTo Front()
' I'm think something like this:
' <dropped object>.Locatio n = PointToClient(M ousePosition)
' <dropped object>.BringTo Front()
' 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
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******** ******@tk2msftn gp13.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_MouseDo wn(ByVal sender As Object, _ ByVal e As System.Windows. Forms.MouseEven tArgs) Handles Button1.MouseDo wn If e.Button = MouseButtons.Le ft Then Button1.DoDragD rop(Button1, DragDropEffects .Move) ' Here it is - the whole object Button1 !!!!!!!!! End If End Sub
But what skall I do in:
Private Sub Label1_DragEnte r(ByVal sender As Object, _ ByVal e As System.Windows. Forms.DragEvent Args) Handles Label1.DragEnte r If (e.Data.GetData Present(DataFor mats.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.DragEvent Args) Handles Label1.DragDrop If e.Data.GetData( DataFormats.Tex t).ToString = "Button1" Then '
What shall I write here ? - I think like this: 'If <dropped object>.text="B utten1" then ' but the <dropped object> is the problem ! ' this CAN move the Button - but the Button is referenced directly !!! Button1.Locatio n = PointToClient(M ousePosition) Button1.BringTo Front() ' I'm think something like this: ' <dropped object>.Locatio n = PointToClient(M ousePosition) ' <dropped object>.BringTo Front() ' 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
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 module
Dim WithEvents tc As testControl
'button1_click (for example)
|
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 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.
|
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 simple sample code - a form with a Button1, a Label1 and a
Timer1.
The Button1 has Tag="SomeData", the Label1 has AllowDrop=True and the Timer1
has an Interval=20.
|
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 methods in total are listening to the
DragDrop event of the control?
If I can't find out the exact number of methods listening to the DragDrop
event, can I somehow remove all listeners of that event at once? I tried
using m_Control.DragDrop =...
|
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)
Is the printing done by GDI++ without using Unicribe?
3. Is the Text.Encoder/Decoder provided by the OS or by the Framework?
| |
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 does the source for
the dragdrop operation know that a drop has been completed onto a
valid target? And then, how does the source know what the drop target
is?
I've got dragdrop working within my application but I can't see any
|
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 and dropping events of the treeview. Please prove me wrong!
Has anyone done this? If so, could you post a snippet please?
L
|
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 target node in the treeview and
auto expand it if applicable... but after a fair bit of head scratching I
can't find any easy way to accomplish this.
I think what i really need is the equivalent of the HitTest method from the
COM version of the...
|
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 same windows
running in different instances of the application the "dropped" data comes
across as a system.__ComObject and I can't CType it to my class to extract
the data. I've been searching for hours and haven't found any solution so
I am...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |