我向我的应用程序添加了一个工具提示。为什么工具提示不显示?
在控件(DataGridView)中,我希望它显示提示/工具提示,我在“Tooltip on”属性中添加了语句。但是我的言辞没有显示(没有什么确切的)。
为什么?
我添加了一个相关的按钮,它工作得很好。也许DGV本身无法处理工具提示?
新增
下面是一个说明问题
using System;
using System.Drawing;
using System.Windows.Forms;
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var form = new Form {
Controls = {
new Button { Name = "button", Location = new Point(10, 10) },
new DataGridView { Name = "dgv", Location = new Point(10, 50) },
},
};
var tooltip = new ToolTip();
tooltip.SetToolTip(form.Controls["button"], "Button Tooltip");
tooltip.SetToolTip(form.Controls["dgv"], "DGV Tooltip");
Application.Run(form);
GC.KeepAlive(tooltip); // it's cheaper than implementing IContainer on the form for this demo
}
}
你可以显示如何添加这个代码示例..? – MethodMan
这很容易复制。从这里复制和粘贴代码要比将DGV和工具提示放到表单上并设置DGV的扩展属性需要更长的时间。一个完全有效的问题。 – Tergiver
无代码 - 我刚删除组件,并将文本输入到DGV的属性中。 –