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

你可能感兴趣的文章
OWASP漏洞原理<最基础的数据库 第二课>
查看>>
OWL本体语言
查看>>
P with Spacy:自定义文本分类管道
查看>>
P-DQN:离散-连续混合动作空间的独特算法
查看>>
P1035 I need help
查看>>
P1073 最优贸易
查看>>
P1364 医院设置
查看>>
spring缓存注解@Cacheable、@CacheEvict、@CachePut使用
查看>>
P1865 A % B Problem
查看>>
P2158 [SDOI2008]仪仗队
查看>>
P2260 [清华集训2012]模积和
查看>>
P3203 [HNOI2010]弹飞绵羊 —— 懒标记?分块?
查看>>
P3950部落冲突
查看>>
P4313 文理分科
查看>>
SpringBoot中集成LiteFlow(轻量、快速、稳定可编排的组件式规则引擎)实现复杂业务解耦、动态编排、高可扩展
查看>>
SpringBoot中集成influxdb-java实现连接并操作Windows上安装配置的influxDB(时序数据库)
查看>>
P8738 [蓝桥杯 2020 国 C] 天干地支
查看>>
package,source folder,folder相互转换
查看>>
SpringBoot中集成Flyway实现数据库sql版本管理入门以及遇到的那些坑
查看>>
package.json文件常用指令说明
查看>>