记事本和winform 容器控件

本文介绍了一个简单的C# WinForms应用程序,演示如何使用TextBox控件实现基本的文本编辑功能,如撤消、重复、剪切、复制、粘贴等,并展示了如何实时更新文本长度。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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 WindowsFormsApplication6
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

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

        private void 重复RToolStripMenuItem_Click(object sender, EventArgs e)
        {
            
        }

        private void 剪切TToolStripMenuItem_Click(object sender, EventArgs e)
        {
            textBox1.Cut();
        }

        private void 复制CToolStripMenuItem_Click(object sender, EventArgs e)
        {
            textBox1.Copy();
        }

        private void 粘贴PToolStripMenuItem_Click(object sender, EventArgs e)
        {
            textBox1.Paste();
        }

        private void 退出XToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void 选项OToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            string a = textBox1.Text.Length.ToString();
            toolStripStatusLabel2.Text = a;
        }
    }
}

 

 

 

--------------菜单和工具栏--------------------------------

ContextMenuStrip---------右键菜单栏
MenuStrip------------顶部菜单栏
statusStrip----------底部菜单栏
ToolStrip------------工具栏
ToolStripContainer-----(四周可以放置 菜单、控件)

---------容器------------------------------


FlowLayoutPanel--------(内部控件)流式布局

GroupBox----------控件分组 有边框、标题

----
Panel-----------控件分组 无边框、标题

---
SplitContainer-----就是两个Panel

---

TabControl--------带标签的选项卡

---
TableLayoutPanel---------类似表格 一格只能放一个控件

 


--------LisView控件-------------------------------------
类似一个表 
可显示数据库内容

记事本

 

转载于:https://www.cnblogs.com/fengsantianya/p/5628393.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值