当另一个子表单处于最大化状态时,MDI子表单自动处于最大化状态 [英] MDI Child form automatically in a maximized state when another child form is in a maximized state

查看:59
本文介绍了当另一个子表单处于最大化状态时,MDI子表单自动处于最大化状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当先前打开的另一个子窗体处于最大化状态时,MDI子窗体将以最大化状态自动打开。我的意思是第一种形式最大化,然后第二种形式是opent,不应该最大化。

解决方案

你调整大小窗口获取WM_WINDOWPOSCHANGING和WM_WINDOWPOSCHANGED命令将它们摘下并调整大小客户



在C / C ++中你可以在窗口的窗口处理程序中处理它们,这样会调整大小,所以看起来类似于



 //接下来的两条消息比WM_MOVE / WM_SIZE更好用。 
//记住WM_MOVE / WM_SIZE来自16位窗口。在32位窗口中,窗口
//管理器只发送这两个消息,而实际上
//接受它们并将它们转换为WM_MOVE / WM_SIZE。
//
//我们接受这个,所以我们可以将控件扩展到客户端大小。
case WM_WINDOWPOSCHANGING:
case WM_WINDOWPOSCHANGED:
{
RECT rc;
HDWP hDWP;

//你看到的任何地方???你需要插入你的值

//创建一个延迟的窗口句柄。
if(hDWP = BeginDeferWindowPos(???)){//推迟??? windows移动
GetClientRect(hWnd,& rc);

//将每个窗口移动/大小推迟到结束并一次完成所有操作。
hDWP = DeferWindowPos(hDWP,???处理窗口,NULL,
??? x,??? y,??? cx,??? cy,SWP_NOZORDER | SWP_NOREDRAW);

//每个窗口上面的RINSE和REPEAT行您需要增加
/ *时间来添加代码* /

//调整延期下的所有窗口大小窗户一起处理。
EndDeferWindowPos(hDWP);

//我们告诉DeferWindowPos不要重绘控件,这样我们就可以一次性重绘
//。
RedrawWindow(hWnd,NULL,NULL,RDW_INVALIDATE | RDW_ALLCHILDREN |
RDW_ERASE | RDW_NOFRAME | RDW_UPDATENOW);
}

}
返回0;


MDI Child form opens automatically in a maximized state when another child form opened previously is in a maximized state. I mean 1st form is maximized and then the second form is opent which should not be maximized.

解决方案

You resize window gets WM_WINDOWPOSCHANGING and WM_WINDOWPOSCHANGED commands pick them off and resize the client

In C/C++ you handle them in the window handler of the window that resizes like this so it will look something similar

// These next two messages are better to use rather than WM_MOVE/WM_SIZE.
// Remember WM_MOVE/WM_SIZE are from 16bit windows. In 32bit windows the window
// manager only sends these two messages and the DefWindowProc() handler actually
// accepts them and converts them to WM_MOVE/WM_SIZE.
// 
// We accept this so we can scale our controls to the client size.
     case WM_WINDOWPOSCHANGING:
     case WM_WINDOWPOSCHANGED:
     {
	RECT rc;
        HDWP hDWP;
         
        // Anywhere you see ??? you need to insert your value	

        // Create a deferred window handle.
        if(hDWP = BeginDeferWindowPos(???)){ // Deferring ??? of windows to move
           GetClientRect(hWnd, &rc);
 
           // Defer each window move/size until end and do them all at once.
           hDWP = DeferWindowPos(hDWP, ??? Handle to your window, NULL,
              ???x, ???y, ???cx, ???cy, SWP_NOZORDER | SWP_NOREDRAW);
 
           // RINSE AND REPEAT LINE ABOVE FOR EACH WINDOW YOU DEFERRED
           /* TIME FOR YOU TO ADD CODE */
 
           // Resize all windows under the deferred window handled together.
           EndDeferWindowPos(hDWP);
 
           // We told DeferWindowPos not to redraw the controls so we can redraw
           // them here all at once.
           RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN |
              RDW_ERASE | RDW_NOFRAME | RDW_UPDATENOW);
        }		
        
     }
     return 0;


这篇关于当另一个子表单处于最大化状态时,MDI子表单自动处于最大化状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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