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;
using System.Drawing.Drawing2D;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string drawtext = "hogehogehogehoge";
string fontname = "メイリオ";
Font font = new Font(fontname, 100.0f);
Bitmap bmp = new Bitmap(400, 240, PixelFormat.Format32bppArgb);
using (Graphics g = Graphics.FromImage(bmp))
{
//初期化
g.FillRectangle(Brushes.White, new Rectangle(0, 0, bmp.Width, bmp.Height));
SizeF size = g.MeasureString(drawtext, font);
GraphicsPath gp = new GraphicsPath();
gp.AddString(drawtext, font.FontFamily,0,font.Size, new Point(0,0), StringFormat.GenericDefault);
Matrix tm = new Matrix();
tm.Scale((((float)bmp.Width) / size.Width), (float)bmp.Height / size.Height);
gp.Transform(tm);
g.FillPath(Brushes.Red, gp);
}
pictureBox1.Image = bmp;
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnMuR2VuZXJpYzsKdXNpbmcgU3lzdGVtLkNvbXBvbmVudE1vZGVsOwp1c2luZyBTeXN0ZW0uRGF0YTsKdXNpbmcgU3lzdGVtLkRyYXdpbmc7CnVzaW5nIFN5c3RlbS5MaW5xOwp1c2luZyBTeXN0ZW0uVGV4dDsKdXNpbmcgU3lzdGVtLldpbmRvd3MuRm9ybXM7CnVzaW5nIFN5c3RlbS5EcmF3aW5nLkltYWdpbmc7CnVzaW5nIFN5c3RlbS5EcmF3aW5nLkRyYXdpbmcyRDsKCm5hbWVzcGFjZSBXaW5kb3dzRm9ybXNBcHBsaWNhdGlvbjEKewogICAgcHVibGljIHBhcnRpYWwgY2xhc3MgRm9ybTEgOiBGb3JtCiAgICB7CiAgICAgICAgcHVibGljIEZvcm0xKCkKICAgICAgICB7CiAgICAgICAgICAgIEluaXRpYWxpemVDb21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0KWJtcC5IZWlnaHQgLyBzaXplLkhlaWdodCk7CiAgICAgICAgICAgICAgICBncC5UcmFuc2Zvcm0odG0pOwogICAgICAgICAgICAgICAgZy5GaWxsUGF0aChCcnVzaGVzLlJlZCwgZ3ApOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHBpY3R1cmVCb3gxLkltYWdlID0gYm1wOwogICAgICAgIH0KICAgIH0KfQo=