d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > C# | Mouseover @ Pannel
Add Reply New Topic New Poll
Member
Posts: 27,086
Joined: Mar 7 2008
Gold: 685.00
Feb 28 2013 11:06pm
Trying a mouse over event on a pannel but it didn't work. I use e.X and e.Y to send X and Y point into 2 different text box.




here the code


Designer.cs part
Code

           // panGrille
           //
           this.panGrille.BackColor = System.Drawing.SystemColors.Window;
           this.panGrille.Location = new System.Drawing.Point(406, 66);
           this.panGrille.Name = "panGrille";
           this.panGrille.Size = new System.Drawing.Size(378, 326);
           this.panGrille.TabIndex = 8;
           this.panGrille.MouseHover += new System.EventHandler(this.panGrille_MouseHover);  // Error supposed to be in this line


Code
       private void panGrille_MouseHover(object sender, MouseEventArgs e)
       {
           int X,Y;          
           X = e.X;
           Y = e.Y;
           txtX.Text = X.ToString();
           txtY.Text = Y.ToString();
       }  
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Mar 1 2013 12:18am
Code
// Error supposed to be in this line


what does that mean? you're getting a compile error? or runtime error? if so, what is it?

if it's a compile error, i'm guessing you probably need your method's param to be EventArgs instead of MouseEventArgs.
Member
Posts: 27,086
Joined: Mar 7 2008
Gold: 685.00
Mar 1 2013 12:22am
Quote (carteblanche @ 1 Mar 2013 01:18)
Code
// Error supposed to be in this line


what does that mean? you're getting a compile error? or runtime error? if so, what is it?

if it's a compile error, i'm guessing you probably need your method's param to be EventArgs instead of MouseEventArgs.


compile error
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Mar 1 2013 01:05am
Quote (eric838 @ Mar 1 2013 01:22am)
compile error


and that compile error is.....?
Member
Posts: 27,086
Joined: Mar 7 2008
Gold: 685.00
Mar 1 2013 01:19am
Aucune surcharge pour 'panGrille_MouseHover' ne correspond au délégué 'System.EventHandler'


srry if in french lol


its like I can't use MouseHover on a panel

This post was edited by eric838 on Mar 1 2013 01:19am
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Mar 1 2013 07:35am
Did you try my suggestion...?

Quote
No overload for 'panGrille_MouseHover' does not match the delegate 'System.EventHandler'


This post was edited by carteblanche on Mar 1 2013 07:35am
Member
Posts: 27,086
Joined: Mar 7 2008
Gold: 685.00
Mar 1 2013 11:18am
Quote (carteblanche @ 1 Mar 2013 08:35)
Did you try my suggestion...?


not working

cause I need e.X and e.Y value in X and Y

This post was edited by eric838 on Mar 1 2013 11:19am
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Mar 1 2013 12:17pm
when you say not working, you mean it does work but the reference type isn't what you want? check the class hierarchy. i'm guessing you can cast it
Member
Posts: 27,086
Joined: Mar 7 2008
Gold: 685.00
Mar 1 2013 04:02pm
Quote (carteblanche @ 1 Mar 2013 13:17)
when you say not working, you mean it does work but the reference type isn't what you want? check the class hierarchy. i'm guessing you can cast it


it's working I only switched MouseHover for MouseMove
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll