将对话框屏幕安装到Visual C ++ SDI应用程序的框架上 [英] Fitting a Dialog Screen on to the Frame of a Visual C++ SDI application

查看:59
本文介绍了将对话框屏幕安装到Visual C ++ SDI应用程序的框架上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,
我正在编写一个Visual C ++ SDI(单文档接口)应用程序:基类-> CFormView.我有一个名为工具"的菜单选项,在该菜单下,我有一个名为显示站点数据"的子菜单选项.选择此子菜单选项后,我希望能够在DialogControl上显示我想要的数据.

我想用Dialog屏幕做的是...我希望它适合SDI应用程序的FRAME(工具栏下方和任务栏上方的空间) ).因此对话框屏幕始终停留在框架上,并且不能移到应用程序父框架的外侧.我认为我无法通过致电DoModal来做到这一点.

有人可以告诉我如何做到这一点,谢谢.

Hi there,
I am writing a Visual C++ SDI (Single Document Interface) application : Base Class -> CFormView. I have a menu option called "Tools" and under that i have a Sub menu option called "Display Site Data". Once this sub menu option is selected i want to be able to display the data i want on a DialogControl.

What i want to be able to do with the Dialog screen is though... I want it to fit in to the FRAME of the SDI app (the space below the tool bar and above the task bar). So that the dialog screen always stays on the frame and can not be moved to the out side of the parent frame of the application. I don't think i can do this by calling  DoModal.

Can someone please tell me how this can be done, thanks.

推荐答案

将此添加到对话框

1的OnInitDialog中. )获取表单view
2的客户端rect. )让客户进行屏蔽
3. )将窗口移到rect


上,并将对话框属性修改为

1. )取消选中标题栏
2. )Boder Thin或None

这是OnInitDialog的代码

BOOL XXXXXXDlg :: OnInitDialog()
{
CDialog :: OnInitDialog();

CRect rect;
GetParent()-> GetClientRect(& rect);
ClientToScreen(rect);
MoveWindow(rect);

返回TRUE;
}
Add this in the OnInitDialog of your dialog

1 . ) Get the client rect of the form view
2 . ) Do client to screen
3 . ) Move window to the rect


And Modify your dialog properties as

1 . ) Uncheck Title bar
2 . ) Boder Thin or None 

Here is the code of OnInitDialog

BOOL XXXXXXDlg::OnInitDialog()
{
   CDialog::OnInitDialog();
 
        CRect rect;
        GetParent()->GetClientRect(&rect); 
        ClientToScreen(rect);
        MoveWindow(rect);
 
   return TRUE;
}


这篇关于将对话框屏幕安装到Visual C ++ SDI应用程序的框架上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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