How can I keep a Status Bar from covering my RichTextBox…? C#

后端 未结 1 1659
一向
一向 2021-01-23 13:44

there! I am creating a Notepad-Like program(Much more advanced), and there is something bothering me...

Notepad++ & Notepad have the Status B

相关标签:
1条回答
  • 2021-01-23 13:55

    When docking controls inside a container, the priority of a docked control over another is regulated using their z-order. A Control with a higher priority (a lower position in the z-order) takes precedence in the layout over controls with a lower priority (a higher position in the z-order).

    See also the Remarks section of the Control.Dock Property.

    To assign the a higher priority, right-click on a docked Control and select SendToBack.
    A lower priority is assigned selecting BringToFront instead.

    In this specific case, an undocked RichTextBox was obscured by a StatusBar control (not a StatusStrip, there's a little diffference on how the z-order is assigned to these 2 controls), which is docked to Bottom as default.
    A solution is to dock the RichTextBox control, give it a lower priority by right-clicking it and selecting BringToFront.
    Repeat the operation on the StatusBar control, selecting in this case SendToBack. This will cause the StatusBar to take the whole bottom part of its Form container, while the RichTextBox control occupies the space left.
    The two controls don't overlap anymore and the layout is not compromised when the Form is resized.

    0 讨论(0)
提交回复
热议问题