M
MB
Hi!
I am trying to make a dynamic GroupBox that will contain a variable
number of child controls of a single type, e.g. RadioButtons or
CheckBoxes. I want to read the neccesarry information about the
controls (such as the text) from an xml-file, create controls, and then
place them on top of another in the group box. The problem is how to
give the controls and the group box the correct size. The group box
(and its child controls) should have a set width, but the height should
resize based on the child controls. Also, I need the child controls to
adjust their height based on the Text property.
Any ideas on how to do this? What I need is some way of making e.g. a
RadioButton adjust it height (but have constant width) to fit the text
it displays. I have tried with the Label control, and have set the
AutoSize property to true, but it will only resize the width. I managed
to get the Label to adjust correctly by splitting the text in words,
adding word by word, and adding a "\n" when the PreferredWidth property
was larger than the width I wanted, and at the end reading the
PreferredHeight, but the RadioButton and CheckBox doesn't seem to have
this property. Any other suggestions?
MB
I am trying to make a dynamic GroupBox that will contain a variable
number of child controls of a single type, e.g. RadioButtons or
CheckBoxes. I want to read the neccesarry information about the
controls (such as the text) from an xml-file, create controls, and then
place them on top of another in the group box. The problem is how to
give the controls and the group box the correct size. The group box
(and its child controls) should have a set width, but the height should
resize based on the child controls. Also, I need the child controls to
adjust their height based on the Text property.
Any ideas on how to do this? What I need is some way of making e.g. a
RadioButton adjust it height (but have constant width) to fit the text
it displays. I have tried with the Label control, and have set the
AutoSize property to true, but it will only resize the width. I managed
to get the Label to adjust correctly by splitting the text in words,
adding word by word, and adding a "\n" when the PreferredWidth property
was larger than the width I wanted, and at the end reading the
PreferredHeight, but the RadioButton and CheckBox doesn't seem to have
this property. Any other suggestions?
MB