473,714 Members | 2,462 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Programmaticall y 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 10122
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*****@hotmai l.com> wrote in message
news:11******** **************@ u72g2000cwu.goo glegroups.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*****@vestry online.com> wrote in message
news:eW******** ******@TK2MSFTN GP02.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*****@hotmai l.com> wrote in message
news:11******** **************@ u72g2000cwu.goo glegroups.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 "PostMessag e()" 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.....w hich 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*****@hotmai l.com> wrote in message
news:11******** *************@u 72g2000cwu.goog legroups.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 "PostMessag e()" 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
programmaticall y 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(MyMet hod);

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*****@hotmai l.com> wrote in message
news:11******** **************@ q12g2000cwa.goo glegroups.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
programmaticall y 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
4329
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 there? What about Drag/Drop; is there more than one way for the source to make data available Is it always OLE?
3
10411
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== using System; using System.Drawing; using System.Collections; using System.ComponentModel;
1
3502
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 only in a single node operation. Here is my current code: private void trv_Directories_ItemDrag(object sender, ItemDragEventArgs e)
1
1598
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 bunch of names display on a list box now, how do I get the text of each item to drop that text into a text box? Private Sub lstResult_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles...
3
5399
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 keyboard or mouse button state during a drag-and-drop operation" But if there is no such operation can I somehow cancel drag&drop? I tried to raise this event but complier complains, that I can't raise event in the base class. Is there any solution?...
3
10596
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
1
4715
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 I drop onto the shell I want a file created with a specified name containing the data from the database. I've looked at the FileDrop format but it look to have only the filename and not the data. TIA
0
1776
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 top. This is very inconvenient because after the drag-drop operation the user has to scroll down to where he was before. Is there anyway to make the RichTextBox stop jumping to the top after a drag-drop from it?
0
8803
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8711
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9020
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 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...
0
7953
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6636
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4464
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...
0
4726
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2112
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 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...

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.