Compact Framework中的双行文本按钮

我想在Compact Framework中创建一个双行文本按钮。 我已经在这个post中使用了每个想法但没有成功。

http://social.msdn.microsoft.com/forums/en-US/winforms/thread/626c21e0-369f-441e-b2f1-b51db633e38b

如果我使用\n\r\nEnvironment.NewLine我得到正方形。

我正在使用Compact Framework 3.5。

关于如何制作双行文本框的任何想法?

您需要将按钮设置为允许多行。 这可以通过以下P / Invoke代码来实现。

 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); 

( 来源 ,validation它适用于CE设备)