I'm new to gui programming. I'm just doing some testing with forms. I've
dropped a com control on a form. When a user clicks and holds the mouse
down on the control I'd like to drag the form around with the mouse. How
would I do this? Even is it were a simple control like a label or panel,
how would I do this?
I guess it comes down to 2 questions:
1. How do I get mouse movement messages if the control does not offer these
messages? Can I get them from some base control. It's ok if I'm taking the
controls ability to process mouse messages away.
2. How do I determine if the mouse button is currently down?
Thanks
jim 7 1195
Hi Jim H,
For you 2nd question, below is the solution:
private void Form1_MouseDown (object sender, System.Windows. Forms.MouseEven tArgs e)
{
switch (e.Button)
{
case MouseButtons.Le ft:
MessageBox.Show ("Left Mouse Button Click");
break;
case MouseButtons.Ri ght:
MessageBox.Show ("Right Mouse Button Click" );
break;
default:
break;
}
}
Hope it helps. Cheers.
--
Regards,
Chua Wen Ching :)
"Jim H" wrote: I'm new to gui programming. I'm just doing some testing with forms. I've dropped a com control on a form. When a user clicks and holds the mouse down on the control I'd like to drag the form around with the mouse. How would I do this? Even is it were a simple control like a label or panel, how would I do this?
I guess it comes down to 2 questions: 1. How do I get mouse movement messages if the control does not offer these messages? Can I get them from some base control. It's ok if I'm taking the controls ability to process mouse messages away.
2. How do I determine if the mouse button is currently down?
Thanks jim
Hi Jim H,
For question 1, mouse movement:
private void Form1_MouseMove (object sender, System.Windows. Forms.MouseEven tArgs e)
{
textBox1.Text = "X: " + e.X + " Y: " + e.Y;
}
Hope it works. Thanks.
--
Regards,
Chua Wen Ching :)
"Jim H" wrote: I'm new to gui programming. I'm just doing some testing with forms. I've dropped a com control on a form. When a user clicks and holds the mouse down on the control I'd like to drag the form around with the mouse. How would I do this? Even is it were a simple control like a label or panel, how would I do this?
I guess it comes down to 2 questions: 1. How do I get mouse movement messages if the control does not offer these messages? Can I get them from some base control. It's ok if I'm taking the controls ability to process mouse messages away.
2. How do I determine if the mouse button is currently down?
Thanks jim
Thanks for the response. The problem events do not get kicked off when the
mouse is over the child control. How do I track the mouse when it is over a
third party control?
jim
"Chua Wen Ching" <ch************ @nospam.hotmail .com> wrote in message
news:40******** *************** ***********@mic rosoft.com... Hi Jim H,
For question 1, mouse movement:
private void Form1_MouseMove (object sender,
System.Windows. Forms.MouseEven tArgs e) { textBox1.Text = "X: " + e.X + " Y: " + e.Y; }
Hope it works. Thanks. -- Regards, Chua Wen Ching :)
"Jim H" wrote:
I'm new to gui programming. I'm just doing some testing with forms.
I've dropped a com control on a form. When a user clicks and holds the mouse down on the control I'd like to drag the form around with the mouse.
How would I do this? Even is it were a simple control like a label or
panel, how would I do this?
I guess it comes down to 2 questions: 1. How do I get mouse movement messages if the control does not offer
these messages? Can I get them from some base control. It's ok if I'm taking
the controls ability to process mouse messages away.
2. How do I determine if the mouse button is currently down?
Thanks jim
Hi Jim,
First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to move the form around when
hold the mouse button on one control. If there is any misunderstandin g,
please feel free to let me know.
This can be only be done if the third party control can process mouse move
event. If there is not a mouse move event fired by that control, we will
not have a place to write code to do this stuff.
For workaround, we can try to make a derived class of the ActiveX control
and override the OnMouseMove event. In the OnMouseMove event, we can fire
another public event, for example, named "MyMouseMov e". Now we can handle
the MyMouseMove to achieve this.
HTH.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
Hi Jim H,
Over a 3rd party control? Do you have the code for it and is it managed?
Anyway i never tried before. Hope there is someone who can help you.
Keep me updated if you can find the solution.
I am here to learn too.
--
Regards,
Chua Wen Ching :)
"Jim H" wrote: Thanks for the response. The problem events do not get kicked off when the mouse is over the child control. How do I track the mouse when it is over a third party control?
jim
"Chua Wen Ching" <ch************ @nospam.hotmail .com> wrote in message news:40******** *************** ***********@mic rosoft.com... Hi Jim H,
For question 1, mouse movement:
private void Form1_MouseMove (object sender, System.Windows. Forms.MouseEven tArgs e) { textBox1.Text = "X: " + e.X + " Y: " + e.Y; }
Hope it works. Thanks. -- Regards, Chua Wen Ching :)
"Jim H" wrote:
I'm new to gui programming. I'm just doing some testing with forms. I've dropped a com control on a form. When a user clicks and holds the mouse down on the control I'd like to drag the form around with the mouse. How would I do this? Even is it were a simple control like a label or panel, how would I do this?
I guess it comes down to 2 questions: 1. How do I get mouse movement messages if the control does not offer these messages? Can I get them from some base control. It's ok if I'm taking the controls ability to process mouse messages away.
2. How do I determine if the mouse button is currently down?
Thanks jim
Thanks, I'll try that. I can get the mouse moves just not the mouse downs.
jim
"Kevin Yu [MSFT]" <v-****@online.mic rosoft.com> wrote in message
news:uH******** *******@cpmsftn gxa06.phx.gbl.. . Hi Jim,
First of all, I would like to confirm my understanding of your issue. From your description, I understand that you need to move the form around when hold the mouse button on one control. If there is any misunderstandin g, please feel free to let me know.
This can be only be done if the third party control can process mouse move event. If there is not a mouse move event fired by that control, we will not have a place to write code to do this stuff.
For workaround, we can try to make a derived class of the ActiveX control and override the OnMouseMove event. In the OnMouseMove event, we can fire another public event, for example, named "MyMouseMov e". Now we can handle the MyMouseMove to achieve this.
HTH.
Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
Thanks, I'll try that. I can get the mouse moves just not the mouse downs.
jim
"Kevin Yu [MSFT]" <v-****@online.mic rosoft.com> wrote in message
news:uH******** *******@cpmsftn gxa06.phx.gbl.. . Hi Jim,
First of all, I would like to confirm my understanding of your issue. From your description, I understand that you need to move the form around when hold the mouse button on one control. If there is any misunderstandin g, please feel free to let me know.
This can be only be done if the third party control can process mouse move event. If there is not a mouse move event fired by that control, we will not have a place to write code to do this stuff.
For workaround, we can try to make a derived class of the ActiveX control and override the OnMouseMove event. In the OnMouseMove event, we can fire another public event, for example, named "MyMouseMov e". Now we can handle the MyMouseMove to achieve this.
HTH.
Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights." This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brian Hlubocky |
last post by:
I'm have a fairly simple (in terms of COM) python program that pulls
info from an Access database and creates Outlook contacts from that
information. It uses wxPython for gui and works without problems.
I want to be able to distribute this program using py2exe, but I am
having some problems. I am using a simple setup.py like in the
documentation for the py2exe tool and everything compiles ok, except
that when I run the exe, I get an...
|
by: Scott Manson |
last post by:
I am working on a database access program using C# and am having a few
problems.
I am collecting data that may or may not be in order and may or may
not be in the database. I have 2 classes that take care of the parsing
of the data and everything is working fine I can query my DB and such
but I am having trouble with adding an entry if the entry is not in
the DB.
I currently am having problems with not getting the correct data at
|
by: John Baker |
last post by:
Hi:7
Newby here to ASP, and using the ASP.NET Web Matrix development tool. While that tool
looks great for a Newby, I have run into a snag. I have an HTML Text Box which I have
named HireInput, and a table (Access Table in fact) that has on it a field called HIREID.
I wish to select records where the two match! It sounds simple, but I am having trouble
setting up the text box name so that it is recognized in the query.
Can someone...
|
by: Wizard |
last post by:
Hey Group,
Im having some major trouble trying to find info on this one:(
Wonder if somebody could possibly help?
At Present I can get this working:
Private Sub frmSystemOptions_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
|
by: RSH |
last post by:
Hi,
i have a situation where I have a VB .Net Module built that contains all of
the functions I need. I now need to add a form to the project and i need
the form to sdisplay and the module code to write to the form. I am having
trouble figuring out how to do this.
Basically, I have Form1 which contains a button and a TextBox. Module1
contains a function called Function1. I want to attach an event to the
button which will call...
| |
by: RSH |
last post by:
I am really trying to grasp the concept of OOP as it applies to C#.
I am looking at trying to set up a simple Employee Class but I am having
trouble conceptualizing what this class should look like. I was hoping
someone might be able to simply outline what I envision my class to look
like:
Basically I am envisioning a Class called Employee:
I imagine it would have many properties(?) such as:
|
by: Sam |
last post by:
Hi guys,
I'm learning ADO.Net and I'm having trouble with binding a simple control,
the textbox. The problem that I'm having is updating the Northwind database
data through textbox controls. I can display, and update my data through my
datagridview control but I cannot update the data if I bind my DataSet
object through textbox controls(I can display them) .
When I run an update command( DACustomers.Update(DSCustomers1)), there is no...
|
by: RSH |
last post by:
Hi,
I am having to temporarily work over an existing website.
I have a template include page that I would like to pass a string variable
that will change based on the parent that calls the include.
This used to be quite simple but I am having trouble making it work in .Net.
Basically this is the code in the .ASPX parent page that calls the include
page which works fine:
|
by: Dustin MacDonald |
last post by:
Hi everyone.
This is my first time posting to this newsgroup, and although I
maintain my netiquette I might've missed something specific to the
newsgroup, so hopefully you can avoid flaming me if I have :) I
apologize for the length of this post but I figure the more
information the better.
My problem is that I'm getting a syntax error in some Python code that
looks quite simple. The original code was in Object Pascal as I'm a
|
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: 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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |