fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Drawing.Imaging;
  10. using System.Drawing.Drawing2D;
  11.  
  12. namespace WindowsFormsApplication1
  13. {
  14. public partial class Form1 : Form
  15. {
  16. public Form1()
  17. {
  18. InitializeComponent();
  19. }
  20.  
  21. private void Form1_Load(object sender, EventArgs e)
  22. {
  23. string drawtext = "hogehogehogehoge";
  24. string fontname = "メイリオ";
  25. Font font = new Font(fontname, 100.0f);
  26. Bitmap bmp = new Bitmap(400, 240, PixelFormat.Format32bppArgb);
  27. using (Graphics g = Graphics.FromImage(bmp))
  28. {
  29. //初期化
  30. g.FillRectangle(Brushes.White, new Rectangle(0, 0, bmp.Width, bmp.Height));
  31. SizeF size = g.MeasureString(drawtext, font);
  32. GraphicsPath gp = new GraphicsPath();
  33. gp.AddString(drawtext, font.FontFamily,0,font.Size, new Point(0,0), StringFormat.GenericDefault);
  34. Matrix tm = new Matrix();
  35. tm.Scale((((float)bmp.Width) / size.Width), (float)bmp.Height / size.Height);
  36. gp.Transform(tm);
  37. g.FillPath(Brushes.Red, gp);
  38. }
  39. pictureBox1.Image = bmp;
  40. }
  41. }
  42. }
  43.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty