如何在C#中使用VC ++的GetLogFont [英] How to use GetLogFont of VC++ in c#

查看:115
本文介绍了如何在C#中使用VC ++的GetLogFont的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要用c#编写VC ++的LOGFONT结构.
如何通过使用dllimport,pinvoke等在c#中使用VC ++的GetLogFont函数?

I want LOGFONT structure of VC++ in c#.
How to use GetLogFont function of VC++ in c# by using dllimport, pinvoke etc?

推荐答案

Google自行解决方案已经存在.


Google a little by your self solution is already there.


// logfont.cs
// compile with: /target:module
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential)]
public class LOGFONT
{
    public const int LF_FACESIZE = 32;
    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;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst=LF_FACESIZE)]
    public string lfFaceName;
}



请参考 http://msdn.microsoft.com/en-us/library/aa288468(v = vs.71).aspx [ http://msdn.microsoft.com/zh-CN/library/microsoft.windowsce.forms.logfont(v = vs.80).aspx [



Refer http://msdn.microsoft.com/en-us/library/aa288468(v=vs.71).aspx[^] and http://msdn.microsoft.com/en-us/library/microsoft.windowsce.forms.logfont(v=vs.80).aspx[^] for more details.

Thanks
Rushikesh Joshi


这篇关于如何在C#中使用VC ++的GetLogFont的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆