博客
关于我
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/

你可能感兴趣的文章
Nginx - 反向代理、负载均衡、动静分离、底层原理(案例实战分析)
查看>>
nginx 1.24.0 安装nginx最新稳定版
查看>>
nginx 301 永久重定向
查看>>
nginx css,js合并插件,淘宝nginx合并js,css插件
查看>>
Nginx gateway集群和动态网关
查看>>
Nginx Location配置总结
查看>>
Nginx log文件写入失败?log文件权限设置问题
查看>>
Nginx Lua install
查看>>
nginx net::ERR_ABORTED 403 (Forbidden)
查看>>
Nginx SSL私有证书自签,且反代80端口
查看>>
Nginx upstream性能优化
查看>>
Nginx 中解决跨域问题
查看>>
nginx 代理解决跨域
查看>>
Nginx 动静分离与负载均衡的实现
查看>>
Nginx 反向代理 MinIO 及 ruoyi-vue-pro 配置 MinIO 详解
查看>>
nginx 反向代理 转发请求时,有时好有时没反应,产生原因及解决
查看>>
Nginx 反向代理解决跨域问题
查看>>
Nginx 反向代理配置去除前缀
查看>>
nginx 后端获取真实ip
查看>>
Nginx 多端口配置和访问异常问题的排查与优化
查看>>