2011-10-05 15 views

Respuesta

25

Debe configurar el botón para permitir varias líneas. Esto se puede lograr con el siguiente código 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); 
} 

utilizar de esta manera:

MakeButtonMultiline(button1); 

(source, verifica que funciona en un dispositivo CE)

+1

Thx mucho. Me salvaste el día :)) – senzacionale

+0

¡Esto también funciona con el botón de radio! – Robin

Cuestiones relacionadas