如何在其他对话框上方显示一个对话框 [英] How to show a dialog on top of other dialog

查看:216
本文介绍了如何在其他对话框上方显示一个对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,

我陷入一个小问题.我正在使用domodal方法创建一个字体对话框.但是创建后,该对话框将在另一侧的背面弹出.谁能告诉我如何在另一个对话框之前弹出该对话框.我的代码如下:

Hi friends,

I am stuck at a small problem. I am creating a font dialog using domodal method. But after creation this dialog is popup at the backside of other side. Can anybody tell me how to popup that dialog in front of other one. My code is as below:

CFontDialog			 m_OTheFontDialog;	
FontFamily*		pOFontFamily = NULL;
		
	m_OTheFontDialog.m_cf.Flags |= CF_TTONLY;

	if(m_OTheFontDialog.DoModal() == IDOK)
	{	
             m_OTheFontDialog.GetCurrentFont(&m_SFontInformation);
		m_SFontInformation.lfQuality = ANTIALIASED_QUALITY;
		m_crTextColor = m_OTheFontDialog.GetColor();

		if(m_OTheFontDialog.IsBold())
			iFontStyle = iFontStyle | FontStyleBold;

		if(m_OTheFontDialog.IsItalic())
			iFontStyle = iFontStyle | FontStyleItalic;

		if(m_OTheFontDialog.IsStrikeOut())
			iFontStyle = iFontStyle | FontStyleStrikeout;

		if(m_OTheFontDialog.IsUnderline())
			iFontStyle = iFontStyle | FontStyleUnderline;

		if(!wcscmp(m_SFontInformation.lfFaceName, _T("")))
			return false;

		pOFontFamily = new FontFamily(m_SFontInformation.lfFaceName);
                
                m_pOBrush = new SolidBrush(Color(255, GetRValue(m_crTextColor), GetGValue(m_crTextColor), GetBValue(m_crTextColor)));
		m_pOTheFont = new Font(pOFontFamily, (float)ulFontHeight, iFontStyle, UnitPixel);
        }


请帮助我解决此问题.
谢谢


Please help me resolve this issue.
Thanks

推荐答案

您可以使用CWnd :: SetWindowPos,我想说一看:CWnd::SetWindowPos [
You can use CWnd::SetWindowPos I would say, take a look: CWnd::SetWindowPos[^] :

m_pMainWnd->SetWindowPos(&CWnd:: wndTopMost, 0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW);


尝试将对话框的父级设置为另一个窗口,即创建m_OTheFontDialog的父级为NULL,即桌面窗口.

我怀疑这就是为什么它现在出现在后面的原因,因为您有效地拥有m_OtheFontDialog.pParentWnd = NULL
Try setting the parent of the dialog to the other window, the way you have created m_OTheFontDialog the parent is NULL which is the desktop window.

I suspect that is why it appears behind at the moment because you have m_OtheFontDialog.pParentWnd = NULL effectively


这篇关于如何在其他对话框上方显示一个对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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