0

I'm trying to make a RichTextBox have fixed size and blank space flexible (like Word, WordPad), I made this:

Set Dock to Fill
Set MaximumSize to 600,0 (0 is wildcard for sizes) (Width=600 and Height=0 -wildcard)

I got this: blank spaces are flexible and RichTextBox size is fixed, but RichTextBox is not positioned at center.

I have some options:

  • Set padding to auto (I suppose that it's not possible)
  • Set margin to auto (I suppose that it's not possible AND margins not works in winforms)

What do I have to do to position RichTextBox to center?

  • Use the Anchor property instead, turn on the Right and Bottom anchors. Not every conceivable layout arrangement is practical with the built-in layout control properties or the TableLayoutPanel and FlowLayoutPanel controls, tricky once require code. Use the form's Resize event to put it where you want it. – Hans Passant Dec 28 '15 at 07:41

1 Answers1

0

Use anchor instead of dock.

Dock is designed for Size, Anchor is designed for Location

Your problem is based on location, locate your box to center instead of make Dock margins.