I have created a control designer to restrict the programmer using my control from altering the controls height. Here is the code:
Then you just declare your control with the Designer attribute, as follows:
The problem I have is my usercontrol is made up of a button and a textbox, and like the windows textbox control I want to make the fixedheight conditional upon wether or not the multiline property is set to TRUE. The Control Designer dosen't contain a reference to the control and therefore can't read the property. Does anybody know how to do this?
Code:
internal class FixedHeightControlDesigner : System.Windows.Forms.Design.ControlDesigner
{
public override SelectionRules SelectionRules
{
get
{
return SelectionRules.Moveable | SelectionRules.LeftSizeable | SelectionRules.RightSizeable |
SelectionRules.Visible;
}
}
}
Then you just declare your control with the Designer attribute, as follows:
Code:
[Designer(typeof(FixedHeightControlDesigner))]
public class ControlClassName : System.Windows.Forms.UserControl
The problem I have is my usercontrol is made up of a button and a textbox, and like the windows textbox control I want to make the fixedheight conditional upon wether or not the multiline property is set to TRUE. The Control Designer dosen't contain a reference to the control and therefore can't read the property. Does anybody know how to do this?