C# 其他图片格式转emf
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.Imaging; namespace pngtoemf { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Save() { string filePath = @"D:\闫磊.emf"; Bitmap bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height); Graphics gs = Graphics.FromImage(bmp); Metafile mf = new Metafile(filePath, gs.GetHdc()); Graphics g = Graphics.FromImage(mf); //g.FillEllipse(Brushes.Gray, 0, 0, 100, 100); //g.DrawEllipse(Pens.Black, 0, 0, 100, 100); //g.DrawArc(new Pen(Color.Red, 10), 20, 20, 60, 60, 30, 120); g.DrawImage(pictureBox1.Image, 0, 0); g.Save(); g.Dispose(); mf.Dispose(); } private void button1_Click(object sender, EventArgs e) { pictureBox1.Load(this.textBox1.Text); Save(); } } }