03-图像操作/图片上绘制文字/ImageFont/Form1.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ImageFont
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
if (textBox1.Text.Length != 0 && pictureBox1.Image != null)
{
Bitmap bt = new Bitmap(pictureBox1.Image);
string myfont = textBox1.Text.Trim();
Graphics g = Graphics.FromImage(bt);
g.DrawString(textBox1.Text.Trim(), new Font("宋体", 50), new SolidBrush(Color.Red), new PointF(10,10));
pictureBox1.Image = bt;
}
}
private void button1_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image = Image.FromFile(openFileDialog1.FileName);
}
}
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
