winform暴走表情制作器

winform暴走表情制作器

c# winform暴走表情制作器,项目工程下载地址:项目下载地址

程序运行截图:

winform暴走表情制作器-LMLPHP

部分代码:获取鼠标所在的图片中坐标

  private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
base.OnMouseDown(e);
if (e.Button == MouseButtons.Left)
{ m_MouseDownPoint = e.Location;
this.m_ImgTmpPoint = this.m_ImgDrawPoint;
Rectangle rect = new Rectangle(this.m_ImgDrawPoint.X, this.m_ImgDrawPoint.Y, this.image.Width, this.image.Height);
m_MouseInImage = rect.Contains(e.Location);
if (m_MouseInImage)
{
Point msPoint = e.Location;
msPoint.Offset(-this.m_ImgDrawPoint.X, -this.m_ImgDrawPoint.Y); pictureBox1.Cursor = Cursors.Default;
textBox3.Text = "X:"+msPoint.X + ",Y" + msPoint.Y;
font_x = msPoint.X;
font_y = msPoint.Y;
} }
}

插入文字:

  private void button2_Click(object sender, EventArgs e)
{
if (file == "")
{
MessageBox.Show("你还没添加素材");
}
else
{
image = Image.FromFile(file);
SolidBrush brush = new SolidBrush(label2.ForeColor);
using (Graphics g = Graphics.FromImage(image))
{
g.DrawString(textBox1.Text, label2.Font,
brush, new PointF(font_x, font_y));
g.Flush();
}
pictureBox1.Image = image;
this.pictureBox1.Refresh();
}
}
05-08 08:15