删除 Windows' SpitContainer 控件中 Splitter 中丑陋的选择标记
我有一个 SplitContainer
控件,中间的 Splitter
非常难看。通过将 SplitContainer
的 BackColor
设置为(在此处插入颜色),然后设置 Panel1
的 BackColor
和 < code>Panel2 为白色,我可以让我的分离器看起来很漂亮。但默认情况下,Windows 会将选择标记放在拆分器上,甚至在选择它之前也是如此。
如何确保选择标记永远不会显示在 Splitter
上?
I have a SplitContainer
control, and the Splitter
in the middle is very ugly. By setting the BackColor
of the SplitContainer
to (insert color here), then setting the BackColor
of Panel1
and Panel2
to white, I can have my splitter looking nice. But by default, Windows puts the selection mark over the Splitter, even before it's selected.
How can I make sure that the selection mark never shows on the Splitter
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
我认为“选择标记废话”是指指示控件被选择的模糊线。如果您不想显示此内容,请设置在启动时选择其他一些控件。类似于:
如果只是其中一个未选择,这应该可以解决您的问题。但是,如果您选择该项目来调整某些内容的大小,则会出现此情况。在这种情况下,您可以在 mouse_up 事件中放置一些内容以将选择移出控件。这样,用户移动分隔条,然后当他们放开时,所选内容就会从分隔条中清除。
另一种方法是使分隔条足够窄,以免灰色模糊线出现。为此,您可以执行以下操作(已测试):
I think by "Selection Marker Crap", you mean the fuzzy line that indicates the control is selected. If you don't want this showing up, set some other control to be selected at startup. Something like:
This should solve your issue if it is just one of it not being selected. However, this will come back if you select the item to resize something. In that case, you could put something in the mouse_up event to move the selection off of the control. That way, the user moves the splitter bar and then when they let go, the selection gets cleared off of the splitter.
Another way would be to make the splitter bar narrow enough that the gray fuzzy line doesn't show up. To do this, you could do the following (tested):
我遇到了同样的问题,并通过在
SplitContainer1
的属性窗口中将TabStop
设置为False
来修复该问题。这可能会惹恼那些依赖或坚持使用键盘来操作表单的每个方面的人,但除此之外它还可以工作。 SplitContainer 内的控件将保持可选项卡状态,但 SplitContainer 本身不能。
I experienced the same problem, and fixed it by setting
TabStop
toFalse
in the Properties window forSplitContainer1
.This could annoy people who depend or insist on using the keyboard to operate every aspect of your form, but other than that it will work. Controls inside the SplitContainer will remain tab-able, just not the SplitContainer itself.
此代码将在移动后不久将焦点从 splitContainer 移动到 TreeView。
This code will move the focus from the splitContainer to TreeView shortly after moved.
您可以添加一个事件处理程序来从 MouseUp 的容器中窃取焦点...这有点混乱,但它可以工作。 :)
You could add an event handler to steal the focus from the container on MouseUp's... It's a little messy but it works. :)
我尝试了很多方法来移除分离器,但没有任何效果。我做了一些不同的事情,为什么我们需要使用分割器,因为我们可以使用图片框控件使其宽度(或)高度取决于您的项目集 5 或 3 ....在图片框鼠标移动事件之后编写如下代码...
图片框属性光标更改光标类型 Hsplit 它看起来像分割器
它的工作,因为我为此尝试了很多并且我自己发现了这个方法......
I tried a lot to remove splitter but nothing work. I did some different why we need to use splitter for that we can use picture box control make it width (or) height depend upon your project set 5 or 3 .... after picture box mouse move event write code like...
picturebox property-cursor change the cursor type Hsplit its look like splitter
its work because i tried lot for this and i itself found this method...
我将 TabStop 设置为 false,然后它就消失了。
I set the TabStop to false and it went away.
我发现/制作的最简单的解决方案 - 创建一个按钮,选择它,然后隐藏它。
全部通过代码。这没有副作用或问题,将其放在表单加载事件中。
Most simple solution i found/made - create a button, select it, and hide it.
All via code. there is not side effects or problems with this, place it in the forms load event.