⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 [Visual C# 2005程序设计基础教程] 全部的源码!非常经典
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace FontSamp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Font fnt1 = new Font("Verdana", 16, FontStyle.Bold);  //实例化一个Font对象
            Graphics g = e.Graphics;       //获取画布
            //以特定的字体与画刷向画布输出字符
            g.DrawString("Hello World!", fnt1, new SolidBrush(Color.Red), 10, 10);

            FontFamily Fmly = new FontFamily("Times New Roman");
            //利用一组相似字体实例化不同Font对象
            Font green28 = new Font(Fmly, 28);
            Font red14Italic = new Font(Fmly, 14, FontStyle.Italic);
            g.DrawString("Hello C# !", green28, new SolidBrush(Color.Green), 10, 50);

            g.DrawString("Hello GDI+ !", red14Italic, new SolidBrush(Color.Red), 10, 90);

        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -