首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Windows Mobile >

怎么在按钮上显示多行文字

2012-01-24 
如何在按钮上显示多行文字?VS2005,C#,PDA操作系统是wm5.0问如何在按钮上显示多行文字?[解决办法]private c

如何在按钮上显示多行文字?
VS2005,C#,   PDA操作系统是wm5.0

问如何在按钮上显示多行文字?

[解决办法]
private const int BS_MULTILINE = 0x00002000;
private const int GWL_STYLE = -16;

[System.Runtime.InteropServices.DllImport( "coredll ")]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);

[System.Runtime.InteropServices.DllImport( "coredll ")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

public static void MakeButtonMultiline(Button b)
{
IntPtr hwnd = b.Handle;
int currentStyle = GetWindowLong(hwnd, GWL_STYLE);
int newStyle = SetWindowLong(hwnd, GWL_STYLE, currentStyle | BS_MULTILINE);
}

用法:
MakeButtonMultiline(button1);

热点排行