是否可以在C#Windows窗体中创建2 x 2(4个面板)拆分器? [英] Is this possible to create 2 x 2 (4 panels ) splitter in C# Windows Forms ?

查看:143
本文介绍了是否可以在C#Windows窗体中创建2 x 2(4个面板)拆分器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建2(行)x 2(列)分离器,它将同时设置4个面板.

I want to create 2(rows) x 2(columns) splitter which will set 4 panels simultaneously.

例如,在MFC中,当我们移动水平&的中心时,垂直分配器同时进行,并相应地设置了4个面板.以前我使用过MFC CSplitterWnd::CreateStatic (4个窗格的4个视图).现在,我已将MFC项目转换为C#,

For example, in MFC as we move center of horizontal & vertical splitter simultaneously, and it set 4 panels accordingly. Previously I had used MFC CSplitterWnd::CreateStatic (4 views for 4 panes). Now I have shifted my MFC Project into C#,

请告知我,因为我想在C#中做同样的事情

Please inform me as I want to do same thing in C#

预先感谢!

推荐答案

据我所知,内置拆分容器只能有两个面板.您可以使用三个拆分容器(每个垂直父拆分器面板中的一个水平拆分器)来获得要使用的4面板外观,但是您必须自己调整大小,以确保两个拆分器的大小均已调整
As far as I know the built in split container can only have two panels. You can get the 4 panel look you are going for by using three split containers (one horizontal splitter inside each of the vertical parent splitter''s panels), but you will have to handle the resizing yourself, to ensure both child splitters are sized at the same time.


AFAIK,不能通过单个拆分器完成.尽管您可以使用TableLayoutPanel.
AFAIK, cannot be done by single splitter. Although you can make use of TableLayoutPanel.


遵循另一个答案(每个面板内部有一个主要的水平分割器和两个垂直分割器,为您提供4个单独的面板).

Follow the other answer (one main horizontal splitter and two vertical splitters inside each of the panels, to give you the 4 separate panels).

然后连接一个垂直的SplitContainer的SplitterMoved事件之一(可能有原因使用SplitterMoving,我不是100%的原因.我会选择SplitterMoved).

Then hook up one of the vertical SplitContainer''s SplitterMoved events (there may be reasons to use SplitterMoving, I''m not 100% on that. I''d go with SplitterMoved). 

在该事件的处理程序中,将OTHER垂直拆分器.SplitterDistance设置为第一个垂直拆分器.SplitterDistance.

Inside the handler for that event, set the OTHER vertical splitter.SplitterDistance to be the first vertical splitter.SplitterDistance.

然后您应该能够使所有4个面板保持同步. 

You should then be able to have all 4 panels stay in sync. 


这篇关于是否可以在C#Windows窗体中创建2 x 2(4个面板)拆分器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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