如何防止状态栏覆盖我的 RichTextBox? [英] How can I keep a Status Bar from covering my RichTextBox?

查看:39
本文介绍了如何防止状态栏覆盖我的 RichTextBox?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

那里!我正在创建一个类似记事本的程序(更高级),但有一些事情困扰着我......

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

记事本++ &记事本有位于 RichTextBox/TextBox 边框下方的 Status Bar.字面上就在它之下.

Notepad++ & Notepad have the Status Bar located just under the RichTextBox/TextBox border. LITERALLY RIGHT UNDER IT.

我在表单上放了一个 Status Bar,并添加了控件(行、行、列、文件大小...)但我仍然无法让它留在 RichTextBox 下,因此它不会阻止用户查看文本.

I put a Status Bar onto my form, and added the controls (Lines, Line, Column, FileSize...) but I still cannot get it to stay under the RichTextBox, so that it will not block the user's view of text.

对于示例...

我有一个 RichTextBox,用户将一个巨大的文件加载到其中.它们向下滚动到最底部,最后一两行被状态栏覆盖.

I have a RichTextBox, and a user loads a huge file into it. They scroll down to the very bottom, and the last one or two lines are covered by the Status Bar.

我希望它保持在 RichTextBox 下方,这样它就不会挡住用户的视线.看起来很草率,会导致我的客户要求退款.

I want it to stay below the RichTextBox, so that it doesn't block the user's view. It seems sloppy and will cause my customers to demand refunds.

推荐答案

在容器内停靠控件时,停靠控件相对于另一个控件的优先级使用它们的 z 顺序进行调节.具有较高优先级(z 顺序中的较低位置)的控件在布局中优先于具有较低优先级(z 顺序中的较高位置)的控件.

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).

另请参阅的备注部分Control.Dock 属性.

要分配更高的优先级,请右键单击停靠的控件并选择SendToBack.
选择 BringToFront 会分配较低的优先级.

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

在这种特定情况下,未停靠的 RichTextBox 被停靠的 StatusBar 控件(不是 StatusStrip,z 顺序分配给这两个控件的方式略有不同)遮挡默认为底部.
一种解决方案是停靠 RichTextBox 控件,通过右键单击它并选择 BringToFront 为其赋予较低的优先级.
对 StatusBar 控件重复操作,在本例中选择 SendToBack.这将导致 StatusBar 占据其 Form 容器的整个底部,而 RichTextBox 控件占据剩余空间.
这两个控件不再重叠,并且在调整 Form 大小时不会影响布局.

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.

这篇关于如何防止状态栏覆盖我的 RichTextBox?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆