日期:2014-05-18 浏览次数:21391 次
设置SelectionStart 属性,例如 private void textBox1_MouseClick(object sender, MouseEventArgs e) { textBox1.SelectionStart = 1; }
------解决方案--------------------
http://topic.csdn.net/t/20040726/15/3211168.html
------解决方案--------------------
不用吧。。本来就是指到哪里点到哪里的。。你看看是不是还有别的事件加载。。
------解决方案--------------------
用的到的,好
------解决方案--------------------
public void textBoxEmpty_Validating(object sender, CancelEventArgs e) { TextBox tb = (TextBox)sender; if (tb.Text.Length == 0) { tb.BackColor = Color.Red; tb.Tag = false; // e.Cancel = true; } else { tb.BackColor = System.Drawing.SystemColors.Window; tb.Tag = true; } validateOK(); } public void textBox_TextChanged(object sender, EventArgs e) { TextBox tb = (TextBox)sender; if (tb.Text.Length == 0) { tb.BackColor = Color.Red; tb.Tag = false; //e.Cancel = true; } else { tb.BackColor = System.Drawing.SystemColors.Window; tb.Tag = true; } validateOK(); }
------解决方案--------------------
validateOK();里面是啥?