473,396 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

usercontrol and mouse event

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


Nov 17 '05 #1
3 2678
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
:)

"Raj Chudasama" <ra*@asteriasgi.com> wrote in message
news:O3**************@tk2msftngp13.phx.gbl...
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

Nov 17 '05 #2
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 wrote:
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

Nov 17 '05 #3
"Raj Chudasama" <ra*@asteriasgi.com> ha scritto nel messaggio
news:O3**************@tk2msftngp13.phx.gbl...


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.

--
..Net Reporting tool: http://www.neodatatype.net
Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: C. Alexander | last post by:
I'm trying to create a multi-user interactive whiteboard that has the ability to load a 'background' image to draw ontop of. The client/server needs to load a transparent layer for each user...
1
by: Rhy Mednick | last post by:
I'm creating a custom control (inherited from UserControl) that is displayed by other controls on the form. I would like for the control to disappear when the user clicks outside my control the...
2
by: tony | last post by:
I initally posted this July 29, 05 and did not get any replies: I have a Windows Forms UserControl that runs in a thick client. I am now deploying it within an IE web page. Everything works fine,...
3
by: Charles Law | last post by:
In a user control, is it possible to replace the default mouse events with my own? In particular, I want the consumer of my control to get MouseMove events when the mouse is over my control, so...
2
by: Adrian Game | last post by:
Hi to all that read, I have created a usercontrol for which i want to be able to use the mouse wheel. Currently I have to make the form that the control is used in pass the mousewheel event to...
41
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based...
9
by: Marcelo Cabrera | last post by:
Hi, I have a user control that in turn creates a bunch of webcontrols dynamically and handles the events these webcontrols raise. It used to work fine on ASP .Net 1.1 but when compiled on 2.0 it...
2
by: p_cranfield | last post by:
Hi I am trying to work out how to move controls contained within a user controls at design time using the mouse in the IDE. Consider the following: Project A contains usercontrol1 with...
3
by: Zabto | last post by:
I created an array of 8X5 boxes to represents pixels in a character. Each box is a custom UserControl of a fixed size which is filled black if it's activated, or white if it's not. I wanted to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
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...
0
tracyyun
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...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.