zoukankan      html  css  js  c++  java
  • winform记事本初步实现

     public Form1()
            {
                InitializeComponent();
            }
    
            private void 剪切TToolStripMenuItem_Click(object sender, EventArgs e)
            {
                richTextBox1.Cut();
            }
    
            private void 复制CToolStripMenuItem_Click(object sender, EventArgs e)
            {
                richTextBox1.Copy();
            }
    
            private void 粘贴PToolStripMenuItem_Click(object sender, EventArgs e)
            {
                richTextBox1.Paste();
            }
    
            private void 撤消UToolStripMenuItem_Click(object sender, EventArgs e)
            {
                richTextBox1.Undo();
            }
    
            private void 重复RToolStripMenuItem_Click(object sender, EventArgs e)
            {
                richTextBox1.Redo();
            }
    
            private void 全选AToolStripMenuItem_Click(object sender, EventArgs e)
            {
                richTextBox1.SelectAll();
            }
    
            private void toolStripStatusLabel2_Click(object sender, EventArgs e)
            {
                
            }
    
            private void 自动换行ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                if (richTextBox1.WordWrap)
                {
                    自动换行ToolStripMenuItem.Checked = false;
                    richTextBox1.WordWrap = false;
                    toolStripStatusLabel4.Text = "1";
                    toolStripStatusLabel6.Text = richTextBox1.TextLength.ToString();
                }
                else
                {
                    自动换行ToolStripMenuItem.Checked = true;
                    richTextBox1.WordWrap = true;
                }
            }
    
            private void richTextBox1_TextChanged(object sender, EventArgs e)
            {
                toolStripStatusLabel2.Text = richTextBox1.TextLength.ToString();//字符数
    
                toolStripStatusLabel4.Text = richTextBox1.Lines.Length.ToString();//行号
               
                toolStripStatusLabel6.Text = (richTextBox1.SelectionStart - richTextBox1.GetFirstCharIndexOfCurrentLine()).ToString();//焦点所在列数
            }
    
            private void richTextBox1_Click(object sender, EventArgs e)
            {
                toolStripStatusLabel6.Text = (richTextBox1.SelectionStart - richTextBox1.GetFirstCharIndexOfCurrentLine()).ToString();//焦点所在列数
                
                int index = richTextBox1.GetFirstCharIndexOfCurrentLine();//GetFirstCharIndexOfCurrentLine()当前行第一个字符的索引
                //GetLineFromCharIndex(index)指定位置的索引行号
                toolStripStatusLabel4.Text = (richTextBox1.GetLineFromCharIndex(index) + 1).ToString();//焦点所在行号
            }
  • 相关阅读:
    搭建NLP相关的python环境
    win10 系统更新后系统第三方软件无法切换微软拼音输入中文
    NLP文本清理时常用的python小函数
    python 复制
    #论文阅读# Universial language model fine-tuning for text classification
    conda 里的 jupyter
    #论文阅读#attention is all you need
    关于多类别分类任务
    大白话AOP
    搭建JavaEE项目是遇到的几个问题
  • 原文地址:https://www.cnblogs.com/maxin991025-/p/6158158.html
Copyright © 2011-2022 走看看