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

你可能感兴趣的文章
numpy 数组与矩阵的乘法理解
查看>>
NumPy 数组拼接方法-ChatGPT4o作答
查看>>
numpy 用法
查看>>
Numpy 科学计算库详解
查看>>
Numpy.fft.fft和numpy.fft.fftfreq有什么不同
查看>>
Numpy.ndarray对象不可调用
查看>>
Numpy.VisibleDeproationWarning:从不整齐的嵌套序列创建ndarray
查看>>
Numpy:按多个条件过滤行?
查看>>
Numpy:条件总和
查看>>
numpy、cv2等操作图片基本操作
查看>>
numpy中的argsort的用法
查看>>
NumPy中的精度:比较数字时的问题
查看>>
numpy判断对应位置是否相等,all、any的使用
查看>>
Numpy多项式.Polynomial.fit()给出的系数与多项式.Polyfit()不同
查看>>
Numpy如何使用np.umprod重写range函数中i的python
查看>>
numpy学习笔记3-array切片
查看>>
numpy数组替换其中的值(如1替换为255)
查看>>
numpy数组索引-ChatGPT4o作答
查看>>
NUMPY矢量化np.prod不能构造具有超过32个操作数的ufunc
查看>>
Numpy矩阵与通用函数
查看>>