SkinUI5.0官方文档

SkinUI5.0官方文档


进度条

<p>进度条CProgress,继承于CView,支持CView的所有属性和方法。通过给进度条设置不同的背景图片资源,可以得到各种形态的进度条。</p> <h2>属性和相关方法:</h2> <h4>设置进度条的最大进度</h4> <ul> <li>通过XML属性控制如下:</li> </ul> <pre><code class="language-xml">Range="100"</code></pre> <ul> <li>通过C++程序代码调用方法控制如下:</li> </ul> <pre><code class="language-c">void SetRange(int64 nRange);</code></pre> <h4>设置进度条的当前进度</h4> <ul> <li>通过XML属性控制如下:</li> </ul> <pre><code class="language-xml">Pos="1"</code></pre> <ul> <li>通过C++程序代码调用方法控制如下:</li> </ul> <pre><code class="language-c">void SetPos(int64 nPos);</code></pre> <h2>示例</h2> <h4>效果图</h4> <p><img src="http://www.skinui.cn/doc/img/5.0/3/Progress.png" alt="进度条" /></p> <h4>布局文件</h4> <pre><code class="language-xml">&lt;FlexLayout&gt; &lt;TextView Width="MatchParent" Height="60" HorzAlign="Center" Text="IDS_CONTROL11_2" Font="ID_FONT_H4"/&gt; &lt;Line Width="MatchParent" Height="1" Margin="0,0,0,20"/&gt; &lt;RelativeLayout Width="MatchParent" Height="160"&gt; &lt;Progress Id="101" Height="9" AlignParentLeft="40" AlignParentRight="40" AlignParentTop="20" Range="100" Pos="0" Background="Progress.png"/&gt; &lt;Button Id="201" Width="WrapContent" Height="30" ChildText11="增加进度, Step=4" Background="Button.png" Layout="Button.xml" AlignParentHorzCenter="0" ToBottomOf="101,10"/&gt; &lt;Progress Id="102" Height="9" AlignParentLeft="40" AlignParentRight="40" ToBottomOf="201,30" Range="100" Pos="0" Background="Progress2.png"/&gt; &lt;Button Id="202" Width="WrapContent" Height="30" ChildText11="增加进度, Step=10" Background="Button.png" Layout="Button.xml" AlignParentHorzCenter="0" ToBottomOf="102,10"/&gt; &lt;/RelativeLayout&gt; &lt;/FlexLayout&gt;</code></pre> <h4>h文件</h4> <pre><code class="language-cpp">#pragma once class CDemoProgressLayout : public CScrollLayout { public: enum { IDC_PROGRESS1 = 101, IDC_BUTTON1 = 201, IDC_PROGRESS2 = 102, IDC_BUTTON2 = 202, }; public: CDemoProgressLayout(CView* pParent); public: virtual void OnBuildFinish(); protected: void OnBtnClickedAddPosByStep4(UINT uNotifyCode, int nID, CView* pView); void OnBtnClickedAddPosByStep10(UINT uNotifyCode, int nID, CView* pView); SKINUI_DECLARE_MESSAGE_MAP() private: CProgress* m_pProgress1; CProgress* m_pProgress2; SKINUI_DECLARE_DYNCREATE(CDemoProgressLayout, CScrollLayout) };</code></pre> <h4>cpp文件</h4> <pre><code class="language-cpp">#include &lt;stdafx.h&gt; #include "DemoProgressLayout.h" SKINUI_BEGIN_MESSAGE_MAP(CDemoProgressLayout, CScrollLayout) ON_SKINUI_COMMAND(IDC_BUTTON1, OnBtnClickedAddPosByStep4) ON_SKINUI_COMMAND(IDC_BUTTON2, OnBtnClickedAddPosByStep10) SKINUI_END_MESSAGE_MAP() CDemoProgressLayout::CDemoProgressLayout(CView* pParent) : CScrollLayout(pParent) , m_pProgress1(NULL) , m_pProgress2(NULL) { } void CDemoProgressLayout::OnBuildFinish() { CScrollLayout::OnBuildFinish(); m_pProgress1 = dynamic_cast&lt;CProgress*&gt;(GetChildById(IDC_PROGRESS1)); m_pProgress2 = dynamic_cast&lt;CProgress*&gt;(GetChildById(IDC_PROGRESS2)); } void CDemoProgressLayout::OnBtnClickedAddPosByStep4(UINT uNotifyCode, int nID, CView* pView) { if(m_pProgress1) { m_pProgress1-&gt;SetPos(min(m_pProgress1-&gt;GetPos() + 4, m_pProgress1-&gt;GetRange())); m_pProgress1-&gt;Redraw(); } } void CDemoProgressLayout::OnBtnClickedAddPosByStep10(UINT uNotifyCode, int nID, CView* pView) { if(m_pProgress2) { m_pProgress2-&gt;SetPos(min(m_pProgress2-&gt;GetPos() + 10, m_pProgress2-&gt;GetRange())); m_pProgress2-&gt;Redraw(); } }</code></pre>

页面列表

ITEM_HTML