使用CSplitterWnd时,通过onsize()调整mfc窗口的大小 [英] resize mfc window through onsize() when using CSplitterWnd

查看:482
本文介绍了使用CSplitterWnd时,通过onsize()调整mfc窗口的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我在onsize()调整窗口大小时遇到​​了一个问题。

窗口的Outlook就像那样:

Hello,I met one issue when resize my window by onsize().
Outlook of my windows like that:

---------------------------------------
win1                                  |
---------------------------------------
win4    | win5        | win2          |
----------------------|               |
 win6   | win7        |---------------
----------------------   win3         |
  win8  | win9        |               |
----------------------------------------



总而言之,我有9个窗口,我使用了createstatic和createwindow来成功创建。

但是当我使用onsize()定义每个窗口大小时,它无法工作。


In totally, I have 9 window, I used createstatic and createwindow to create successfully.
But when I use onsize() to define each window size, it cannot work.

CRect rect;
GetClientRect(&rect);
int rectWidth = rect.Width();
int rectHeight = rect.Height();
int rectAccountTopHeight = rectHeight / 9;
int rectAccountBottomHeight = rectHeight / 9;
int rectOrderLeftWidth = rectWidth / 10 * 7;
int rectOrderRightWidth = rectWidth / 10 * 3;
int rectOrderBuySellTopHeight = rectAccountBottomHeight / 2;
int rectOrderBuySellBottomHeight = rectAccountBottomHeight / 2;
int rectMarketTopHeight, rectMarketMidHeight, rectMarketBottomHeight;
rectMarketTopHeight = rectMarketMidHeight = rectMarketBottomHeight = rectAccountBottomHeight / 3;
int rectMarketDetailLeftWidth = rectOrderLeftWidth / 10 * 7;
int rectMarketDetailRightWidth = rectOrderLeftWidth / 10 * 3;
int rectNoTradeLeftWidth = rectOrderLeftWidth / 2;
int rectNoTradeRightWidth = rectOrderLeftWidth / 2;
int rectPositionLeftWidth = rectOrderLeftWidth / 2;
int rectPositionRightWidth = rectOrderLeftWidth / 2;
if (isSplitterwin1)
{
    m_splitterwin1.SetRowInfo(0, rectAccountTopHeight, 100);
    m_splitterwin1.SetRowInfo(1, rectAccountBottomHeight, 100);
    m_splitterwin1.RecalcLayout();
}
if (isSplitterwin2)
{
    m_splitterwin2.SetColumnInfo(0, rectOrderLeftWidth, 50);
    m_splitterwin2.SetColumnInfo(1, rectOrderRightWidth, 50);
    m_splitterwin2.RecalcLayout();
}
if (isSplitterOrderBuySell)
{
    m_splitterOrderBuySell.SetRowInfo(0, rectOrderBuySellTopHeight, 50);
    m_splitterOrderBuySell.SetRowInfo(0, rectOrderBuySellBottomHeight, 50);
    m_splitterOrderBuySell.RecalcLayout();
}
if (isSplitterMarket)
{
    m_splitterMarket.SetRowInfo(0, rectMarketTopHeight, 50);
    m_splitterMarket.SetRowInfo(1, rectMarketMidHeight, 50);
    m_splitterMarket.SetRowInfo(2, rectMarketBottomHeight, 50);
    m_splitterMarket.RecalcLayout();
}
if (isSplitterMarketDetail)
{
    m_splitterMarketDetail.SetColumnInfo(0, rectMarketDetailLeftWidth, 10);
    m_splitterMarketDetail.SetColumnInfo(1, rectMarketDetailRightWidth, 50);
    m_splitterMarketDetail.RecalcLayout();
}<small></small>
if (isSplitterNoTrade)
{
    m_splitterNoTrade.SetColumnInfo(0, rectNoTradeLeftWidth, 50);
    m_splitterNoTrade.SetColumnInfo(1, rectNoTradeRightWidth, 50);
    m_splitterNoTrade.RecalcLayout();
}
if (isSplitterPosition)
{
    m_splitterPosition.SetColumnInfo(0, rectPositionLeftWidth, 50);
    m_splitterPosition.SetColumnInfo(1, rectPositionRightWidth, 50);
    m_splitterPosition.RecalcLayout();
}





构建并执行后,在窗口顶部,win1 / 2/4/5将隐藏,只显示win8,win9,win3。

有什么想法来解决它吗?如何使用setRowInfo和SetColumnInfo?谢谢!



After build and execute, on the top of window, win1/2/4/5 will be hidden, only show win8, win9, win3.
Any idea to fix it? How to use setRowInfo and SetColumnInfo? Thanks!

推荐答案

这篇关于使用CSplitterWnd时,通过onsize()调整mfc窗口的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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