Introduction
CTipStatic
is a Cstatic
derived class that allows you to implement a sliding 'Tip of the day' like Microsft Outlook.
Usage
- Include
TipStatic.cpp
and TipStatic.h
in your project.
- Create a new
CTipStatic
class object and just invoke Create
function.
In your header file.
#include "TipStatic.cpp"
class CMyDialog : public CDialog
{
....
protected:
CTipStatic m_ctrTipStatic;
};
In your cpp file.
int CMyDialog::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
m_ctrTipStatic.Create("TipStatic",WS_VISIBLE|WS_CHILD,
CRect(10,10, 100,120),this, IDC_TIP_STATIC);
....
return 0;
}
- Initialize
CTipStatic
class object by using AddTip(), SetSliderColor(), SetSliderMode()
.
BOOL CStaticTipDlg::OnInitDialog()
{
CDialog::OnInitDialog();
....
m_ctrTipStatic.AddTip("Hi\n Welcome to Cool-Tip Static!!\n\nSmile Seo");
m_ctrTipStatic.AddTip("Second.. Tip");
m_ctrTipStatic.AddTip("Third.. Tip");
m_ctrTipStatic.SetSliderColor(GetSysColor(COLOR_3DFACE));
m_ctrTipStatic.SetSliderMode(TRUE);
....
return TRUE;
}
- Just call
ShowNextTip()
or ShowPrevTip()
.
Member Functions
<table border="1">
<tr>
<td>Function prototype</td>
<td>Description</td>
</tr>
<tr>
<td><code>void AddTip(CString strTip)</td>
<td></td>
Add tip-text to the CTipStatic</td>
</tr>
<tr></tr>
<td></td>
void SetSliderColor(COLORREF colSlider)</td>
<td></td>
If you use 'Slider', this 'colSlider' is a wonderful effect just like 'Outlook today's tip'.</td>
</tr>
<tr></tr>
<td></td>
void SetSliderMode(BOOL bSlider)</td>
<td></td>
Set whether to use the 'slider' mode</td>
</tr>
</table>
Ajou University C.C. 4th member.