473,796 Members | 2,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Double click code never executes

Hi to all,

i have an app that i allow a drag and drop operation of picture boxes on a
panel.
when i drop a picture box i do the following so my newly dropped picture box
will be able
to respond to these 2 events:

pbox.MouseDown += new MouseEventHandl er(pbox_MouseDo wn);
pbox.DoubleClic k += new EventHandler(pb ox_DoubleClick) ;

But although the code in MouseDown event executes correctly, the
pbox_DoubleClic k
is never called...
It seems that because MouseDown is executing first, it cannot "understand "
the double click
and thus it;s code never executes...

Has anyone experienced this and come up to a solution ?

Below is the code for MouseDown event,

thanks a lot for any help!

private void pbox_MouseDown( object sender,
System.Windows. Forms.MouseEven tArgs e) {
PictureBox pbox = (PictureBox) sender;
DragDropEffects myEffect;
FormInvoked = true;
switch (e.Button) {
case MouseButtons.Le ft: {
myEffect = pbox.DoDragDrop ((Bitmap)
pbox.Image,Drag DropEffects.Cop y);
SetDefaultBox(p box.Name);
break;
etc etc etc...
Nov 16 '05 #1
1 2680
objectref,

I think that this would be the case. Anytime you let up the mouse you
are starting a drag/drop operation which is going to cancel out the double
click timer (I think).

What you might have to do is on the mouse down, you would set a timer
(set to a little more than the double click timeout) and a flag indicating
that the mouse was down. Then, when the timer fires, if the double click
handler did not execute, then you would begin your drag/drop operation.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"objectref" <ob*******@medi atrel.com> wrote in message
news:OR******** ******@TK2MSFTN GP12.phx.gbl...
Hi to all,

i have an app that i allow a drag and drop operation of picture boxes on a
panel.
when i drop a picture box i do the following so my newly dropped picture
box will be able
to respond to these 2 events:

pbox.MouseDown += new MouseEventHandl er(pbox_MouseDo wn);
pbox.DoubleClic k += new EventHandler(pb ox_DoubleClick) ;

But although the code in MouseDown event executes correctly, the
pbox_DoubleClic k
is never called...
It seems that because MouseDown is executing first, it cannot "understand "
the double click
and thus it;s code never executes...

Has anyone experienced this and come up to a solution ?

Below is the code for MouseDown event,

thanks a lot for any help!

private void pbox_MouseDown( object sender,
System.Windows. Forms.MouseEven tArgs e) {
PictureBox pbox = (PictureBox) sender;
DragDropEffects myEffect;
FormInvoked = true;
switch (e.Button) {
case MouseButtons.Le ft: {
myEffect = pbox.DoDragDrop ((Bitmap)
pbox.Image,Drag DropEffects.Cop y);
SetDefaultBox(p box.Name);
break;
etc etc etc...

Nov 16 '05 #2

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

Similar topics

2
513
by: Rob Mayo | last post by:
OK, maybe this is my opinion, maybe these are bugs. Given the folowing: I have a NotifyIcon on my Form, a Context menu associated with the NotifyIcon, and a MenuItem on the ContextMenu set as default. When the default MenuItem is clicked, there is code to no longer show the NotifyIcon. What I feel should happen is when I double-click the NotifyIcon in the system tray, it should perform the default menu item's Click event.
28
5093
by: n00m | last post by:
When I double-click on "some.py" file console window appears just for a moment and right after that it's closed. If this script is started from inside of IDLE (F5 key) then it executes as it should be (e.g. executing all its print statements). Any ideas? OS: Windows; Python 2.3.4. Thanks.
6
15643
by: Richard A. Lowe | last post by:
I'm using P/Invoke to call SendInput (using code culled from these newsgroups!) to send mouse events to a window. But I'm unsure how to send double-clicks. A VB6 article I saw on SendInput suggested simply queueing two click events, but this is not working for me, regardless of the delay I put between clicks. So give this as a click (where INPUT is an appropriate structure for sending the SendInput data): public static void Click()
3
4388
by: Wajih-ur-Rehman | last post by:
I am developing a C# app. I want to do something when someone double clicks on a combo box. But this event never fires. Any suggestions? Thanx!
5
4748
by: Nick | last post by:
Hey guys, I have 2 events on a windows forms datagrid, the mouse move as well as the double click events. What's happening is that when I double click on a row in the grid, the mouse move event gets triggered and the double click is not identified at all. Is there any way I can invoke the double click when the mouse move also exists?
1
5418
by: scott_gui | last post by:
Creating a Windows application: <Double-Button-1> mouse event has a conflict when there is also a binding to the <Button-1> event. It seems like a silly oversight that performing a double click will also initiate the single click action. Has anyone figured out a way to circumvent this problem? Right now I am making the Double click function undo the action my Single click function does, but this is very annoying, especially since the...
9
8059
by: Armando | last post by:
I have an app (A2000) where I am letting the user move an object on the screen. I use the OnClick for a command button event to modify the object's Top (or Left) properties, but you can only click slowly. That is, every other click is ignored, because Access is seeing a double click event. I would put the same code there, except I'm also using the SHIFT key (during mouse click) to cause bigger moves, and there's no SHIFT flag for the...
2
3511
by: techsatish | last post by:
Hi, I want the double click event to call(here not able to get the MouseEventArgs) and execute the mouseup event code or any one tell me how to make my treecontrol double click nodes to behave like a singe click event(that is mouseup here)so that that will fire mouseup.How can i implement this?any ideas ? code snippets? Thanks in advance satish
6
3203
by: Jim Devenish | last post by:
I have an unbound form that displays all the days of the year as a calendar. It has 12 rows of text boxes with either 29,30 or 31 in each row. Text box names are of the form: display_01_01, display_01_02 ... display_12_31. This is used to display bookings of holiday properties and works well. I am now wishing to be able to highlight a range of dates by double clicking in one text box and then in another, highlighting all the dates...
0
9680
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
9528
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
10456
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, 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...
0
10230
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 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...
0
9052
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
7548
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...
1
4118
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
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2926
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.