473,486 Members | 2,181 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Programmatically initiate a drag and drop operation

I am writing a small GUI tool in C#, and I want to experiment some
fancy trick as follows: when the user click on a "OK" button, the code
will initiate a "Drag and Drop" operation in the GUI itself to itself
(i.e. drag some fake object and drop to the tool itself).

I am new to .Net programming, but from my reading can I achieve this
using SendMessage() or PostMessage() to force a "Drag and Drop"
operation?

Thanks in advance,

Ben

May 10 '06 #1
8 10091
Hello be*****@hotmail.com,

Look there http://www.syncfusion.com/faq/windowsforms/default.aspx search
by "drag" keyword and you will find a lot of samples
I am writing a small GUI tool in C#, and I want to experiment some
fancy trick as follows: when the user click on a "OK" button, the code
will initiate a "Drag and Drop" operation in the GUI itself to itself
(i.e. drag some fake object and drop to the tool itself).

I am new to .Net programming, but from my reading can I achieve this
using SendMessage() or PostMessage() to force a "Drag and Drop"
operation?


---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
May 10 '06 #2
Michael,

I did a search in that site, but none of the links answers my question.
They are all "general" drag and drop coding that requires a user to
manually "Drag" and "Drop". My question is how to do the drag and drop
operation without the user even knows about it.
Ben

May 10 '06 #3
If the ok button is clicked and that makes the drag and drop occur, all you
need is a method to do the drag and drop operation and have that called when
ok is clicked?

i presume that does not solve your problem because i doubt you would be
stuck if it did. Could you explain why that would not work?

<be*****@hotmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
Michael,

I did a search in that site, but none of the links answers my question.
They are all "general" drag and drop coding that requires a user to
manually "Drag" and "Drop". My question is how to do the drag and drop
operation without the user even knows about it.
Ben

May 11 '06 #4
Do You want to animate some object then do the Drag Drop operation.
It might not have to be a true dragdrop, you can animate and at the end of
the animation do some operation.
Right?

B
"Daniel" <Da*****@vestryonline.com> wrote in message
news:eW**************@TK2MSFTNGP02.phx.gbl...
If the ok button is clicked and that makes the drag and drop occur, all
you need is a method to do the drag and drop operation and have that
called when ok is clicked?

i presume that does not solve your problem because i doubt you would be
stuck if it did. Could you explain why that would not work?

<be*****@hotmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
Michael,

I did a search in that site, but none of the links answers my question.
They are all "general" drag and drop coding that requires a user to
manually "Drag" and "Drop". My question is how to do the drag and drop
operation without the user even knows about it.
Ben


May 11 '06 #5
What I want is a way to drag a fake object and invoke the "Drop"
operation of any Windows (e.g. Word) that the user specified. It does
not need any animation effect. Is there any way I can simply "Post"
some message using "PostMessage()" to the target window and achieve the
same effect of a manual "Drop" operation?

May 11 '06 #6
you never answered my original question to you.

But if you dont want an animation effect then there will be no drag effect.
Your not being very clear at all.

Is it that you want the end result of a drag and drop operation.....which if
you do there is no need to mention drag and drop at all hence the confusion.
i really dont get what you are trying to achieve here at all.

But to invoke anything message wise use delegates and events. Then on the
'ok button click' fire that event.

I have just a had a thought, i believe in the designer in vis studio you can
set a 'on drop' event handler so that in the event of an on drag and drop
that event handler is fired and you can then handle the response. If this is
what you are trying to do and that is why then this is the wrong approach
and my original question regarding just use the ok buttons to do your needs
still stands.

Either way i am confused by your requirement but good luck.

<be*****@hotmail.com> wrote in message
news:11*********************@u72g2000cwu.googlegro ups.com...
What I want is a way to drag a fake object and invoke the "Drop"
operation of any Windows (e.g. Word) that the user specified. It does
not need any animation effect. Is there any way I can simply "Post"
some message using "PostMessage()" to the target window and achieve the
same effect of a manual "Drop" operation?

May 11 '06 #7
Sorry that I didn't make it clear the first time. What I want to do is
to experiement with a way to invoke the "Drop" handler of any given
Windows as if I manually drop some objecct into that Window. The test
GUI I start with is just to experiement to see if I can
programmatically simulate a user's mouse "drag" from a fake object and
"drop" to the target Window.

May 11 '06 #8
Oh in that case you only need to attach your method to the onDrop event of
the form. I dont know what event is called but find out what the event is
for drop and do the

event += DropEvent(MyMethod);

This is very very pseudo code but look up attaching events and it will do
what you want. Then on dropping something it will fire the event which in
turn will fire your method allowing you to do what you like.

<be*****@hotmail.com> wrote in message
news:11**********************@q12g2000cwa.googlegr oups.com...
Sorry that I didn't make it clear the first time. What I want to do is
to experiement with a way to invoke the "Drop" handler of any given
Windows as if I manually drop some objecct into that Window. The test
GUI I start with is just to experiement to see if I can
programmatically simulate a user's mouse "drag" from a fake object and
"drop" to the target Window.

May 18 '06 #9

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

Similar topics

2
4293
by: SamSpade | last post by:
There seems to be two ways to put things on the clipboard ( I don't mean different formats): SetClipboardData and OleSetClipboard If I want to get data off the clipboard do I care how it was put...
3
10385
by: Ajay Krishnan Thampi | last post by:
I have a slight problem implementing 'drag and drop' from a datagrid to a tree-view. I have pasted my code below. Someone please advice me on what to do...pretty blur right now. ==code== ...
1
3478
by: emferrari | last post by:
Hi everybody I have two treeviews, one of them is only to receive items dragged from the treeview1. I want to know how to drag a full node information to the treeview2. I know how to do that...
1
1589
by: Manuel Canas | last post by:
Hi there, This is the code that I am using to drag items from a list box and drop them into a text box. I'm not sure, but from what I know, each item on a list box is an object. Let say I get a...
3
5369
by: Boni | last post by:
Dear all, if an object draged on the certain place on the control I would like to cancel drag and drop. But from MSDN: "The QueryContinueDrag event is raised when there is a change in the...
3
10560
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
1
4685
by: Darren | last post by:
I'm trying to create a file using drag and drop. I want to be able to select a listview item drag it to the shell and create a file. Each icon in the listview represents a blob in a database. When...
0
1758
by: Pesso | last post by:
I'm loading a text file to a RichTextBox control to drag a selection of a text and drop it into a tree view control. It works except after the drag and drop operation the RichTextBox scrolls to the...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7132
Oralloy
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,...
0
7180
jinu1996
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...
0
7341
tracyyun
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...
0
5439
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4870
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
3076
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...
0
1381
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 ...
0
266
bsmnconsultancy
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...

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.