运行效果:

代码:

 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; namespace FreeNotes
{
public partial class NotePad : Form
{
public NotePad()
{
InitializeComponent();
} /// <summary>
/// 打开文件事件
/// </summary>
private void btn_Open_Click(object sender, EventArgs e)
{
OpenFileDialog of = new OpenFileDialog(); of.DefaultExt = "*.rtf"; of.Filter = "rtf文件(*.rtf)|*.rtf|所有文件(*.*)|*.*"; if (of.ShowDialog() == DialogResult.OK && of.FileName.Length > )
{
richTextBox1.LoadFile(of.FileName, RichTextBoxStreamType.RichText);
}
} /// <summary>
/// 保存文件事件
/// </summary>
private void btn_Save_Click(object sender, EventArgs e)
{
SaveFileDialog sa = new SaveFileDialog(); sa.Title = "保存"; sa.FileName = "*.rtf"; sa.Filter = "rtf文件(*.rtf)|*.rtf|所有文件(*.*)|*.*"; sa.DefaultExt = "*.rtf"; if (sa.ShowDialog() == DialogResult.OK && sa.FileName.Length > )
{
richTextBox1.SaveFile(sa.FileName, RichTextBoxStreamType.RichText);
}
} /// <summary>
/// 字体事件
/// </summary>
private void btn_Font_Click(object sender, EventArgs e)
{
FontDialog fda = new FontDialog(); fda.ShowColor = true; if (fda.ShowDialog() != DialogResult.Cancel)
{
richTextBox1.SelectionFont = fda.Font;
richTextBox1.SelectionColor = fda.Color;
}
} /// <summary>
/// 清空文本事件
/// </summary>
private void btn_Clear_Click(object sender, EventArgs e)
{
richTextBox1.Clear();
}
}
}

WinForm 小程序 NotePad的更多相关文章

  1. visual studio 设计第一个WinForm小程序

    WinForm小程序之消息框 首先打开visual studio 软件,然后[文件]-[新建]-[项目]-[Visual C#]-[Windows],选择Windows窗体应用程序,根据自己的需要修改 ...

  2. C# WinForm小程序(技术改变世界-cnblog)

    WinForm小程序(技术改变世界-cnblog)   需求: 1.点击按钮  更新 当前时间 2.输入 身份证,必须身份证 排序(类似银行卡那样的空格),自动生成空格排序 3.实现 必须按 第一个按 ...

  3. winform小程序---猜拳小游戏

    因为学的时间不长,所以借鉴了一些资料做了这个小程序,大家共同学习,共同进步.感觉很有自信,世上无难事,只怕有心人. using System; using System.Collections.Gen ...

  4. C# Winform小程序:局域网设置NTP服务器、实现时间同步

    设置NTP服务器: NTP是网络时间协议(Network Time Protocol),它是用来同步网络中各个计算机的时间的协议. 局域网不能连接Internet,可以设置一台计算机为NTP服务器. ...

  5. TreeView控件之,后台构建TreeView(WinForm小程序)

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAX0AAAIdCAIAAABeBzrBAAAgAElEQVR4nOzdd5Qc130n+tl/nr3e5+

  6. WinForm版图像编辑小程序(实现图像拖动、缩放、旋转、抠图)

    闲暇之余,开发一个图片编辑小程序.程序主要特点就是可方便的对多个图像编辑,实现了一些基本的操作.本文主要介绍一下程序的功能.设计思路. 执行程序 下载地址: 百度网盘.https://pan.baid ...

  7. 空闲时间研究一个小功能:winform桌面程序如何实现动态更换桌面图标

    今天休息在家,由于天气热再加上疫情原因,就在家里呆着,空闲时想着,在很早以前(约3年前),产品人员跟我提了一个需求,那就是winform桌面程序的图标能否根据节日动态更换,这种需求在移动APP上还是比 ...

  8. .NET WinForm画树叶小程序

    看了一片文章(http://keleyi.com/a/bjac/nurox416.htm),是使用分型画树叶,代码是Java的,因为Java很久没弄了,改用C#实现,下载地址: 画树叶小程序下载 核心 ...

  9. C# winform线程的使用 制作提醒休息小程序(长时间计算机工作者必备)

    最近发现日常的工作中,经常因为敲代码而忘记了休息,晚上眼睛特别的累. 并且经常长时间看着显示器,对眼睛一定是不好的,所以今天开发了一个小程序,用于提醒休息. 下面先看看运行效果: 1.程序启动后,后台 ...

随机推荐

  1. out/target/common/obj/PACKAGING/public_api.txt android.view.KeyEvent.KEYCODE_has changed value from

    编译出错: out/target/common/obj/PACKAGING/public_api.txt:22549: error 17: Field android.view.KeyEvent.KE ...

  2. hdu 1085 Holding Bin-Laden Captive! (母函数)

    //给你面值为1,2,5的三种硬币固定的数目,求不能凑出的最小钱数 //G(x)=(1+x+...+x^num1)(1+x^2+...+x^2num2)(1+x^5+,,,+x^5num3), //展 ...

  3. UC/0S2之中断

    中断是计算机系统处理异步事件的重要机制.当异步事件发生时,事件通常是通过硬件向cpu发出中断请求的.在一般情况下,cpu响应这个请求后会立即运行中断服务程序来处理该事件: 为了处理任务延时.任务调度等 ...

  4. 如何在UILable上添加点击事件?

    最近开始学习iOS开发,今天上来写第一个iOS笔记 昨天碰到一个需求,在UILable上添加点击事件,网上找了写资料,有人建议用透明的UIButton覆盖,有人建议写一个集成自UILable的类,扩展 ...

  5. mbed 初试(LinkNode 板卡)(2016-04-21)

    前言 感谢论坛,感谢 LinkSrite,论坛活动申请了一个 LinkNode,体验了一下 mbed. 翻看完官方 wiki,大概了解了一下 mbed 的开发,然后做了 blink 和 pwm 的测试 ...

  6. 杭电ACM 2052 Picture

    Picture Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Su ...

  7. BZOJ 1627: [Usaco2007 Dec]穿越泥地( BFS )

    BFS... --------------------------------------------------------------------------------------- #incl ...

  8. python pythonic是什么?

    原文地址:http://faassen.n--tree.net/blog/view/weblog/2005/08/06/0 注:Martijn 是 Zope 领域的专家,他为 Zope 系列产品做了许 ...

  9. 基于visual Studio2013解决C语言竞赛题之0304整除数

      题目 解决代码及点评 按照题目要求,判断数值对3和5取模的结果,是否为0 #include <stdio.h> #include <stdlib.h> void m ...

  10. LA-3135 - Argus(优先队列)

    3135 - Argus A data stream is a real-time, continuous, ordered sequence of items. Some examples incl ...