duilib 中怎样将窗口添加到容器中

duilib 中怎样将窗口添加到容器中,第1张

我想在窗口上做一个浮动的容器,在ASP.net中有没有这样的控件,如果用代码实现该怎么做

不可以,Frame是顶层容器,添加一个Frame到容器会抛出IllegalArgumentException

之前我用的是win8.1,里面VS2013安装,几个月没事,但突然有一天不能使用,最早出现的错误MSB6006:“cl.exe时”有错误的退出代码2。对于这个错误,我认为这是VS的环境问题,我尝试重新安装VS2013三次,但问题仍然存在,但我计划安装用vmware虚拟机win8.1 win7的,与VS2013里面(默认安装路径:C:\程序文件(x86)\微软的Visual Studio 12.0)

然后我突然想到:可以将虚拟机文件覆盖win8.1在VS2013解决这个问题太大,因为错误是C:\程序文件(x86)\ MSBuild的.....,所以我把一个虚拟机C:\程序文件(x86)\复制到win8.1的MSBuild文件夹(通过共享文件夹),然后再次打开VS2013试过了,真的可以,但是,出现了短暂的,错误MSB6006过了片刻:“CL.EXE”有错误2的退出代码,和其他错误。后

,我在网上搜索了很久,一些用户说,这可能会引起cl.exe时没有退出,然后我下载了一个专门的进程管理器(windows系统自带的进程管理器不能找到cl.exe时),运行了一下,我发现,当出现错误MSB6006有:错误2“的cl.exe”退出代码,没有为“cl.exe时”节目的名称仍在运行,我会继续末端的真正使用它,但它也是一个治标不治本的办法,因为每次运行程序时不得不看到底,太麻烦了,但也有其他的错误,我解决不了。

重装系统可以解决这个问题,当然,但以后每次重新安装系统更新,并安装了很多软件,用来不得不花费大量的时间和精力,所以我决定用VS2013不是win8的.1现在我装了win7和win8的(因为win8.1的应用程序不破)双系统,平时就用,玩像win7的游戏程序的使用win8的

量,多说,对不起,没有真正解决问题,我的水平有限,能做到的,你有什么不明白的问题,请继续

在基类中做默认的控件拖动判断, 在子类中做特殊控件判断, e.g. 点击某个静态控件时,要d出一个对话框.

[cpp] view

plaincopyprint?

class CMainDlg : public CXmlWnd

class CMainDlg : public CXmlWnd

基类:

[cpp] view

plaincopyprint?

virtual LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&bHandled)

ate:

BOOL IsInStaticControl(CControlUI * pControl)

virtual LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&bHandled)

private:

BOOL IsInStaticControl(CControlUI * pControl)

[cpp] view

plaincopyprint?

LRESULT CXmlWnd::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&bHandled)

{

POINT pt

RECTrcClient

RECTrcCaption

CControlUI *pControl = NULL

rcCaption = m_PaintManager.GetCaptionRect()

GetClientRect(m_PaintManager.GetPaintWindow(), &rcClient)

pt.x = GET_X_LPARAM(lParam)

pt.y = GET_Y_LPARAM(lParam)

::ScreenToClient(m_PaintManager.GetPaintWindow(), &pt)

if (-1 == rcCaption.bottom) ///<xml中描述bottom为-1时,整个窗口区域都可以拖动

{

rcCaption.bottom = rcClient.bottom

}

if ((pt.x >= rcClient.left)

&&(pt.x <rcClient.right)

&&(pt.y >= rcCaption.top)

&&(pt.y <rcCaption.bottom))

{

pControl = m_PaintManager.FindControl(pt)

if (IsInStaticControl(pControl))

{

return HTCAPTION

}

}

return __super::OnNcHitTest(uMsg, wParam, lParam, bHandled)

}

BOOL CXmlWnd::IsInStaticControl(CControlUI * pControl)

{

CDuiString strClassName

std::vector<CDuiString>vctStaticName

std::vector<CDuiString>::iterator it

if (NULL == pControl)

return FALSE

strClassName = pControl->GetClass()

strClassName.MakeLower()

vctStaticName.push_back(L"controlui")

vctStaticName.push_back(L"textui")

vctStaticName.push_back(L"labelui")

vctStaticName.push_back(L"containerui")

vctStaticName.push_back(L"horizontallayoutui")

vctStaticName.push_back(L"verticallayoutui")

vctStaticName.push_back(L"tablayoutui")

vctStaticName.push_back(L"childlayoutui")

vctStaticName.push_back(L"dialoglayoutui")

it = std::find(vctStaticName.begin(), vctStaticName.end(), strClassName)

return (it != vctStaticName.end())

}

LRESULT CXmlWnd::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&bHandled)

{

POINT pt

RECTrcClient

RECTrcCaption

CControlUI *pControl = NULL

rcCaption = m_PaintManager.GetCaptionRect()

GetClientRect(m_PaintManager.GetPaintWindow(), &rcClient)

pt.x = GET_X_LPARAM(lParam)

pt.y = GET_Y_LPARAM(lParam)

::ScreenToClient(m_PaintManager.GetPaintWindow(), &pt)

if (-1 == rcCaption.bottom) ///<xml中描述bottom为-1时,整个窗口区域都可以拖动

{

rcCaption.bottom = rcClient.bottom

}

if ((pt.x >= rcClient.left)

&&(pt.x <rcClient.right)

&&(pt.y >= rcCaption.top)

&&(pt.y <rcCaption.bottom))

{

pControl = m_PaintManager.FindControl(pt)

if (IsInStaticControl(pControl))

{

return HTCAPTION

}

}

return __super::OnNcHitTest(uMsg, wParam, lParam, bHandled)

}

BOOL CXmlWnd::IsInStaticControl(CControlUI * pControl)

{

CDuiString strClassName

std::vector<CDuiString>vctStaticName

std::vector<CDuiString>::iterator it

if (NULL == pControl)

return FALSE

strClassName = pControl->GetClass()

strClassName.MakeLower()

vctStaticName.push_back(L"controlui")

vctStaticName.push_back(L"textui")

vctStaticName.push_back(L"labelui")

vctStaticName.push_back(L"containerui")

vctStaticName.push_back(L"horizontallayoutui")

vctStaticName.push_back(L"verticallayoutui")

vctStaticName.push_back(L"tablayoutui")

vctStaticName.push_back(L"childlayoutui")

vctStaticName.push_back(L"dialoglayoutui")

it = std::find(vctStaticName.begin(), vctStaticName.end(), strClassName)

return (it != vctStaticName.end())

}

子类

[cpp] view

plaincopyprint?

LRESULT CMainDlg::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&bHandled)

{

POINT pt

CDuiString str

CControlUI *pControl = NULL

pt.x = GET_X_LPARAM(lParam)

pt.y = GET_Y_LPARAM(lParam)

::ScreenToClient(m_PaintManager.GetPaintWindow(), &pt)

pControl = m_PaintManager.FindControl(pt)

str = pControl->GetName()

/// 如果是要处理点击的界面元素是静态控件, 要单独处理, 返回 HTCLIENT

if ((str == ELEMENT_MAIN_DLG_CTRL_XX)

|| (str == ELEMENT_MAIN_DLG_CTRL_YY))

{

return HTCLIENT///<要处理的控件不能拖动,可以处理点击

}

return __super::OnNcHitTest(uMsg, wParam, lParam, bHandled)

}


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11740804.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-18
下一篇 2023-05-18

发表评论

登录后才能评论

评论列表(0条)

保存