B. *_*non 0 c# datagridview tooltip winforms
我在我的应用中添加了一个工具提示.
在我希望它显示提示/工具提示的控件(DataGridView)中,我在"Tooltip on"属性中添加了verbiage.但是我的措辞没有显示(确切地说没有任何内容).
为什么?
我在一个相关的按钮上添加了verbiage,它运行得很好.也许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
}
}
Run Code Online (Sandbox Code Playgroud)