Chapter 15 ToolStrip eclipses RichTextBox
In the Manual Menu example that spans several pages, a RichTextBox is present with dock property = fill. This is tested and working part way through the example. Then, on p. 459, a ToolStrip is added. After this, the RichTextBox doesn't seem to work.
I noticed that if I set the RichTextBox's dock property to bottom, it begins to work. The "fill" setting forces the first line or so of text up under the ToolStrip where it can't be seen so it appears that the RichTextBox never gets focus. Actually the line is just hidden and subsequent lines do display.
Setting dock to "bottom" exposes the entire RichTextBox but looks bad when the window is resized.
I noticed that at the bottom of form1.designer.cs, where the controls are added to the form, Visual C# 2005 seems to add the controls to the form with each new control added before the previous, i.e. if the RichTextBox is added in the forms designer before the ToolStrip then the code adds the ToolStrip to the form before the RichTextBox. If I reverse the order to add the RichTextBox first, then the project works as expected. The sample code adds the RichTextBox first so they must have built the form in this order, different from how the book specifies.
Has anybody noticed this? Is it a general rule that you must add to the forms designer in a certain order?
|