ã¯ããã¦ã®YaneSDK.NETçªå¤ç·¨ï¼
GDI+ã使ã£ãæååæç»ã®ä¾ã§ãã
YaneSDK.NETã«ãFontã¯ã©ã¹ãããã¾ãããå°ããæåãæç»ããå ´åãä¸åº¦æ¡å¤§ãã¦ãã縮å°ãã¦ããã®ã§ã¤ã¡ã¼ã¸éãã«ãªããªããã¨ãããããã§ãããããªã¨ãã¯ãGDI+ã使ã£ã¦ã¿ãã®ãæã§ãã
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using YD = Yanesdk.Draw; namespace Sample7 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } YD.Win32Window window; YD.GlTexture texture; private void Form1_Load(object sender, EventArgs e) { window = new YD.Win32Window(pictureBox1.Handle); window.Screen.Select(); Font font = new Font("ï¼ï¼³ ææ", 12); texture = new StringTexture("ããã«ã¡ã¯", font, Brushes.Blue); window.Screen.Unselect(); } private void OnTick(object sender, EventArgs e) { window.Screen.Select(); window.Screen.SetClearColor(255, 255, 255); window.Screen.Clear(); window.Screen.BlendSrcAlpha(); window.Screen.Blt(texture, 100, 100); window.Screen.Update(); } } // æååãã¯ã¹ãã£ä½æç¨ã®ãã«ãã¼ public class StringTexture : YD.GlTexture { public StringTexture(string text, Font font, Brush brush) { SizeF size; YD.Surface surface; // æååã®å¤§ãããæ¸¬å® using (Graphics g = Graphics.FromHwnd(IntPtr.Zero)) { size = g.MeasureString(text, font); } // ãããããããããµã¼ãã§ã¹ãä½æãã using (Bitmap bmp = new Bitmap( (int)size.Width, (int)size.Height)) using (Graphics g = Graphics.FromImage(bmp)) { g.DrawString(text, font, brush, 0, 0); YD.BitmapHelper.BitmapToSurface(bmp, out surface); } SetSurface(surface); } } }