CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    How to control Mouse moves in C# ?

    Hi friends !
    I have a usercontrol which can have different controls docked on itself. I need to get informed when the mouse moves over this control ( independent if a mousebutton is pressedor not) or when it leaves the usercontrols rectangle. As this usercontrol should be able to be used by different programs I dont know how much other controls are placed on it. How can I do this. Is it possible to get informed about I think there should be something similar then hooking the desktop or something like that.

    Many thx for any idea how to arrange this.
    Jonny Poet
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  2. #2
    Join Date
    Oct 2004
    Posts
    65

    Re: How to control Mouse moves in C# ?

    Could you describe Detailly.

    And its helpful if you place the source code here/by downloadable.

    regards,
    avis
    Sivakumar Kuduva Ramamoorthy

  3. #3
    Join Date
    Feb 2005
    Location
    Israel
    Posts
    1,475

    Re: How to control Mouse moves in C# ?

    When a control is placed inside another control the MouseMove event is fired on the topmost control only. you will need to catch the MouseMove event on each of the contained controls, and raise the MouseMove event of the UserControl.

    When a control is placed on top of your control (not inside) you have nothing to do.

  4. #4
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: How to control Mouse moves in C# ?

    Quote Originally Posted by jhammer
    When a control is placed inside another control the MouseMove event is fired on the topmost control only. you will need to catch the MouseMove event on each of the contained controls, and raise the MouseMove event of the UserControl.

    When a control is placed on top of your control (not inside) you have nothing to do.
    Yes I know that, but what, when you dont know which controls are placed on your panel- ?

    The thing is I'm constructing a control similar to a form and any user of the control will place any controls he wants anywhere on this control. For different reasons I need to be informed when the mouse hovers over my panel or the other way round exactly I need to know, when the mouse leaves the space where my control is placed on the screen. For example think to the toolbox of the editor. when it is in an unpinned state and you leave its space then the toolbox vanishes. short later.
    This is the mechanics I need to build in into my control. With this control anyone can have a panel that can be pinned or not and when unpinned and mouse leaves its space the panel hides itself. Hopefully I discribed what I want to get.

    And this mechanics needs to work whatever a user of the control adds to the panels top. Any spyprogram can read all messages. I dont know if I'm wrong or not, but isn't there a general mousemove message which I can catch and read out where the mouse just is on the screen ?
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  5. #5
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: How to control Mouse moves in C# ?

    Quote Originally Posted by jhammer
    When a control is placed inside another control the MouseMove event is fired on the topmost control only..
    Hi again !
    This is true but for example in VB I could use SetWindowsHookEx to overcome that troubles and to seet a hook in the chain of the mouse messages so I could control them myself if they need to be really sent to where they are originally send or if I need to process them on an earlier level and destroy them ( supressing them so they dont arrive at the window to which they are sent originally.

    So the question is how to use SetWindowsHookEx in C# and especially also how to get ThreadID ( needed for SetWindowsHookEx ) and how to get adressof a function as SetWindowHookEx needs the adress of the callback function

    Anyone has any ideas ?

    Jonny Poet
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  6. #6
    Join Date
    Feb 2007
    Posts
    2

    Lightbulb how to search records from database in C# ?

    Hi
    am building one web application ,i want to insert search option in my application. please help me to write code to search the particular message entered by user.

  7. #7
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: how to search records from database in C# ?

    Quote Originally Posted by nageshbijoor
    Hi
    am building one web application ,i want to insert search option in my application. please help me to write code to search the particular message entered by user.
    Please create your own thread.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured