473,404 Members | 2,170 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,404 software developers and data experts.

Help using SetCapture and MouseUp event

Hello everyone,
I've a problem using SetCapture and MouseUp events.
I've done an app that is doing SetCapture(Handle) on a buttonclick
event and have a mouseup event that shows a MessageBox and then call
Releasecaptue and Setcapture(Handle):note that Handle is the same
called from Button and Mouseup event.
I'd expect that my app need only first time to press the button
because other time setcapture is called from mouseup event.This is not
true, because setcapture called from mouseup event does not
work(e.g.:you have to do:push button->mouse up->push button->mouse up
etc), so my question is:why SetCapture work on Button click event and
does not work from mouse event?Am I missing something?
This is the core of my simple app:
[SetCapture,releaseCapture definitions etc...]

public Form1()
{
InitializeComponent();
this.MouseUp+=new MouseEventHandler(Form1_MouseUp);
this.button1.Click+=new EventHandler(button1_Click);
}

[Standard Main,dispose and initialize component]

private void Form1_MouseUp(object sender, MouseEventArgs e)
{
ReleaseCapture();
MessageBox.Show("I'm here!");
SetCapCall();
}

private void button1_Click(object sender, EventArgs e)
{
SetCapCall();
}

private void SetCapCall()
{SetCapture(Handle); //Handle is the same called from Button and
Mouse up event
}

}

Thanks in advance.
Nov 16 '05 #1
0 4628

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

Similar topics

2
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at...
1
by: Alan | last post by:
i have a form with a label on it Private Sub Label1_mousedown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseDown ' do stuff End Sub ...
1
by: no spam | last post by:
Hi, I want to encapsulate code to change BUTTON elements on a webpage in one place in an HTC file. Here is the code in my HTC FIle: <PUBLIC:COMPONENT> <PUBLIC:ATTACH EVENT="onmouseup" ...
2
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...
3
by: Techsatish | last post by:
how to make a mouseup event called only once during a double click event? here double click is made on a tree node in a tree control. I have the code inside mouseup event....in runtime the...
8
by: Richard Maher | last post by:
Hi, I am in a mouseup event for button A and I'd like to disable=false button B before starting some work. Is there anyway that an event for button B can then fire before my event processing for...
9
by: dli07 | last post by:
Hello, I'm trying to convert a piece of code that creates a dynamic vertical resizing bar in a table from internet explorer to firefox. It's based on a post from...
6
by: =?Utf-8?B?TXJOb2JvZHk=?= | last post by:
I mught have misunderstood how SetCapture works, but I call it passing my form's Handle and I am not noticing any difference in what mouse events my app is picking up. It is only limited to mouse...
12
by: Tom Bean | last post by:
I am trying to display a ContextMenuStrip when a user right-clicks on an item in a ListView and have encountered a something that seems strange to me. When the ListView is initially populated,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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
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
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...
0
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,...

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.