This is a migrated thread and some comments may be shown as answers.

CommandBarTextBox Width

4 Answers 229 Views
CommandBar
This is a migrated thread and some comments may be shown as answers.
Chris Ward
Top achievements
Rank 1
Chris Ward asked on 05 Jun 2012, 02:03 PM
How do I set the width of a CommandBarTextBox control?  It appears to reset itself to 60 of I change Size or Bounds in the designer, and if I set AutoSize to false all of the controls get mashed together and the layout looks atrocious.  What am I missing?

Thanks.

4 Answers, 1 is accepted

Sort by
0
Boryana
Telerik team
answered on 08 Jun 2012, 06:33 AM
Hello Chris Ward,

Thank you for writing.

The MinSize property sets the size of a RadTextBoxElement:
this.commandBarTextBox1.MinSize = new Size(200, 0);

I hope this helps. Let me know if you have further questions.

Greetings,
Boryana
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Chris Ward
Top achievements
Rank 1
answered on 08 Jun 2012, 11:39 AM
I tried setting the MinSize property in the code:

Text1.MinSize = new Size(30, 0);
Text2.MinSize = new Size(30, 0);

As a matter of fact I've tried setting all size-related assignable properties:

Text1.Size = new Size(30, 22);
Text1.DefaultSize = new Size(30, 22);
Text1.MaxSize = new Size(30, 22);
Text1.MinSize = new Size(30, 22);
Text1.SetBounds(0, 0, 30, 22);

The text boxes are still 60 pixels wide when the form loads.  Sometimes they cause strange artifacts with, or completely render on top of, nearby controls.  Try creating a RadCommandBar, placing a CommandBarTextBox in it, and resizing it for yourself.
0
Boryana
Telerik team
answered on 12 Jun 2012, 09:15 AM
Hello Chris,

Thank you for clarifying your scenario.

Please try setting the MinSize property of the TextBoxElement. Here is a sample snippet:
this.commandBarTextBox1.TextBoxElement.MinSize = new Size(20, 0);

I hope this helps. Let me know if you encounter further issues.

Regards,
Boryana
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Chris Ward
Top achievements
Rank 1
answered on 12 Jun 2012, 12:14 PM
That worked great, thank you for your help.
Tags
CommandBar
Asked by
Chris Ward
Top achievements
Rank 1
Answers by
Boryana
Telerik team
Chris Ward
Top achievements
Rank 1
Share this question
or