private static System.Windows.Forms.NativeMethods.FONTDESC GetFONTDESCFromFont(System.Drawing.Font font) { System.Windows.Forms.NativeMethods.FONTDESC fontdesc = null; if (fontTable == null) { fontTable = new Hashtable(); } else { fontdesc = (System.Windows.Forms.NativeMethods.FONTDESC) fontTable[font]; } if (fontdesc == null) { fontdesc = new System.Windows.Forms.NativeMethods.FONTDESC { lpstrName = font.Name, cySize = (long) (font.SizeInPoints * 10000f) }; System.Windows.Forms.NativeMethods.LOGFONT logFont = new System.Windows.Forms.NativeMethods.LOGFONT(); font.ToLogFont(logFont); fontdesc.sWeight = (short) logFont.lfWeight; fontdesc.sCharset = logFont.lfCharSet; fontdesc.fItalic = font.Italic; fontdesc.fUnderline = font.Underline; fontdesc.fStrikethrough = font.Strikeout; fontTable[font] = fontdesc; } return fontdesc; }
public static extern IFontDisp OleCreateIFontDispIndirect(System.Windows.Forms.NativeMethods.FONTDESC fd, ref Guid iid);