我没有在控件上添加工具提示,无论是在设计器中还是在代码中都没有。 但是当我将鼠标悬停在TreeView的某些项上时,会出现一个类似于项目名称的工具提示窗口消息。
不知道为什么有些项目会有工具提示。
我在设计器中注册的TreeView控件唯一的事件是AfterSelect。
private void tvFolders_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
{
//Populate folders and files when a folder is selected
this.Cursor = Cursors.WaitCursor;
//get current selected drive or folder
TreeNode nodeCurrent = e.Node;
//clear all sub-folders
nodeCurrent.Nodes.Clear();
if (nodeCurrent.SelectedImageIndex == 0)
{
//Selected My Computer - repopulate drive list
PopulateDriveList();
}
else
{
//populate sub-folders and folder files
PopulateDirectory(nodeCurrent, nodeCurrent.Nodes);
}
this.Cursor = Cursors.Default;
}
在设计师中。
this.tvFolders.Dock = System.Windows.Forms.DockStyle.Left;
this.tvFolders.ImageIndex = 0;
this.tvFolders.ImageList = this.m_imageListTreeView;
this.tvFolders.Location = new System.Drawing.Point(0, 0);
this.tvFolders.Name = "tvFolders";
this.tvFolders.SelectedImageIndex = 0;
this.tvFolders.Size = new System.Drawing.Size(168, 357);
this.tvFolders.TabIndex = 2;
this.tvFolders.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvFolders_AfterSelect);
//
// m_imageListTreeView
//
this.m_imageListTreeView.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("m_imageListTreeView.ImageStream")));
this.m_imageListTreeView.TransparentColor = System.Drawing.Color.Transparent;
this.m_imageListTreeView.Images.SetKeyName(0, "");
this.m_imageListTreeView.Images.SetKeyName(1, "");
this.m_imageListTreeView.Images.SetKeyName(2, "");
this.m_imageListTreeView.Images.SetKeyName(3, "");
this.m_imageListTreeView.Images.SetKeyName(4, "");
this.m_imageListTreeView.Images.SetKeyName(5, "");
this.m_imageListTreeView.Images.SetKeyName(6, "");
this.m_imageListTreeView.Images.SetKeyName(7, "");
this.m_imageListTreeView.Images.SetKeyName(8, "");
我希望当我将鼠标移动到TreeView(tvFolders)中的项目上时,它会显示一个工具提示消息。
为什么有些项目会显示工具提示消息而我没有添加任何内容?
如何使当我将鼠标移到TreeView中的项目上时,它会显示一个带有项目名称的工具提示消息?