duilib的Option属性设置

duilib的Option属性设置,第1张

<Controls>

<Window parent="">

<Attribute name="size" default="0,0" type="SIZE" comment="窗口的初始化大小,如(800,600)"/>

<Attribute name="sizebox" default="0,0,0,0" type="RECT" comment="窗口可拖动改变窗口大小的边距,如(4,4,6,6)"/>

<Attribute name="caption" default="0,0,0,0" type="RECT" comment="窗口可拖动的标题栏大小的边距,最后一个参数是指离上边框的距离,如(0,0,0,28)"/>

<Attribute name="roundcorner" default="0,0" type="SIZE" comment="窗口圆角大小,如(4,4)"/>

<Attribute name="mininfo" default="0,0" type="SIZE" comment="窗口最小大小,如(320,240)"/>

<Attribute name="maxinfo" default="0,0" type="SIZE" comment="窗口最大大小,如(1600,1200)"/>

<Attribute name="alpha" default="255" type="BYTE" comment="窗口的alpha值(0-255),如(100)"/>

<Attribute name="bktrans" default="false" type="BOOL" comment="窗口是否使用静态透明背景,如(false)"/>

<Attribute name="disabledfontcolor" default="0xFFA7A6AA" type="DWORD" comment="默认的disabled字体颜色,如(0xFFA7A6AA)"/>

<Attribute name="defaultfontcolor" default="0xFF000000" type="DWORD" comment="默认的字体颜色,如(0xFF000000)"/>

<Attribute name="linkfontcolor" default="0xFF0000FF" type="DWORD" comment="默认的link字体颜色,如(0xFF0000FF)"/>

<Attribute name="linkhoverfontcolor" default="0xFFD3215F" type="DWORD" comment="默认的linkhoverfont字体颜色,如(0xFFD3215F)"/>

<Attribute name="selectedcolor" default="0xFFBAE4FF" type="DWORD" comment="默认的selected字体颜色,如(0xFFBAE4FF)"/>

<Attribute name="showdirty" default="false" type="BOOL" comment="绘制脏矩形(屏幕上更新的区域被称为脏矩形)"/>

</Window>

<ChildLayout parent="Container" >

<Attribute name="xmlfile" default="" type="STRING" comment="子窗体XML布局文件"/>

</ChildLayout>

<Control parent="" notifies="setfocus killfocus timer menu windowinit(root)">

<Attribute name="name" default="" type="STRING" comment="控件名字,同一窗口内必须唯一,如(testbtn)"/>

<Attribute name="pos" default="0,0,0,0" type="RECT" comment="位置,如果为float控件则指定位置和大小,否则只指定大小,如(0,0,100,100)"/>

<Attribute name="padding" default="0,0,0,0" type="RECT" comment="外边距,如(2,2,2,2)"/>

<Attribute name="bkcolor" default="0x00000000" type="DWORD" comment="背景颜色,如(0xFFFF0000)"/>

<Attribute name="bkcolor2" default="0x00000000" type="DWORD" comment="背景渐变色2,和bkcolor配合使用,如(0xFFFFFF00)"/>

<Attribute name="bkcolor3" default="0x00000000" type="DWORD" comment="背景渐变色3,和bkcolor、bkcolor2配合使用,如(0xFFFF00FF)"/>

<Attribute name="bordercolor" default="0x00000000" type="DWORD" comment="边框颜色,如(0xFF000000)"/>

<Attribute name="focusbordercolor" default="0x00000000" type="DWORD" comment="获得焦点时边框的颜色,如(0xFFFF0000)"/>

<Attribute name="colorhsl" default="false" type="BOOL" comment="本控件的颜色是否随窗口的hsl变化而变化,如(false)"/>

<Attribute name="bordersize" default="0" type="INT | RECT" comment="可以设置INT或RECT类型的值。当值为ING时则左、上、右、下都用该值作为宽。值为RECT类型时则分别设置左、上、右、下的边框"/>

<Attribute name="leftbordersize" default="0" type="INT" comment="左边边框大小,如(1),设置该值大于0,则将忽略bordersize属性的设置"/>

<Attribute name="topbordersize" default="0" type="INT" comment="顶部边框大小,如(1),设置该值大于0,则将忽略bordersize属性的设置"/>

<Attribute name="rightbordersize" default="0" type="INT" comment="右边边框大小,如(1),设置该值大于0,则将忽略bordersize属性的设置"/>

<Attribute name="bottombordersize" default="0" type="INT" comment="底部边框大小,如(1),设置该值大于0,则将忽略bordersize属性的设置"/>

<Attribute name="borderstyle" default="0" type="INT" comment="边框样式的设置,数值范围0-5"/>

<Attribute name="borderround" default="0,0" type="SIZE" comment="边框圆角半径,如(2,2)"/>

<Attribute name="bkimage" default="" type="STRING" comment="背景图片,如(bk.bmp或file='aaa.jpg' res='' restype='0' dest='0,0,0,0' source='0,0,0,0' corner='0,0,0,0' mask='#FF0000' fade='255' hole='false' xtiled='false' ytiled='false')"/>

<Attribute name="width" default="0" type="INT" comment="控件预设的宽度,如(100)"/>

<Attribute name="height" default="0" type="INT" comment="控件预设的高度,如(30)"/>

<Attribute name="minwidth" default="0" type="INT" comment="控件的最小宽度,如(100)"/>

<Attribute name="minheight" default="0" type="INT" comment="控件的最小高度,如(30)"/>

<Attribute name="maxwidth" default="9999" type="INT" comment="控件的最大宽度,如(100)"/>

<Attribute name="maxheight" default="9999" type="INT" comment="控件的最大高度,如(30)"/>

<Attribute name="text" default="" type="STRING" comment="显示文本,如(测试文本)"/>

<Attribute name="tooltip" default="" type="STRING" comment="鼠标悬浮提示,如(请在这里输入你的密码)"/>

<Attribute name="userdata" default="" type="STRING" comment="自定义标识"/>

<Attribute name="enabled" default="true" type="BOOL" comment="是否可以响应用户 *** 作,如(true)"/>

<Attribute name="mouse" default="true" type="BOOL" comment="本控件是否可以响应鼠标 *** 作,如(true)"/>

<Attribute name="visible" default="true" type="BOOL" comment="是否可见,如(true)"/>

<Attribute name="float" default="false" type="BOOL" comment="是否使用绝对定位,如(true)"/>

<Attribute name="shortcut" default="" type="CHAR" comment="对应的快捷键,如(P)"/>

<Attribute name="menu" default="false" type="BOOL" comment="是否需要右键菜单,如(true)"/>

<Attribute name="keyboard" default="true" type="BOOL" comment="非CButtonUI类忽略该值,为false时不支持TAB_STOP,且该对象不处理键盘信息"/>

</Control>

<Container parent="Control" notifies="setfocus killfocus timer menu windowinit(root)">

<Attribute name="name" default="" type="STRING" comment="控件名字,同一窗口内必须唯一,如(testbtn)"/>

<Attribute name="pos" default="0,0,0,0" type="RECT" comment="位置,如果为float控件则指定位置和大小,否则只指定大小,如(0,0,100,100)"/>

<Attribute name="padding" default="0,0,0,0" type="RECT" comment="外边距,如(2,2,2,2)"/>

<Attribute name="bkcolor" default="0x00000000" type="DWORD" comment="背景颜色,如(0xFFFF0000)"/>

<Attribute name="bkcolor2" default="0x00000000" type="DWORD" comment="背景渐变色2,和bkcolor配合使用,如(0xFFFFFF00)"/>

<Attribute name="bkcolor3" default="0x00000000" type="DWORD" comment="背景渐变色3,和bkcolor、bkcolor2配合使用,如(0xFFFF00FF)"/>

<Attribute name="bordercolor" default="0x00000000" type="DWORD" comment="边框颜色,如(0xFF000000)"/>

<Attribute name="focusbordercolor" default="0x00000000" type="DWORD" comment="获得焦点时边框的颜色,如(0xFFFF0000)"/>

<Attribute name="colorhsl" default="false" type="BOOL" comment="本控件的颜色是否随窗口的hsl变化而变化,如(false)"/>

<Attribute name="bordersize" default="1" type="INT" comment="边框大小,如(1)"/>

<Attribute name="borderround" default="0,0" type="SIZE" comment="边框圆角半径,如(2,2)"/>

<Attribute name="bkimage" default="" type="STRING" comment="背景图片,如(bk.bmp或file='aaa.jpg' res='' restype='0' dest='0,0,0,0' source='0,0,0,0' corner='0,0,0,0' mask='#FF0000' fade='255' hole='false' xtiled='false' ytiled='false')"/>

<Attribute name="width" default="0" type="INT" comment="控件预设的宽度,如(100)"/>

<Attribute name="height" default="0" type="INT" comment="控件预设的高度,如(30)"/>

<Attribute name="minwidth" default="0" type="INT" comment="控件的最小宽度,如(100)"/>

<Attribute name="minheight" default="0" type="INT" comment="控件的最小高度,如(30)"/>

<Attribute name="maxwidth" default="9999" type="INT" comment="控件的最大宽度,如(100)"/>

<Attribute name="maxheight" default="9999" type="INT" comment="控件的最大高度,如(30)"/>

<Attribute name="text" default="" type="STRING" comment="显示文本,如(测试文本)"/>

<Attribute name="tooltip" default="" type="STRING" comment="鼠标悬浮提示,如(请在这里输入你的密码)"/>

<Attribute name="userdata" default="" type="STRING" comment="自定义标识"/>

<Attribute name="enabled" default="true" type="BOOL" comment="是否可以响应用户 *** 作,如(true)"/>

<Attribute name="mouse" default="true" type="BOOL" comment="本控件是否可以响应鼠标 *** 作,如(true)"/>

<Attribute name="mousechild" default="true" type="BOOL" comment="本控件的子控件是否可以响应用户 *** 作,如(true)"/>

<Attribute name="visible" default="true" type="BOOL" comment="是否可见,如(true)"/>

<Attribute name="float" default="false" type="BOOL" comment="是否使用绝对定位,如(true)"/>

<Attribute name="shortcut" default="" type="CHAR" comment="对应的快捷键,如(P)"/>

<Attribute name="menu" default="false" type="BOOL" comment="是否需要右键菜单,如(true)"/>

<Attribute name="inset" default="0,0,0,0" type="RECT" comment="容器的内边距,如(2,2,2,2)"/>

<Attribute name="vscrollbar" default="false" type="BOOL" comment="是否使用竖向滚动条,如(true)"/>

<Attribute name="hscrollbar" default="false" type="BOOL" comment="是否使用横向滚动条,如(true)"/>

<Attribute name="childpadding" default="0" type="INT" comment="子控件之间的额外距离,如(4)"/>

</Container>

<VerticalLayout parent="Container" notifies="setfocus killfocus timer menu windowinit(root)">

<Attribute name="name" default="" type="STRING" comment="控件名字,同一窗口内必须唯一,如(testbtn)"/>

<Attribute name="pos" default="0,0,0,0" type="RECT" comment="位置,如果为float控件则指定位置和大小,否则只指定大小,如(0,0,100,100)"/>

<Attribute name="padding" default="0,0,0,0" type="RECT" comment="外边距,如(2,2,2,2)"/>

<Attribute name="bkcolor" default="0x00000000" type="DWORD" comment="背景颜色,如(0xFFFF0000)"/>

<Attribute name="bkcolor2" default="0x00000000" type="DWORD" comment="背景渐变色2,和bkcolor配合使用,如(0xFFFFFF00)"/>

<Attribute name="bkcolor3" default="0x00000000" type="DWORD" comment="背景渐变色3,和bkcolor、bkcolor2配合使用,如(0xFFFF00FF)"/>

<Attribute name="bordercolor" default="0x00000000" type="DWORD" comment="边框颜色,如(0xFF000000)"/>

<Attribute name="focusbordercolor" default="0x00000000" type="DWORD" comment="获得焦点时边框的颜色,如(0xFFFF0000)"/>

<Attribute name="colorhsl" default="false" type="BOOL" comment="本控件的颜色是否随窗口的hsl变化而变化,如(false)"/>

<Attribute name="bordersize" default="1" type="INT" comment="边框大小,如(1)"/>

<Attribute name="borderround" default="0,0" type="SIZE" comment="边框圆角半径,如(2,2)"/>

<Attribute name="bkimage" default="" type="STRING" comment="背景图片,如(bk.bmp或file='aaa.jpg' res='' restype='0' dest='0,0,0,0' source='0,0,0,0' corner='0,0,0,0' mask='#FF0000' fade='255' hole='false' xtiled='false' ytiled='false')"/>

<Attribute name="width" default="0" type="INT" comment="控件预设的宽度,如(100)"/>

<Attribute name="height" default="0" type="INT" comment="控件预设的高度,如(30)"/>

<Attribute name="minwidth" default="0" type="INT" comment="控件的最小宽度,如(100)"/>

<Attribute name="minheight" default="0" type="INT" comment="控件的最小高度,如(30)"/>

<Attribute name="maxwidth" default="9999" type="INT" comment="控件的最大宽度,如(100)"/>

<Attribute name="maxheight" default="9999" type="INT" comment="控件的最大高度,如(30)"/>

<Attribute name="text" default="" type="STRING" comment="显示文本,如(测试文本)"/>

<Attribute name="tooltip" default="" type="STRING" comment="鼠标悬浮提示,如(请在这里输入你的密码)"/>

<Attribute name="userdata" default="" type="STRING" comment="自定义标识"/>

<Attribute name="enabled" default="true" type="BOOL" comment="是否可以响应用户 *** 作,如(true)"/>

一、出现duilib文件丢失的原因及影响

1、出现duilib文件丢失的原因,一是病毒引起;二是人为的错误 *** 作;三是非法关机。

2、出现duilib文件丢失,会导致有些应用软件打不开,并出现如下图的提示:

二、解决方法:

(一)到其它的电脑中复制一个文件过来。

此文件的路径是C\Windows\System32,如下图:

(二)到网络上下载一个文件,放入C\Windows\System32

此文件网络上有下载的资源,如下图:

(三)使用360安全卫士进行修复。具体 *** 作方法是:

1、打开360安全卫士。

2、进入系统急救箱,如下图:

3、点击开始急救。如下图:

在基类中做默认的控件拖动判断, 在子类中做特殊控件判断, 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://54852.com/bake/11757381.html

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

发表评论

登录后才能评论

评论列表(0条)

    保存