I want to create a two-line text button in Compact Framework. I have used every idea in this thread but without success.
http://social.msdn.microsoft.com/fo开发者_Python百科rums/en-US/winforms/thread/626c21e0-369f-441e-b2f1-b51db633e38b
If I use \n or \r\n or Environment.NewLine I get squares.
I am using Compact Framework 3.5.
Any idea on how to make a two-line text box?
You need to set the button to allow multiple lines. This can be achieved with following P/Invoke code.
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);
}
Use it like this:
MakeButtonMultiline(button1);
(source, verified it works on a CE device)
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论