473,625 Members | 3,251 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Will many ToolTip providers cause a performance issue?

I have an application where some forms have many (say 100) UserControls on
them (each of which contain a label, an image, and a data entry control),
and each UserControl has a ToolTip provider (although really we don't assign
ToolTips to most of the controls), and then the UserControl exposes a
ToolTipText property which sets the same ToolTip for all 3 contained
controls. It would be possible to have one ToolTip provider on the form
instead, it would be ugly (especially since I think the form level ToolTip
provider would put provider-properties on the designer property thingy that
we'd want to NEVER use.)

Anyway, our more complex forms are loading kinda slow, and my supervisor
wonders if it would help performance if each control did not have its own
ToolTip provider. I think this is not the big issue, but I don't know enough
about how the ToolTip works internally to feel sure. I suppose the only real
way to know is try removing them, and see if it helps, but that will be a
real pain, and if anyone has enough knowledge to say we really should be
looking somewhere else, that'd be appreciated. Or to say yes, removing the
100 ToolTip providers is really worth trying (either way.)

-Rachel
Nov 17 '05 #1
8 3060
Tool tips are provided through an extender provider that associates the
tooltip message with the control via a hashtable. You should not have many
tooltip object, just one...

The tooltip system works by adding a handler to the controls mouse-hover
event and then showing the message associated with the control. There should
be no particular performance loss.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Rachel Suddeth" <ra****@bldhoun d.com> wrote in message
news:OS******** ******@TK2MSFTN GP12.phx.gbl...
I have an application where some forms have many (say 100) UserControls on
them (each of which contain a label, an image, and a data entry control),
and each UserControl has a ToolTip provider (although really we don't
assign
ToolTips to most of the controls), and then the UserControl exposes a
ToolTipText property which sets the same ToolTip for all 3 contained
controls. It would be possible to have one ToolTip provider on the form
instead, it would be ugly (especially since I think the form level ToolTip
provider would put provider-properties on the designer property thingy
that
we'd want to NEVER use.)

Anyway, our more complex forms are loading kinda slow, and my supervisor
wonders if it would help performance if each control did not have its own
ToolTip provider. I think this is not the big issue, but I don't know
enough
about how the ToolTip works internally to feel sure. I suppose the only
real
way to know is try removing them, and see if it helps, but that will be a
real pain, and if anyone has enough knowledge to say we really should be
looking somewhere else, that'd be appreciated. Or to say yes, removing the
100 ToolTip providers is really worth trying (either way.)

-Rachel

Nov 17 '05 #2
Thanks, Bob...
The tooltip system works by adding a handler to the controls mouse-hover
event and then showing the message associated with the control. There should be no particular performance loss.
I take it you are saying there is not much overhead in having many
hashtables with only a few (or no) entries each, then having one hashtable
with many entries? Obviously, the latter is more efficient, but I think not
a big deal?
Tool tips are provided through an extender provider that associates the
tooltip message with the control via a hashtable. You should not have many
tooltip object, just one...


The problem with sticking one ToolTip provider onto the form when you are
using UserControls is that if you do SetToolTip(cont rol, tiptext), that will
associate the text only with UserControl's mouse events, not with the
contained controls' events. If the contained controls cover the entire
surface of the UserControl (as most of them do for us), then the TipText
will never show up. Instead, we have one for each UserControl, and the set
of the TipText does something like
set
{
foreach ( Control c in this.Controls )
{
this.TipProvide r.SetToolTip( c, value );
}
}
(Really, it's a bit more complicated that this because sometimes the
contained control can itself be a container.) The contained controls are
private members of the UserControl, and we'd like to keep it that way, so
using a single ToolTip for the whole for would be messy and involve the
UserControl having access to the form's ToolTip provider.

-Rachel
Nov 17 '05 #3
Rachel,

The first thing I'd do, if I were you, instead of spending a lot of time
trying to optimize things you're not sure will make a difference, is profile
your app and find out specifically where the bottleneck is. That way you
won't waste a great deal of time on things that may not make any noticeable
difference.

I highly recommend nprof. It works really well and it's free:

http://nprof.sourceforge.net/Site/SiteHomeNews.html

My job is primarily developping custom controls, and for some of them,
performance is a high priority issue. nprof has been a life saver.

Pete

"Rachel Suddeth" <ra****@bldhoun d.com> wrote in message
news:ef******** ******@TK2MSFTN GP12.phx.gbl...
Thanks, Bob...
The tooltip system works by adding a handler to the controls mouse-hover
event and then showing the message associated with the control. There

should
be no particular performance loss.


I take it you are saying there is not much overhead in having many
hashtables with only a few (or no) entries each, then having one hashtable
with many entries? Obviously, the latter is more efficient, but I think
not
a big deal?
Tool tips are provided through an extender provider that associates the
tooltip message with the control via a hashtable. You should not have
many
tooltip object, just one...


The problem with sticking one ToolTip provider onto the form when you are
using UserControls is that if you do SetToolTip(cont rol, tiptext), that
will
associate the text only with UserControl's mouse events, not with the
contained controls' events. If the contained controls cover the entire
surface of the UserControl (as most of them do for us), then the TipText
will never show up. Instead, we have one for each UserControl, and the set
of the TipText does something like
set
{
foreach ( Control c in this.Controls )
{
this.TipProvide r.SetToolTip( c, value );
}
}
(Really, it's a bit more complicated that this because sometimes the
contained control can itself be a container.) The contained controls are
private members of the UserControl, and we'd like to keep it that way, so
using a single ToolTip for the whole for would be messy and involve the
UserControl having access to the form's ToolTip provider.

-Rachel

Nov 17 '05 #4
I have not found that hashtable performance was much of a problem under many
hundreds of entries. If your form has many hundreds of items then it's
probably way too busy and you should be doing something else.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Rachel Suddeth" <ra****@bldhoun d.com> wrote in message
news:ef******** ******@TK2MSFTN GP12.phx.gbl...
Thanks, Bob...
The tooltip system works by adding a handler to the controls mouse-hover
event and then showing the message associated with the control. There

should
be no particular performance loss.


I take it you are saying there is not much overhead in having many
hashtables with only a few (or no) entries each, then having one hashtable
with many entries? Obviously, the latter is more efficient, but I think
not
a big deal?
Tool tips are provided through an extender provider that associates the
tooltip message with the control via a hashtable. You should not have
many
tooltip object, just one...


The problem with sticking one ToolTip provider onto the form when you are
using UserControls is that if you do SetToolTip(cont rol, tiptext), that
will
associate the text only with UserControl's mouse events, not with the
contained controls' events. If the contained controls cover the entire
surface of the UserControl (as most of them do for us), then the TipText
will never show up. Instead, we have one for each UserControl, and the set
of the TipText does something like
set
{
foreach ( Control c in this.Controls )
{
this.TipProvide r.SetToolTip( c, value );
}
}
(Really, it's a bit more complicated that this because sometimes the
contained control can itself be a container.) The contained controls are
private members of the UserControl, and we'd like to keep it that way, so
using a single ToolTip for the whole for would be messy and involve the
UserControl having access to the form's ToolTip provider.

-Rachel

Nov 17 '05 #5

"Bob Powell [MVP]" <bob@_spamkille r_bobpowell.net > wrote in message
news:OH******** *****@TK2MSFTNG P09.phx.gbl...
I have not found that hashtable performance was much of a problem under many hundreds of entries. If your form has many hundreds of items then it's
probably way too busy and you should be doing something else.


Oh, dear, I have not been clear. I am saying that IF there is a performance
difference, it will be more efficient to use only one hashtable. I am sure
the hastable could easily handle all the entries ... it would be a poor
hashtable implementation if it couldn't (which seems terribly unlikely given
that hashtables aren't hard to implement and Microsoft has very smart
programmers.) It's rather a waste of space to use a hashtable for only 2 or
3 entries... but I doubt that's our biggest problem.

Anyway, thanks for the info... I thought it would use a hashtable (that's
what I'd use if writing a provider), but it's nice to have that confirmed.

-Rachel
Nov 17 '05 #6
Thanks, Pete. I will get this right away. I do think it's time for us to use
something this.
-Rachel

"Pete Davis" <pdavis68@[nospam]hotmail.com> wrote in message
news:JM******** *************** *******@giganew s.com...
Rachel,

The first thing I'd do, if I were you, instead of spending a lot of time
trying to optimize things you're not sure will make a difference, is profile your app and find out specifically where the bottleneck is. That way you
won't waste a great deal of time on things that may not make any noticeable difference.

I highly recommend nprof. It works really well and it's free:

http://nprof.sourceforge.net/Site/SiteHomeNews.html

My job is primarily developping custom controls, and for some of them,
performance is a high priority issue. nprof has been a life saver.

Pete

Nov 17 '05 #7
Oh, why didn't I catch on to this?...

"Bob Powell [MVP]" <bob@_spamkille r_bobpowell.net > wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
...
The tooltip system works by adding a handler to the controls mouse-hover
event ...


In that case, I should be able to add a MouseHover handler to all the
controls on each user control like so...

private void BaseCtrl_Contro lAdded(object sender, ControlEventArg s e)
{
Control c = sender as Control;
c.MouseHover += new EventHandler(c_ MouseHover);
}

private void c_MouseHover(ob ject sender, EventArgs e)
{
this.OnMouseHov er(e);
}

Then I should be able to use the ToolTip as intended, because hovering over
any contained control should trigger the UserControl's MouseHover, right?

-Rachel
Nov 17 '05 #8
On Mon, 7 Nov 2005 09:08:57 -0600, "Rachel Suddeth"
<ra****@bldhoun d.com> wrote:
Thanks, Pete. I will get this right away. I do think it's time for us to use
something this.
-Rachel
In your original post you mention that some forms have over 100 user
controls and each user control contains three controls including an
image. Just knowing this it becomes obvious a whole lot, perhaps too
much, is going on as the form loads. Loading 100+ images sounds like a
lot of repetitive I/O. Populating 100+ data controls will slow things
down as well.

As a programmer I have to question to the design and as a designer I
have to question the usability of a window with 100+ controls. Such
complexity cannot be user-friendly.

regards
A.G.
"Pete Davis" <pdavis68@[nospam]hotmail.com> wrote in message
news:JM******* *************** ********@gigane ws.com...
Rachel,

The first thing I'd do, if I were you, instead of spending a lot of time
trying to optimize things you're not sure will make a difference, is

profile
your app and find out specifically where the bottleneck is. That way you
won't waste a great deal of time on things that may not make any

noticeable
difference.

I highly recommend nprof. It works really well and it's free:

http://nprof.sourceforge.net/Site/SiteHomeNews.html

My job is primarily developping custom controls, and for some of them,
performance is a high priority issue. nprof has been a life saver.

Pete

Nov 17 '05 #9

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

Similar topics

12
5349
by: Michael | last post by:
Is there any way to modify the tooltip that shows up when using alt or title in <img> or <a> tags? I don't like the stock tooltip, the boring yellow box. I would like to make it a little more friendly. But I'm thinking that this is part of the browser's hardcoded information. Am I wrong?
2
1496
by: runningdog | last post by:
Hi, I have created a number of Windows Forms Controls that require tooltips. If I add a tooltip object to each of my controls will this create any resource/performance issues that I should be concerned with. Would it be better to bind to a single tooltip object when the control is consumed by an application? Thanks Steve
2
2201
by: fochie | last post by:
Greetings, First time append. I have a dynamic page that can potentially contain thousands of links. Each link has an onmouseover specified with Walter Zorn's Tool Tip feature to pop up a small image. This has been working fine but I noticed that a page with many links loads very slowly. I then realized that the images that are used for the onmouseover pop ups are all automatically being downloaded when the page initially loads.
3
4127
by: Pascal Weill | last post by:
Hello, I've got a problem with the ToolTip control (it is the first time I use it). Whatever the changes I make to the xxxxDelay properties (for example 1000), the tooltip appears immediately when I move the mouse on the concerned control (no delay). And the yellow window never disappears when I stay on the control. I tried the ToolTip on MouveMove and MouseEnter events and
3
2114
by: Dennis | last post by:
I have implemented the ToolTip class for a user control that inheirits from the panel. I show different tool tips depending on where the mouse is on the control when the hover event occurs. However, if the mouse is moved to another part of the control, the tooltip doesn't show again until the user moves the mouse off the control then back on. How do I reset the tooltip to show again when the mouse moves within the panel to a different...
5
1257
by: ODAN | last post by:
I have an application that was developed in ASP.NET/C#. On one of the pages, we are using tooltip to display the description of the textboxes. Wehn you move your mouse over a textbox the tooltip appears with a full description of the textbox on which you have your mouse. By default the tooltip display for 10 seconds and then disappear (according to Microsoft). Is there a way to make the tooltip display indefinetly. I have I searched the...
0
1452
by: sonu | last post by:
Hi all, I am experiencing a strange problem for the call setToolTip while running my application on frmaework 2.0. I have found 2 messages on google discussing the same issue but there are no replys It dumps saying something like System.InvalidOperationException: Adding the tip to the native ToolTip control did not succeed.
1
2519
by: Mike | last post by:
Hi: I have been trying to create a web application that provides suport for two membership/profile databases: one for private users and one for another set of users. These tw user have a totally different set of profile attributes. I added the following code to my web.config (under system.web): <membership defaultProvider="PortalMembershipProvider">
0
1580
Pakmarshal
by: Pakmarshal | last post by:
Hello Everyone, While working with list view control in VB 2005, I observed a behavior that the tooltip for the control is not consistent i.e. if we closely observe that when the tooltip displays then one can find that some time when you move the cursor in the control, tooltip won’t be displayed. For further investigation I tried to observe the behavior of other such controls e.g. Treeview, listbox and textbox (Multiline). I have observed the...
0
8256
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8694
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
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 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...
1
8356
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,...
0
8497
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 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...
0
4089
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...
0
4193
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1500
bsmnconsultancy
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...

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.