xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 0.03M
    文件類型: .7z
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-02-23
  • 語言: C#
  • 標簽: 插入??C#??

資源簡介

在光標處插入寫入內(nèi)容,如果用戶前臺有選中的內(nèi)容,那么先刪除選中的內(nèi)容,然后在原來的選中位置插入。代碼雖然簡單,但合適就好,有實例,帶vs項目源碼。

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;

namespace?WindowsFormsApplication2
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}

????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????int?idx?=?richTextBox1.Selectionstart;
????????????string?inputtext?=?“測試插入“;

????????????if?(richTextBox1.SelectionLength?>?0)
????????????{
????????????????richTextBox1.Text?=?richTextBox1.Text.Remove(richTextBox1.Selectionstart?richTextBox1.SelectionLength);//從光標位置開始刪除選中的長度,即刪除選中的內(nèi)容;Remove只是執(zhí)行,不對文本框操作;
????????????}

????????????richTextBox1.Text?=?richTextBox1.Text.Insert(idx?inputtext);
????????????richTextBox1.Selectionstart?=?idx?+?inputtext.Length;
????????}

????????private?void?Form1_Load(object?sender?EventArgs?e)
??

評論

共有 條評論