2009-10-08 12 views

Répondre

2

Vous pouvez remplacer la méthode SetBoundsCore et interdire les modifications de hauteur en modifiant la valeur height avant d'appeler l'implémentation de la classe de base.

private const int FixedHeightIWantToKeep = 100; 

protected override void SetBoundsCore(
    int x, 
    int y, 
    int width, 
    int height, 
    BoundsSpecified specified) 
{ 
    // Fixes height at 100 (or whatever fixed height is set to). 
    height = this.FixedHeightIWantToKeep; 
    base.SetBoundsCore(x, y, width, height, specified); 
} 
Questions connexes