最近宝强哥图片很火啊.写了一个生成器玩玩.

by_封爱 版主 2013-01-13 02:12:24
加精

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Text;
using System.Windows.Forms;
namespace baobao
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Image image = null;
private void Form1_Load(object sender, EventArgs e)
{
image = pictureBox1.Image;
}

private void button1_Click(object sender, EventArgs e)
{

try
{
Graphics g = Graphics.FromImage(image);
Font font = new System.Drawing.Font("微软雅黑", 12, (System.Drawing.FontStyle.Bold));
LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, image.Width, image.Height), Color.White, Color.White, 1.2f, true);
g.DrawString(textBox1.Text, font, brush, 100, 184);
g.DrawString(textBox2.Text, font, brush, 100, 417);
g.DrawString(textBox3.Text, font, brush, 100, 650);
g.Dispose();

pictureBox1.Image = image;

Clipboard.SetDataObject(pictureBox1.Image);
MessageBox.Show("当前图片已经成功复制到剪贴板.请粘贴到QQ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

}
catch (Exception ex)
{

MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

}

private void button2_Click(object sender, EventArgs e)
{
this.pictureBox1.Image = global::baobao.Properties.Resources._20130110160920029;
}

}
}




瞎写的高手勿喷啊...



点我下载
...全文
16444 222 打赏 收藏 转发到动态 举报
写回复
用AI写文章
222 条回复
切换为时间正序
请发表友善的回复…
发表回复
Skip_1 2015-05-11
  • 打赏
  • 举报
回复
,刚学,请问是为什么错哪里了,还有人能看到吗。。
beifang1986 2013-06-18
  • 打赏
  • 举报
回复
好玩,,,,
scorpiuszxz 2013-05-27
  • 打赏
  • 举报
回复
丨Barneyx 2013-05-22
  • 打赏
  • 举报
回复
呵呵,不错.....
tyg111 2013-04-08
  • 打赏
  • 举报
回复
很好玩,很不错的想法,呵呵
chriswu92 2013-03-03
  • 打赏
  • 举报
回复
菜鸟求教
this.pictureBox1.Image = global::baobao.Properties.Resources.
后面加图片名吗?为什么报错应加";"?
qdn19880605 2013-02-28
  • 打赏
  • 举报
回复
cdaarons 2013-01-23
  • 打赏
  • 举报
回复
哎哟,不错哦
chenyuling101 2013-01-23
  • 打赏
  • 举报
回复
有才!!
星小野 2013-01-22
  • 打赏
  • 举报
回复
keirajing 2013-01-22
  • 打赏
  • 举报
回复
Hi幸福来敲门 2013-01-22
  • 打赏
  • 举报
回复
stherix 2013-01-22
  • 打赏
  • 举报
回复
文字位置还是有点问题 应该这么改 void DrawText(Graphics graphics,Brush brush, Font font, string text,float y) { SizeF size = graphics.MeasureString(text, font); float xpos = image.Width / 2 - size.Width / 2; graphics.DrawString(text, font, brush, xpos, y); } DrawText(g, brush, font, textBox1.Text, 184); DrawText(g, brush, font, textBox2.Text, 417); DrawText(g, brush, font, textBox3.Text, 650);
cheng94911 2013-01-22
  • 打赏
  • 举报
回复
Csharp_琪 2013-01-22
  • 打赏
  • 举报
回复
翻页成功~~
Trouble___Maker 2013-01-22
  • 打赏
  • 举报
回复
LAOYANG2013 2013-01-22
  • 打赏
  • 举报
回复
现在人太累,都需要放松一下
kaka5200 2013-01-22
  • 打赏
  • 举报
回复
谢谢楼主分享!
wushipeng999 2013-01-21
  • 打赏
  • 举报
回复
好玩儿的很啊 !
xiaorong2013 2013-01-21
  • 打赏
  • 举报
回复
加载更多回复(184)

110,499

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧