提示消息框
<h4>效果图</h4>
<p><img src="http://www.skinui.cn/doc/img/5.0/4/Alert.png" alt="非模态消息框" /></p>
<ul>
<li>调用以下接口弹出提示消息框:</li>
</ul>
<pre><code class="language-c">int Alert(const String& strMessage, const String& strCaption = _T(""), const String& strButtonName = _T(""));</code></pre>
<h4>示例代码</h4>
<ul>
<li>h文件</li>
</ul>
<pre><code class="language-c">#pragma once
class CDemoAlertLayout : public CFlexLayout
{
public:
enum
{
IDC_BUTTON_CLICK_ME = 1001,
};
public:
CDemoAlertLayout(CView* pParent);
public:
virtual void OnBuildFinish();
protected:
void OnBtnClickedClickMe(UINT uNotifyCode, int nID, CView* pView);
SKINUI_DECLARE_MESSAGE_MAP()
SKINUI_DECLARE_DYNCREATE(CDemoAlertLayout, CFlexLayout)
};</code></pre>
<ul>
<li>cpp文件</li>
</ul>
<pre><code class="language-c">#include <stdafx.h>
#include "DemoAlertLayout.h"
SKINUI_BEGIN_MESSAGE_MAP(CDemoAlertLayout, CFlexLayout)
ON_SKINUI_COMMAND(IDC_BUTTON_CLICK_ME, OnBtnClickedClickMe)
SKINUI_END_MESSAGE_MAP()
CDemoAlertLayout::CDemoAlertLayout(CView* pParent)
: CFlexLayout(pParent)
{
}
void CDemoAlertLayout::OnBuildFinish()
{
CFlexLayout::OnBuildFinish();
}
void CDemoAlertLayout::OnBtnClickedClickMe(UINT uNotifyCode, int nID, CView* pView)
{
String strCaption = _T("提示");
String strMessage = _T("这是一个提示信息!");
String strButtonName = _T("确定");
int nButtonIndex = GetOwner()->Alert(strMessage, strCaption, strButtonName);
}</code></pre>