[英]how to type and mark a tabulation in a textbox control C#
我需要输入一个要插入MySQL数据库的文本,这个文本总是包含制表例如“/ t”当我输入Tab键时,同一表格中的另一个控件将重点我有一种方法来禁用这种行为programaticaly在C#语言中,所以我可以标记文本里面的列表谢谢。
I believe that you need to accomplish this in a WindowsForms application to both implement the following method in your Form: 我相信您需要在WindowsForms应用程序中完成此操作,以在您的表单中实现以下方法:
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == Keys.Tab) { textBox1.Text += "\\t"; // Set the selection on the end of text. textBox1.SelectionStart = textBox1.Text.Length; textBox1.ScrollToCaret(); return true; }
return base.ProcessCmdKey(ref msg, keyData);
}
Check the following solution http://www.geekzilla.co.uk/ViewA94BBC8A-8DC4-4F14-98F9-DEDFCF40DA07.htm 检查以下解决方案http://www.geekzilla.co.uk/ViewA94BBC8A-8DC4-4F14-98F9-DEDFCF40DA07.htm
Although it is just for IE but it will give you the idea about what you haev to do 虽然它只适用于IE,但它会让你了解你将要做什么
You can use a javascript for this 你可以使用javascript
textarea.observe('keydown', function (e) {
if(e.keyCode==9) {
e.element().insert("\t");
e.stop();
}
}
here is also more information about it : 这里还有关于它的更多信息:
http://ajaxian.com/archives/handling-tabs-in-textareas http://ajaxian.com/archives/handling-tabs-in-textareas
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.