右键单击获取用户输入 [英] Getting an user Input on Right click
本文介绍了右键单击获取用户输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个树视图我希望用户按照自己的意愿重新排序树节点。
我可以实现拖放但是没有节点超过600,这是不可能拖放。
所以我打算实施一个上下文菜单,右键点击节点,询问用户指定要放置在其下方/上方的节点位置。
如何实现此功能以及使用什么控件可能??
I got a tree view And i want the user to re sequence the tree nodes as he wishes .
I could implement drag and drop but the no of nodes go above 600 which is impossible to drag and drop .
So i plan to Implement a context menu right click on node which asks the user to specify the node position below/above which it wants to place.
How can implement this feature and with what controls is it possible??
推荐答案
要做的步骤:
1)添加ContextMenuStrip(名称:ContextMenuStrip1)
2 )添加到contextMenuStrip ToolStripTextBox(名称:ToolStripTextBox1)
3)添加以下代码:
Steps to do:
1) Add ContextMenuStrip (Name: ContextMenuStrip1)
2) Add to contextMenuStrip ToolStripTextBox (Name: ToolStripTextBox1)
3) Add below code:
private void toolStripTextBox1_KeyUp(object sender, KeyEventArgs e)
{
ToolStripTextBox tsb = (ToolStripTextBox)sender;
if(e.KeyCode == Keys.Enter )
MessageBox.Show(tsb.Text);
}
这篇关于右键单击获取用户输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文