2010-07-08 9 views

risposta

14

Sì, è un'impostazione di sistema. Usa SystemInformation.HorizontalScrollBarHeight e SystemInformation.VerticalScrollBarWidth.

+0

Ho pensato che esistesse, grazie! – SwDevMan81

6

On Net CF, dove SystemInformation.HorizontalScrollBarHeight e SystemInformation.VerticalScrollBarWidth non esistono, alcuni P/Invoke è necessario:

public sealed class Native 
{ 
    public static Int32 GetVerticalScrollbarWidth() 
    { 
     return GetSystemMetrics(SM_CXVSCROLL); 
    } 

    public Int32 GetHorizontalScrollbarHeight() 
    { 
     return GetSystemMetrics(SM_CYHSCROLL); 
    } 

    [DllImport("coredll.dll", SetLastError = true)] 
    public static extern Int32 GetSystemMetrics(Int32 index); 

    public const Int32 
     SM_CXVSCROLL = 2, 
     SM_CYHSCROLL = 3; 
} 
+0

Grazie, mi ha salvato un sacco di problemi – Manatherin

Problemi correlati