views:

35

answers:

2

I'm developing a C# .NET Custom Control and I want to prevent the user, while in design mode, from resizing the Height, while allowing them to reize the Width.

A: 

Did you try to set MinHeight and MaxHeight properties?

Fyodor Soikin
Does not prevent shrinking the height--unless both are same. Plus, this blocks it even in runtime mode.
Russ
Gio
A: 

Try using the 'DesignMode' property, this indicates that you are in design mode, i.e. from the UI designer mode....see here on MSDN...

public int Height(){
get{ }
set{ if (this.DesignMode) return;
     else this.myHeight = value;
    }
}
tommieb75
This has the odd effect of crashing Visual Studio but it appears to be on the right track.
Gio
What version of Visual Studio? Odd that it crashes....
tommieb75