Resizing a RichTextbox

This is a discussion on Resizing a RichTextbox within the C# Programming forums, part of the General Programming Boards category; Hi I have placed a richtextbox on a form and I would like its size to be the size of ...

  1. #1
    Registered User
    Join Date
    May 2013
    Posts
    2

    Resizing a RichTextbox

    Hi

    I have placed a richtextbox on a form and I would like its size to be the size of the form, so I set the dock property to fill. My problem is that when I added a menubar and a toolbar at the top of the form, the first few lines of the rtb are now hidden. On the other hand if I set the dock property to none, when I resize the form, the rtb size remains fixed.

    Is there a way to make the rtb start exactly under the toolbar but when I resize the form it will be resized accordingly?

    Thank you in advance.

  2. #2
    Registered User
    Join Date
    Mar 2009
    Location
    england
    Posts
    209
    Yes there is a way. In visual studio, go to the "View" menu, then "Other windows", then "Document Outline". From there find the RichTextBox and MenuStrip controls on the Document Outline tree, and drag/drop so that they switch places.

  3. #3
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,171
    You can use the Anchor property of the RichTextBox instead of the Dock property. Set the Anchor property so all 4 directions are anchored, then position your RichTextBox in your form so it fills the form like you want. Now when you resize the form, the RichTextBox will move with the borders.
    If you understand what you're doing, you're not learning anything.

  4. #4
    Registered User
    Join Date
    May 2013
    Posts
    2
    Thank you very much for your tips, they worked perfectly.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Change RichTextBox Color
    By C_ntua in forum C# Programming
    Replies: 8
    Last Post: 12-18-2008, 03:44 PM
  2. Multilined RichTextBox
    By Coding in forum Windows Programming
    Replies: 3
    Last Post: 03-21-2008, 09:10 AM
  3. RichTextBox
    By Coding in forum Windows Programming
    Replies: 5
    Last Post: 02-03-2008, 11:23 AM
  4. RichTextBox and syntax highlighting
    By Rune Hunter in forum C# Programming
    Replies: 0
    Last Post: 06-12-2007, 03:16 PM
  5. searching text in richtextbox
    By SuperNewbie in forum C# Programming
    Replies: 4
    Last Post: 08-02-2002, 10:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21