C# 如何在C中添加带有TabIndex的工具提示#
我正在尝试使用C#向软件添加工具提示。C# 如何在C中添加带有TabIndex的工具提示#,c#,winforms,C#,Winforms,我正在尝试使用C#向软件添加工具提示。 我的问题是,他们要求我在使用tabIndex时激活 这是我用来用光标显示工具提示的代码 public partial class Login : Form { public Login() { InitializeComponent(); this.tthelp.SetToolTip(this.cbxUser, "Select a user"); this.tthelp.SetToolTip
我的问题是,他们要求我在使用tabIndex时激活 这是我用来用光标显示工具提示的代码
public partial class Login : Form
{
public Login()
{
InitializeComponent();
this.tthelp.SetToolTip(this.cbxUser, "Select a user");
this.tthelp.SetToolTip(this.txtPas, "Enter your password");
this.tthelp.SetToolTip(this.btnLogin, "Click on the button or you can enter");
}
//(...)
}
您可以将其添加到控件的Entry and Leave事件中 比如说,
var controlTooltipDictionary = new Dictionary<Control, string>
{
[txtUser] = "Select a user",
[txtPass] = "Enter your password"
};
foreach (var item in controlTooltipDictionary)
{
item.Key.Enter += (s, ea) =>
{
tthelp.Show(item.Value,item.Key);
};
item.Key.Leave += (s, ea) =>
{
tthelp.Hide(this);
};
}
var-controlTooltipDictionary=新字典
{
[txtUser]=“选择一个用户”,
[txtPass]=“输入您的密码”
};
foreach(controlTooltipDictionary中的变量项)
{
item.Key.Enter+=(s,ea)=>
{
tthelp.Show(item.Value,item.Key);
};
item.Key.Leave+=(s,ea)=>
{
tthelp.Hide(这个);
};
}
它们在使用tabIndex时激活。你能详细说明一下吗?