向以编程方式创建的控件添加工具提示
我在 winforms c# 应用程序上创建了一堆按钮。我使用以下代码创建了它们
int s = 0;//28 buttons
ButtonNameArray barray = new ButtonNameArray();
frontPanelButtons fpb = new frontPanelButtons();
int xLoc = fpb.xLoc(fpb);
int yLoc = fpb.yLoc(fpb);
for (int i = 0; i < 7; i++)
{
for (int j = 0; j < 4; j++)
{
Button btn = new Button();
btn.Name = barray.getName(btn.Name, s);
btn.Text = barray.getText(btn.Text, s);
btn.Width = fpb.btnWide(fpb);
btn.Height = fpb.btnHigh(fpb);
btn.Location = new System.Drawing.Point(xLoc, yLoc);
Controls.Add(btn);
xLoc += 100;
s++;
}
yLoc += 31;
xLoc = fpb.xLoc(fpb);
}
,我想为每个按钮添加一个独特的工具提示,但不知道如何操作。有人可以提供帮助/答案吗?非常感谢。
I have a bunch of buttons created on a winforms c# app. I have created them using the following code
int s = 0;//28 buttons
ButtonNameArray barray = new ButtonNameArray();
frontPanelButtons fpb = new frontPanelButtons();
int xLoc = fpb.xLoc(fpb);
int yLoc = fpb.yLoc(fpb);
for (int i = 0; i < 7; i++)
{
for (int j = 0; j < 4; j++)
{
Button btn = new Button();
btn.Name = barray.getName(btn.Name, s);
btn.Text = barray.getText(btn.Text, s);
btn.Width = fpb.btnWide(fpb);
btn.Height = fpb.btnHigh(fpb);
btn.Location = new System.Drawing.Point(xLoc, yLoc);
Controls.Add(btn);
xLoc += 100;
s++;
}
yLoc += 31;
xLoc = fpb.xLoc(fpb);
}
And I would like to add a unique tooltip to each button but can't figure out how to do it. Could anyone please supply help/the answer? Many thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)