最大化对话框 [英] maximizing a dialog box

查看:81
本文介绍了最大化对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio 2005版中制作了一个基于对话框的小型应用程序,该应用程序几乎没有按钮,编辑框和静态框等.我的问题是我想使其成为全屏应用程序,而不管它正在运行的任何监视器大小.但是每当我最大化应用程序时,对话框就会占据整个屏幕,但是控件(编辑框,按钮,静态框等)确实会根植于其原始位置,即它不会均匀分布以占据整个屏幕.
我已经用谷歌搜索了这个问题并找到了一些代码,但是它们的作用与最大化应用程序相同.

有人可以帮帮我吗.

这些是我用来最大化我的应用程序的代码

I have made a small dialog based application in visual studio 2005 edition which has few buttons,edit boxes and static box etc . My problem is I want to make it full screen application irrespective of any monitor size it is running on . But whenever i m maximizing the application the dialog box hogs the whole of screen but the controls (edit box, buttons, static box etc) does remain rooted to its original position i.e it doesnot spread out uniformly to occupy the whole screen.
I have googled this problem and found some code but they are doing the same thing as maximizing the application.

Could somebody help me out please.

These are code i m using to maximize my application

// 1st solution
CRect rcDesktop;
int SM_XVIRTUALSCREEN,SM_CXVIRTUALSCREEN,SM_CYVIRTUALSCREEN,SM_YVIRTUALSCREEN;
rcDesktop.left = GetSystemMetrics(SM_XVIRTUALSCREEN);
rcDesktop.right = rcDesktop.left + GetSystemMetrics(SM_CXVIRTUALSCREEN);
rcDesktop.top = GetSystemMetrics(SM_YVIRTUALSCREEN);
rcDesktop.bottom = rcDesktop.top + GetSystemMetrics(SM_CYVIRTUALSCREEN);
MoveWindow(rcDesktop, FALSE);



// 2nd solution


int cx, cy; 
    HDC dc = ::GetDC(NULL); 
    cx = GetDeviceCaps(dc,HORZRES) + 
        GetSystemMetrics(SM_CXBORDER); 
    cy = GetDeviceCaps(dc,VERTRES) +
        GetSystemMetrics(SM_CYBORDER); 
    ::ReleaseDC(0,dc); 

    // Remove caption and border

    SetWindowLong(m_hWnd, GWL_STYLE, 
        GetWindowLong(m_hWnd, GWL_STYLE) & 
    (~(WS_CAPTION | WS_BORDER))); 

    // Put window on top and expand it to fill screen

    ::SetWindowPos(m_hWnd, HWND_TOPMOST, 
        -(GetSystemMetrics(SM_CXBORDER)+1), 
        -(GetSystemMetrics(SM_CYBORDER)+1), 
        cx+1,cy+1, SWP_NOZORDER);

推荐答案

您将不得不在WM_SIZE消息期间移动控件的位置

easysize [
you''re going to have to move the position of your controls during the WM_SIZE message

there''s easysize[^] on CP


这篇关于最大化对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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