You can override the method SetBoundsCoreand prohibit height changes by changing the value heightbefore calling the base class implementation.
private const int FixedHeightIWantToKeep = 100;
protected override void SetBoundsCore(
int x,
int y,
int width,
int height,
BoundsSpecified specified)
{
height = this.FixedHeightIWantToKeep;
base.SetBoundsCore(x, y, width, height, specified);
}
source
share