如何使用tab控件之类的按钮来控制子对话框? [英] How to control child dialog using button like tab control ?

查看:68
本文介绍了如何使用tab控件之类的按钮来控制子对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Parent对话框,两个子对话框,我的应用程序中的父对话框上的两个按钮,我想使用这些按钮显示和隐藏适当大小的子对话框



编码's'是其中一个子对话类的对象......



我试过的:



I have one Parent dialog, two child dialog's, two buttons on parent dialog in my application and i want to show and hide the child dialog in appropriate size using those buttons

in coding 's' is object of one of the child dialog class...

What I have tried:

void CDialogControlDlg::OnBnClickedStudent()
{
	s.Create(IDD_STUDENT, this);
	SetRectangle(&s);
	s.ShowWindow(SW_SHOW);
}

void CDialogControlDlg::SetRectangle(CStudent* s)
{
	CRect tabRect, itemRect;
	int nX, nY, nXc, nYc;
 
	GetClientRect(&tabRect);
	m_lst.GetItemRect(0, &itemRect);
	 
	nX=itemRect.left;
	nY=itemRect.bottom+1;
	nXc=tabRect.right-itemRect.left-1;
	nYc=tabRect.bottom-nY-1;
	 
	s->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
}

推荐答案

第一个参数=左边距

秒=顶部

third = width

fourth = height

Where first parameter=left margin
second = top
third = width
fourth = height
CRect rect =CRect(150, 40, 831, 576);

m_CDialog1->MoveWindow(rect);
m_CDialog1->ShowWindow(SW_SHOW);


这篇关于如何使用tab控件之类的按钮来控制子对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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