2010-07-08 5 views

Répondre

14

Oui, il s'agit d'un paramètre système. Utilisez SystemInformation.HorizontalScrollBarHeight et SystemInformation.VerticalScrollBarWidth.

+0

j'ai pensé qu'il existait, merci! – SwDevMan81

6

.Net CF, où SystemInformation.HorizontalScrollBarHeight et SystemInformation.VerticalScrollBarWidth n'existent pas, certains P/Invoke est nécessaire:

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

Merci, m'a sauvé beaucoup de tracas – Manatherin

Questions connexes