日期:2014-05-18  浏览次数:20930 次

Font newFont = Font.FromHdc()
谁能告诉我这个方法怎么用,谢谢了

------解决方案--------------------
Code Snippet
System.IntPtr intPtr = (System.IntPtr)MyFont.CreateFontW(10, 15, 0, 0, MyFont.FW_THIN, 0, 0, 0,
MyFont.GB2312_CHARSET, MyFont.OUT_STRING_PRECIS, MyFont.CLIP_EMBEDDED,
MyFont.ANTIALIASED_QUALITY, MyFont.FIXED_PITCH | MyFont.FF_SCRIPT, "sdfas");

 

句柄传递
 



Code Snippet
Font f3 = Font.FromHdc(intPtr);

 

 

调用API:


Code Snippet
[DllImport("gdi32.dll")]
public static extern IntPtr CreateFont(int nHeight, int nWidth, int nEscapement, int nOrientation, int fnWeight, uint fdwItalic, uint fdwUnderline, uint
fdwStrikeOut, uint fdwCharSet, uint fdwOutputPrecision, uint
fdwClipPrecision, uint fdwQuality, uint fdwPitchAndFamily, string lpszFace); 
 

 


画字符


Code Snippet
g.DrawString("Start我的新字体", f3, new SolidBrush(Color.AliceBlue),new PointF(0,0));