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 = "";
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) + ).ToString();//焦点所在行号
}

winform记事本初步实现的更多相关文章

  1. 本周博客--WinForm线程初步 2014-10-31 09:15 54人阅读 评论(0) 收藏

    嗯,WinForm作为一个比较程序的微软的技术已经为我们服务了很久很久,在技术不断更新的今天WinForm虽显老态龙钟但是在客户端快速开发中,它的地位还是无可取代的 今天就来分享一下WinForm中的 ...

  2. winform记事本(基本功能)

    本题主要考察各种控件的应用 using System; using System.Collections.Generic; using System.ComponentModel; using Sys ...

  3. C#+Winform记事本程序

    第17章 记事本 如何使用Visual C# 2010设计一个Windows应用程序——记事本,学习,可以进一步掌握MenuStrip(菜单).ToolStrip(工具栏).RichTextBox(高 ...

  4. winform(记事本的打印)

  5. winform(记事本--查找)

  6. winform(记事本--保存和退出)

  7. winform(记事本--剪切复制等和打开)

  8. winform 记事本 剪切 粘贴 全选 撤销

    private void 撤消UToolStripMenuItem_Click(object sender, EventArgs e) { textBox1.Undo(); } private voi ...

  9. 动态加载与插件系统的初步实现(3):WinForm示例

    动态加载与插件系统的初步实现(三):WinForm示例 代码文件在此Download,本文章围绕前文所述默认AppDomain.插件容器AppDomain两个域及IPlugin.PluginProvi ...

随机推荐

  1. Objective-C编码规范:26个方面解决iOS开发问题(转)

    链接

  2. Android系统介绍与框架(转)

    一.Andriod是什么? Android系统是Google开发的一款开源移动OS,Android中文名被国内用户俗称“安卓”.Android操作系统基于Linux内核设计,使用了Google公司自己 ...

  3. FreeMarker学习(宏<#macro>的使用)

    原文链接:https://my.oschina.net/weiweiblog/blog/506301?p=1 用户定义指令-使用@符合来调用  有两种不同的类型:Macro(宏)和transform( ...

  4. 使用yum来安装或卸载CentOS图形界面包

    命令行模式安装图形界面 yum grouplist 检查已安装的组 yum groupinstall "X Window System" yum groupinstall &quo ...

  5. java gui 之容器组件

    演示Frame和Panel package unit7; import java.awt.*; public class SimpleFrame { public static void main(S ...

  6. directive中的参数详解

    restrictE: 表示该directive仅能以element方式使用,即:<my-dialog></my-dialog>A: 表示该directive仅能以attribu ...

  7. DOM系列---基础篇

    DOM系列---基础篇   DOM (Document Object Model) 即文档对象模型, 针对 HTML 和 XML 文档的 API (应用程序接口) .DOM 描绘了一个层次化的节点树, ...

  8. Android App 性能优化实践

    本文记录了Android App优化需要用到的工具和以及在实践中的Tips.也算对我这半年来部分工作的总结. 工具 Hierarchy Viewer 是 Android SDK 自带的 Layout ...

  9. BestCoder Round #71 (div.2)

    数学 1001 KK's Steel 类似斐波那契求和 #include <cstdio> #include <cstring> #include <algorithm& ...

  10. The 2015 China Collegiate Programming Contest E. Ba Gua Zhen hdu 5544

    Ba Gua Zhen Time Limit: 6000/4000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total ...