Duilib中的CLabelUI使用中遇到的问题(目前不知道是不是bug)

来源:赵克立博客 分类: C/C++ 标签:C/C++duilib发布时间:2014-07-12 23:07:18最后更新:2014-07-13 00:05:31浏览:5624
版权声明:
本文为博主原创文章,转载请声明原文链接...谢谢。o_0。
更新时间:
2014-07-13 00:05:31
温馨提示:
学无止境,技术类文章有它的时效性,请留意文章更新时间,如发现内容有误请留言指出,防止别人"踩坑",我会及时更新文章

先看下下面代码


CLabelUI* m_plabel=NULL;
m_plabel= static_cast<CLabelUI*>(m_pm.FindControl(_T("wintitle")));
m_plabel->SetText("标签");
m_plabel=NULL;


上面是一个普通的设置标签文本的操作然后看xml文件


        <HorizontalLayout name="HorizontalLayoutUI1"  height="40" bordersize="1"  bkcolor="#FF57C0FF" bkcolor2="#00FFFFFF">
           
                 <Label  name="wintitle" showhtml="true" text="  抓取网络内容" />
            <HorizontalLayout name="HorizontalLayoutUI3" pos="0,0,60,0" width="55">
                <Button name="btn_min" text="-" tooltip="最小化" bordersize="0" width="20" height="20" padding="5,5,0,0" textcolor="#00FFFBF0" disabledtextcolor="#FFA7A6AA" align="center" hotimage="file=&apos;btn_hover.png&apos; hole=&apos;true&apos;" pushedimage="btn_down.png" />
                <Button name="btn_close" text="X" tooltip="关闭" bordersize="0"  width="20" height="20" padding="5,5,0,0" textcolor="#00FFFBF0" disabledtextcolor="#FFA7A6AA" align="center" hotimage="file=&apos;close.png&apos; mask=&apos;0xffff0000&apos; hole=&apos;true&apos;" pushedimage="close_down.png" />
            </HorizontalLayout>
        </HorizontalLayout>


上面是我写的一个窗口的标题栏的代码单击运行最上的设置标签wintitle的文本后就出现啦下面这个错误

未处理的异常: 0xC0000005: 读取位置 0x00000000 时发生访问冲突


代码都正常真是让人纳闷,找问题找啦半天终于测试出问题所在不过不知道为什么

问题是在xml文件里面的结构如果把label标签用一个容器包括住就ok啦,看下面代码



        <HorizontalLayout name="HorizontalLayoutUI1"  height="40" bordersize="1"  bkcolor="#FF57C0FF" bkcolor2="#00FFFFFF">
           
            <HorizontalLayout name="HorizontalLayoutUI2">
                 <Label  name="wintitle" showhtml="true" text="  抓取网络内容" />
            </HorizontalLayout>
            <HorizontalLayout name="HorizontalLayoutUI3" pos="0,0,60,0" width="55">
                <Button name="btn_min" text="-" tooltip="最小化" bordersize="0" width="20" height="20" padding="5,5,0,0" textcolor="#00FFFBF0" disabledtextcolor="#FFA7A6AA" align="center" hotimage="file=&apos;btn_hover.png&apos; hole=&apos;true&apos;" pushedimage="btn_down.png" />
                <Button name="btn_close" text="X" tooltip="关闭" bordersize="0"  width="20" height="20" padding="5,5,0,0" textcolor="#00FFFBF0" disabledtextcolor="#FFA7A6AA" align="center" hotimage="file=&apos;close.png&apos; mask=&apos;0xffff0000&apos; hole=&apos;true&apos;" pushedimage="close_down.png" />
            </HorizontalLayout>
        </HorizontalLayout>




微信号:kelicom QQ群:215861553 紧急求助须知
Win32/PHP/JS/Android/Python