usercontrol and mouse event

  • Thread starter Thread starter Mrinal Kamboj
  • Start date Start date
M

Mrinal Kamboj

Hi ,

Let me see if i can get you closer to a solution , i had few doubts :

1. In the Extension button user control where do you declare the code
for instantiating mUserPopWin , let me assume in a method A .

2. mUserPopWin is a class object / form object where u are using both
the controls , mUserPopWin and extension button .

a. Now First while debugging make sure that you put a break point on the
instantiation code , especially :
this.mUserPopWin.Visible = false;
to check up that after execution of Mouse Hover event this code doesn't
executes , as this is the only place where i find visible = false .

b. Also try commenting out this portion , if this can give some clue .

c. Or may be you can check your events for UserControl to ensure there's
no such code being wrapped along , that makes visible false .

I think i have given quite abstract stuff , but i couldn't guess more on
seeing the code that u have provided , if possible u can send some more
details , then i can try it out .

regards ,

Mrinal
 
"Raj Chudasama" <[email protected]> ha scritto nel messaggio

private void ExtensionButton_MouseHover(object sender, System.EventArgs e)

{


ExtensionButton b = ((ExtensionButton)sender);

b.DisableTooltip();

Rectangle btnRect = b.RectangleToScreen(new Rectangle(b.Location,b.Size));

mUserPopWin.Location = btnRect.Location;

mUserPopWin.Visible = true;

mUserPopWin.BringToFront();

}

When i debug i see the code being executed but the window never popup
(becomes visible) what am i doing wrong?

Try move your code in a Button_Click event and then click it to see if the
code really works.

I'm not sure but I think that btnRect is relative to it's container, so
b.RectangleToScreen() gives wrong results.
 
i have a custom control derived from usercontrol (called popupwin). I have
another usercontrol (called extensionbutton). In the extension button i
have declared a variable as follows:
private PopupWindow mUserPopWin;

i create a new instance of the popupwin and provide necessary vars.

this.mUserPopWin = new PopupWindow();

this.mUserPopWin.UserName = this.List.Name;

this.mUserPopWin.UserPhone = this.List.Number;

this.mUserPopWin.ImageUrl = this.List.Picture;

this.mUserPopWin.Visible = false;





now what i want to do is to make the popupwin visible when user mouse is
over the button.

private void ExtensionButton_MouseHover(object sender, System.EventArgs e)

{


ExtensionButton b = ((ExtensionButton)sender);

b.DisableTooltip();

Rectangle btnRect = b.RectangleToScreen(new Rectangle(b.Location,b.Size));

mUserPopWin.Location = btnRect.Location;

mUserPopWin.Visible = true;

mUserPopWin.BringToFront();

}

private void ExtensionButton_MouseLeave(object sender, System.EventArgs e)

{

ExtensionButton b = ((ExtensionButton)sender);

b.DisableTooltip();

mUserPopWin.Visible = false;

}

When i debug i see the code being executed but the window never popup
(becomes visible) what am i doing wrong?

thanks
 
Sorry i didn t chagne time on my system. i used the update time now
and it gave me that time . i didn t mean to cheat
:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top