<急>关于API->SystemParametersInfo的使用...
BOOL b;
SystemParametersInfo(0x0060, TRUE, &b, NULL);
如上的格式...
在C#中该如何定义和使用呢???
------解决方案--------------------[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
private 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;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string lfFaceSize;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
private struct NONCLIENTMETRICS
{
public int cbSize;
public int iBorderWidth;
public int iScrollWidth;
public int iScrollHeight;
public int iCaptionWidth;
public int iCaptionHeight;
public LOGFONT lfCaptionFont;
public int iSmCaptionWidth;
public int iSmCaptionHeight;
public LOGFONT lfSmCaptionFont;
public int iMenuWidth;
public int iMenuHeight;
public LOGFONT lfMenuFont;
public LOGFONT lfStatusFont;
public LOGFONT lfMessageFont;
}
const int SPI_GETNONCLIENTMETRICS = 0x0029;
const int SPI_SETNONCLIENTMETRICS = 0x002A;
[DllImport( "user32.dll ", SetLastError=true, CharSet=CharSet.Auto)]
private static extern bool SystemParametersInfo(int uiAction, int uiParam,
ref NONCLIENTMETRICS ncMetrics, int fWinIni);
private void button4_Click(object sender, EventArgs e)
{
NONCLIENTMETRICS nm = new NONCLIENTMETRICS();
int nSize = Marshal.SizeOf(nm);
nm.cbSize = nSize;
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, nSize, ref nm, 0);
nm.iCaptionHeight = 20;
SystemParametersInfo(SPI_SETNONCLIENTMETRICS, nSize, ref nm, 0);
//GetCaptionFont();
}