好象是:
this.textbox1.selectedTEXT="我的"
this.textbox1.selectedTEXT="我的"
解决方案 »
- 求大神帮忙 郁闷死我了!
- 请问,如何访问菜单控件的子项的子项
- 关于窗体命名的问题
- 从stringbuilder中读取xml,里面有中文,怎么办?
- 学ASP.NET和EXT很不错的开源包.google写的.
- [100分问题] 项目之间自定义控件调用的问题
- Remoting如何通过windows登陆认证?
- 如何将 字符串(字符串中是二进制的字符串形式) 转换成 二进制,有挑战性哦
- 请问,如何在XAML中创建一个集合
- C#的WinForm编程中,Button是否有类似于WebForm中的ToolTip或者Delphi的Hint功能?
- 答谢专用1
- 我在设计时对datagrid进行了数据绑定,怎么运行时数据显示不出来呀!
str1 = this.textBox1.Text.Substring(0,this.textBox1.SelectionStart);
str2 = this.textBox1.Text.Substring(this.textBox1.SelectionStart,this.textBox1.Text.Length - this.textBox1.SelectionStart);
this.textBox1.Text = str1 + "我爱" + str2;
{
int i = this.textBox1.SelectionStart;
string s = this.textBox1.Text;
s = s.Insert(i,"xx");
this.textBox1.Text = s;
}
的代码清晰简洁
Point P=new Point(0);
GetCaretPos(ref P);
int Pos=this.richTextBox1.GetCharIndexFromPosition(P);
this.Y=this.richTextBox1.GetLineFromCharIndex(Pos); if (this.Y>0)
{
int offset=1;
while(this.richTextBox1.Text[Pos-offset]!='\n')
offset++;
this.X=offset;
this.Y++;
}
else
{
this.X=Pos+1;
this.Y=1;
} MessageBox.Show("当前位置: 第"+this.Y.ToString()+"行 "+"第"+this.X.ToString()+"列");
以上代码可以将光标位置求出来。
请问插入字符串的方法名是什么?
richTextBox也有这个属性 SelectionStart
private void button1_Click(object sender, System.EventArgs e)
{
int i = this.richTextBox1.SelectionStart;
string s = this.richTextBox1.Text;
s = s.Insert(i,"xx");
this.richTextBox1.Text = s;
}
function cc()
{
var e = event.srcElement;
var r =e.createTextRange();
r.moveStart('character',e.value.length);
r.collapse(true);
r.select();
}
</script>
<input type=text name=text1 value="123" onfocus="cc()">
倒,我还以为winform
呵呵
richTextBox1.insert
===========================================================
richTextBox1.insert的第一个参数int startindex你是怎么取得的?to:闭关|那一剑的风情
==============================
前辈,我就是在winform下
{
int i = this.textBox1.SelectionStart;
string s = this.textBox1.Text;
s = s.Insert(i,"xx");
this.textBox1.Text = s;
}