I need to be able to move a Panel on a windows Form at run time using
the mouse. I have tried adding a MouseDown event handler to the Panel
and then within the MouseDown handler adding a MouseMove event to the
Panel and then setting the Panel's Location to a new Point(x, y) with
x and y set to the mouse's x and y, but this does not work because the
MouseDown event of Panel only sends the cords of the mouse within that
Panel. I need to be able to move the Panel within the Form and need to
get the cords of the mouse within the Form in order to set the Panel's
Location.
I've also tried adding a MouseMove event to the Form when the Panel's
MouseDown event is called and then setting the Panel's Location based
on the cords of the Mouse events of the Form, but this has problems
because the Form doesn't receive mouse events while the cursor is
moving within the bounds of the Panel, cause the moving to be very
choppy.
Doesn't anyone have an idea as to how to handle this problem?
Thanks in advance,
I apologize if this has been asked already.
Jason 1 2905
When the mouse down is clicked you need to capture the mouse. Check out the
Control.Capture : http://msdn.microsoft.com/library/de...pturetopic.asp
Mind the wrap
Regards
Lee
"Jay" <ja*********@ya hoo.com> wrote in message
news:1e******** *************** ***@posting.goo gle.com... I need to be able to move a Panel on a windows Form at run time using the mouse. I have tried adding a MouseDown event handler to the Panel and then within the MouseDown handler adding a MouseMove event to the Panel and then setting the Panel's Location to a new Point(x, y) with x and y set to the mouse's x and y, but this does not work because the MouseDown event of Panel only sends the cords of the mouse within that Panel. I need to be able to move the Panel within the Form and need to get the cords of the mouse within the Form in order to set the Panel's Location.
I've also tried adding a MouseMove event to the Form when the Panel's MouseDown event is called and then setting the Panel's Location based on the cords of the Mouse events of the Form, but this has problems because the Form doesn't receive mouse events while the cursor is moving within the bounds of the Panel, cause the moving to be very choppy.
Doesn't anyone have an idea as to how to handle this problem?
Thanks in advance, I apologize if this has been asked already. Jason This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John Champaign |
last post by:
Hi all,
I'm working on an educational applet for a child with special needs.
He's got a bit of a trick to make my life more difficult... To interact
with the applet he needs to click on buttons, which is fine most of the
time (he comes from a Mac environment, so I accept mouse clicks from the
right or left button when he's working on the PC). But every once in a
while, he'll press and hold the right mouse button, move onto a JButton,...
|
by: LRD |
last post by:
Form not refreshing after autopostback unless keyboard or mouse move
Hi,
We created several new ASP.NET C# forms for our intranet. In each form we
use panels for different sections of the form that are visible or not
depending on what the user is doing.
Each particular form.aspx page has a user control on it. This user control
contains the form HTML and the C# code.
|
by: gsb |
last post by:
I track the mouse location like this code:
function mousePos(e) {
var p = new Object();
if(e) { p.x = e.pageX; p.y = e.pageY; }
else { p.x = event.x; p.y = event.y; }
... (show)
}
document.onmousemove=mousePos;
Seems to do fine on many browsers.
|
by: mdb |
last post by:
My app has a notify icon in the systray. I want the left mouse click to
initiate a menu, and a right-mouse click to do something else. Normally,
for a button, I would listen to MouseDown and if I need to display the
menu, I would contextMenu.Show(buttonCtrl, new Point(0)). But I can't do
this for a notifyIcon because notifyIcons aren't controls. How can I
display a contextMenu where the cursor is by command only?
-mdb
|
by: AinO |
last post by:
Hi,
(VS2003/c# - System.Windows.Forms)
Is there a way to know (have an event triggered) if the mouse leaves a form,
if this form's client area is completly
covered with child controls ?
I tried various mouse move/leave event handling scenario's involving the
form or the controls on it's client area but no
| |
by: Niels Jensen |
last post by:
I have been developing a little project which draw's a hexgrid on a panel
within a form similar to this - it:s used as a client from a e-mail based
strategy game:
____ ____
/ \ / \
/ (0,0) \____/ (2,0) \____/
\ / \ / \
\____/(1,1) \____/ (3,1) \_
/ \ / \
/ (0,1) \____/ (2,1) \____/
|
by: Sam |
last post by:
Hi,
I can't figure out how to detect when my mouse cursor leaves a panel
control. It should not trigger the event (or do anything) when the
mouse leave the panel but still is over a control that is contained by
the panel.
I've done this :
Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
If Cursor.Position.X > Me.Location.X + Me.Width Or
Cursor.Position.Y > Me.Location.Y + Me.Height _
|
by: YouPoP |
last post by:
I am doing an app (C# 2.0) where you can draw in a panel with your mouse in "real time". I actually have 2 problems;
1- it does not really is "real time", if your mouse move fast or very fast the line is added after a very small delay.
2-Because I use AddLine(), it adds very short lines from one point to another and it does not give a very good result. Also because of this and my "not real time" problem, when the mouse moves fast it adds...
|
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...
|
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,...
|
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: 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...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |