PtiTom

EMF File Drawing

Jan 14th, 2021
467
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Drawing;
  2. using System.Drawing.Imaging;
  3.  
  4. namespace WriteEMF
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             using (var img = new Bitmap(200, 200))
  11.             using (var g = Graphics.FromImage(img))
  12.             {
  13.                 Pen penBlue = new Pen(Color.CadetBlue, 2);
  14.                 Brush brushRed = new SolidBrush(Color.IndianRed);
  15.                 Font fontMessage = new Font(SystemFonts.DefaultFont.FontFamily, 14);
  16.                 g.DrawBezier(penBlue, new Point(0, 0), new Point(50, 100), new Point(100, 50), new Point(0, 0));
  17.                 g.DrawString("Salut les moches !", fontMessage, brushRed, new Point((int)(200 - g.MeasureString("Salut les moches !", fontMessage).Width) / 2, 80));
  18.                
  19.                 g.Flush();
  20.                 img.Save("Test.emf", ImageFormat.Emf);
  21.             }
  22.         }
  23.     }
  24. }
  25.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×