博客
关于我
c# GDI绘制简单的艺术字
阅读量:313 次
发布时间:2019-03-04

本文共 1598 字,大约阅读时间需要 5 分钟。

    
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;using System.Drawing.Drawing2D;using System.Drawing.Imaging;namespace yishuzi{    public partial class Form1 : Form    {        private Bitmap bu;        private Graphics pen;        private Font f;        private LinearGradientBrush b;        private Point p;        public Form1()        {            InitializeComponent();            bu = new Bitmap(this.pbox.Width, this.pbox.Height);            pen = Graphics.FromImage(bu);            f = new Font("@方正舒体", 60, FontStyle.Bold | FontStyle.Italic);            b = new LinearGradientBrush(new Point(0, 0), new Point(0, 100), Color.Red, Color.Yellow);        }        private void huatu()        {            string s = this.tbox.Text;            if (s.Length == 0)                return;            int n = s.Length;            for (int i = 0; i < n; i++)            {                p = new Point(70 * i, 0);                pen.DrawString(s[i].ToString(), f, b, p);            }        }        private void tbox_TextChanged(object sender, EventArgs e)        {            pen.Clear(Color.White);            huatu();            pbox.Image = bu;        }        private void button1_Click(object sender, EventArgs e)        {            SaveFileDialog save = new SaveFileDialog();            save.Filter = "(*.ico)|*.ico|(*.png)|*.png";            if (save.ShowDialog() == DialogResult.OK)            {                bu.Save(save.FileName);            }        }    }}

转载地址:http://eajq.baihongyu.com/

你可能感兴趣的文章
Skywalking原理
查看>>
PAT甲级——1006 Sign In and Sign Out (25分)
查看>>
PAT甲级——1007 Maximum Subsequence Sum (25分)
查看>>
PAT甲级——1009 Product of Polynomials (25分)(最后一个测试点段错误)
查看>>
Spring对jdbc的支持
查看>>
vagrant 的安装
查看>>
PayPal网站付款标准版(for PHP)
查看>>
Paystack Android SDK 集成与使用指南
查看>>
pbf格式详解,javascript加载导出pbf文件示例
查看>>
PBOC2.0与3.0的区别
查看>>
PbootCMS entrance.php SQL注入漏洞复现
查看>>
PbootCMS 前台RCE漏洞复现
查看>>
PBT
查看>>
PB级分析型数据库ClickHouse的应用场景和特性
查看>>
pc3-12800
查看>>
PCA---主成成分分析
查看>>
PCA和自动编码器:每个人都能理解的算法
查看>>
pca算法
查看>>
PCA降维demo
查看>>
SharePoint 2013 图文开发系列之定义站点模板
查看>>