|
-
Aug 31st, 2005, 02:37 PM
#1
Thread Starter
Hyperactive Member
adding tooltip to dynamic controls [resolved]
I am adding a grid of command buttons to a user control. I am having trouble adding the tooltiptext at runtime. I have a tooltip control added to the user control form. Here is the code where I want to add it:
Code:
int x=0,y=0;
p_socks=new Button[iX,iY];
try
{
for(x=0;x<iX;x++)
{
for(y=0;y<iY;y++)
{
//set socket's back color to default backcolor;
//p_sockColor[x,y]=p_defaultColor;
//no need to create sockets again
if(socketsCreated)
return true;
//generate socket name
string butName=x.ToString()+(char)(y+'A');
//add new buttons
p_socks[x,y]=new Button();
this.Controls.Add(p_socks[x,y]);
p_socks[x,y].Location = new System.Drawing.Point(10, 10);
p_socks[x,y].Name = "butX"+x+"Y"+y;
p_socks[x,y].Size = new System.Drawing.Size(20, 20);
p_socks[x,y].TabIndex = 20;
p_socks[x,y].Click+=new System.EventHandler(sockClickHand);
//p_socks[x,y].tooltip????????????????
}
}
this.Refresh();
return true;
}
thx
Last edited by Sneeden; Aug 31st, 2005 at 02:49 PM.
balls deep in bad code
-
Aug 31st, 2005, 02:44 PM
#2
Fanatic Member
Re: adding tooltip to dynamic controls
You can't set the tooltip using some control property, you'll have to add a tooltip component to your usercontrol and call ToolTip1.SetToolTip(AndSoOn) for each of your buttons.
Greetings
"so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman
-
Aug 31st, 2005, 02:48 PM
#3
Thread Starter
Hyperactive Member
Re: adding tooltip to dynamic controls
Great, thx. It worked.
Here is what the solution looks like:
Code:
for(x=0;x<p_xSockets;x++)
for(y=0;y<p_ySockets;y++)
toolTip1.SetToolTip(p_socks[x,y],p_sockRouting[x,y]);
-
Aug 31st, 2005, 02:50 PM
#4
Fanatic Member
Re: adding tooltip to dynamic controls [resolved]
That's right, now rep me you....
"so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|