CommandBarTextBox Width

5 posts, 0 answers
  1. Chris Ward
    Chris Ward avatar
    52 posts
    Member since:
    Jan 2010

    Posted 05 Jun 2012 Link to this post

    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.
  2. Boryana
    Admin
    Boryana avatar
    330 posts

    Posted 08 Jun 2012 Link to this post

    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 >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Chris Ward
    Chris Ward avatar
    52 posts
    Member since:
    Jan 2010

    Posted 08 Jun 2012 Link to this post

    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.
  5. Boryana
    Admin
    Boryana avatar
    330 posts

    Posted 12 Jun 2012 Link to this post

    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 >>
  6. Chris Ward
    Chris Ward avatar
    52 posts
    Member since:
    Jan 2010

    Posted 12 Jun 2012 Link to this post

    That worked great, thank you for your help.
Back to Top
UI for WinForms is Visual Studio 2017 Ready