[DllImport("gdi32.dll", EntryPoint="CreateFontIndirect")]
public static extern int CreateFontIndirect(ref LOGFONT lpLogFont);[StructLayout(LayoutKind.Sequential)]
public struct LOGFONT {
public int lfHeight;
public int lfWidth;
public int lfEscapement;
public int lfOrientation;
public int lfWeight;
public byte lfItalic;
public byte lfUnderline;
public byte lfStrikeOut;
public byte lfCharSet;
public byte lfOutPrecision;
public byte lfClipPrecision;
public byte lfQuality;
public byte lfPitchAndFamily;
public <green>LF_FACESIZE)</green> lfFaceName(1;
}
public static extern int CreateFontIndirect(ref LOGFONT lpLogFont);[StructLayout(LayoutKind.Sequential)]
public struct LOGFONT {
public int lfHeight;
public int lfWidth;
public int lfEscapement;
public int lfOrientation;
public int lfWeight;
public byte lfItalic;
public byte lfUnderline;
public byte lfStrikeOut;
public byte lfCharSet;
public byte lfOutPrecision;
public byte lfClipPrecision;
public byte lfQuality;
public byte lfPitchAndFamily;
public <green>LF_FACESIZE)</green> lfFaceName(1;
}
Label label = new Label();
LOGFONT lf = new LOGFONT();
lf.lfHeight = label.Font.Height;
lf.lfFaceName = label.Font.Name;
IntPtr handle = CreateFontIndirect(lf);这样行不行?
不是很了解这个。
还有其他方法么?