Single Control with DockStyle.Fill in ToolWindow or DocumentWindow Doesn't Resize

5 posts, 0 answers
  1. Brook
    Brook avatar
    5 posts
    Member since:
    Aug 2012

    Posted 03 Aug 2011 Link to this post

    Hello,

    I have built an application that uses the Winform version of both RadDock ToolWindows and RadDock DocumentWindows inside of a RadDock container.

    Each of these RadDock DockWindows has a single textbox control or custom UserControl in it, with:

    singleDockedControl.Dock = DockStyle.Fill;

    The problem I am having is that when I expand/maximize the entire WinForm, the DocumentWindows and ToolWindows expand nicely, but the controls inside them look "cut off" on the righthand size... a textbox with a  long line of text gets cut in half, and the last half of the line of text is not visible on the containing DockWindow, even though there is lots of empty white space on the righthand side of the containing DockWindow.  It appears that the textbox grows correctly, due to its Dock = DockStyle.Fill, but the righthand side of the DockWindow doesn't get repainted to show it.  This problem doesn't happen when a textbox or UserControl is placed directly on a test Winform that is expanded/maximized. 

    Does anybody know what I can do to fix this problem?

    Thank you very much in advance for your help!

    Brook
  2. Brook
    Brook avatar
    5 posts
    Member since:
    Aug 2012

    Posted 07 Aug 2011 Link to this post

    Hello,

    Can anybody out there help me with my question in my previous post shown on this Web page?

    It's been a  few days and haven't got any feedback, so I thought I would add some more information that should be helpful, as can be seen in the attached image...

    The attached image shows the problem... notice how the Telerik ToolWindow at the bottom has cut off text on the right side.

    Thanks in advance to anybody that can help me with this frustrating bug!

    Brook
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 08 Aug 2011 Link to this post

    Hi Brook,

    Thank you for writing.

    I was able to reproduce this behavior. It is occurs when the selection of the text box is at the end of the control and the the form is expanded. This causes the control size to expand but the editing area remains the same. The same behavior can be observed with the standard Microsoft text box control.

    However, in order to overcome this behavior, please subscribe to the SizeChanged event of your form and when such appears, change the SelectionStart property to 0 and then back to its previous value:

    void Form1_SizeChanged(object sender, EventArgs e)
            {
                int save = radTextBox1.SelectionStart;
                radTextBox1.SelectionStart = 0;
                radTextBox1.SelectionStart = save;
            }

    Let me know whether this helps. 

    All the best,
    Stefan
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  5. Brook
    Brook avatar
    5 posts
    Member since:
    Aug 2012

    Posted 08 Aug 2011 Link to this post

    Hi Stefan,

    Many thanks for your response.

    For whatever reason that is probably quite specific to my application, your solution didn't work in my particular case.

    However, you got me thinking when you said that the .NET TextBox has the same problem.  So I replaced the .NET TextBox with a .NET RichTextBox and this fixed the problem.

    Thanks again for your help.  I guess one lesson is use a RichTextBox instead of a TextBox if you want a large textbox with many lines that is ocked and needs to expand and contract nicely and always repaint correctly.

    Brook
  6. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 11 Aug 2011 Link to this post

    Hi Brook,

    Thank you for writing back.

    Indeed RichTextBox is the better choice when you have lager text portions. I would like to mention that in Q2 2011 we have added a new control to our suite - RadRichTextBox. It is still in its beta version but you can try it out. Should you have any feedback regarding this control, do not hesitate to contact us.
     
    Greetings,
    Stefan
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Back to Top
UI for WinForms is Visual Studio 2017 Ready