sen*_*ale 11 c# compact-framework
我想在Compact Framework中创建一个双行文本按钮.我已经在这个帖子中使用了每个想法但没有成功.
http://social.msdn.microsoft.com/forums/en-US/winforms/thread/626c21e0-369f-441e-b2f1-b51db633e38b
如果我使用\n或\r\n或Environment.NewLine我得到的正方形.
我正在使用Compact Framework 3.5.
有关如何制作双行文本框的任何想法?
use*_*702 26
您需要将按钮设置为允许多行.这可以通过以下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);
}
Run Code Online (Sandbox Code Playgroud)
像这样使用它:
MakeButtonMultiline(button1);
Run Code Online (Sandbox Code Playgroud)
(来源,验证它适用于CE设备)
| 归档时间: |
|
| 查看次数: |
5100 次 |
| 最近记录: |