VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > c#编程 >
  • 用C#写一个记事本四

  1. 字体选择:
    直接调用控件python基础教程
    即可
   private void 字体ToolStripMenuItem_Click(object sender, EventArgs e)
    {
        //提示用户从本地计算机安装的字体中选择字体字号
        FontDialog fontDialog = new FontDialog();
        if (fontDialog.ShowDialog() == DialogResult.OK)
        {
            txtBox.Font = fontDialog.Font;
        }
    }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

在这里插入图片描述 在这里插入图片描述

  1. 关于记事本: 新建一个窗口,根据自己的喜好添加标签及摆放位置
private void 关于记事本ToolStripMenuItem_Click(object sender, EventArgs e)
{
    //关于记事本说明
    Label lblTitle = new Label()
    {
        Text = "多功能记事本",
        Size = new Size(150, 25),
        Location = new Point(100, 50)
    };
    Label lblEdition = new Label()
    {
        Text = "版本号:个性测试版",
        Size = new Size(150, 25),
        Location = new Point(85, 100)
    };
    Label lblMail = new Label()
    {
        Text = "E-Mail:",
        Size = new Size(55, 25),
        Location = new Point(30, 180)
    };
    LinkLabel llblMail = new LinkLabel()
    {
        Text = "2417525822@qq.com",
        Size = new Size(110, 25),
        Location = new Point(85, 180)
    };
    Label lblCNDS = new Label()
    {
        Text = "CNDS博客:",
        Size = new Size(65, 25),
        Location = new Point(20, 220)
    };
    LinkLabel llblCNDS = new LinkLabel()
    {
        Text = "https://blog.csdn.net/UFO_Harold",
        Size = new Size(200, 25),
        Location = new Point(85, 220)
    };
    Form about = new Form
    {
        Text = "关于记事本",
        FormBorderStyle = FormBorderStyle.FixedSingle,
        MaximizeBox = false
    };

    llblCNDS.Click += new EventHandler(LlblCNDS_Click);
    about.Controls.Add(lblTitle);
    about.Controls.Add(lblEdition);
    about.Controls.Add(lblMail);
    about.Controls.Add(llblMail);
    about.Controls.Add(lblCNDS);
    about.Controls.Add(llblCNDS);
    about.Top = this.Top + this.Height / 2 - about.Height / 2;
    about.Left = this.Left + this.Width / 2 - about.Width / 2;
    about.StartPosition = FormStartPosition.CenterParent;
    about.ShowDialog();
}
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58

程序的关于记事本功能展c#教程


相关教程