TipsDialog.cpp
上传用户:zengj883
上传日期:2013-02-03
资源大小:670k
文件大小:2k
- // TipsDialog.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ScrollerTest.h"
- #include "TipsDialog.h"
- // CTipsDialog dialog
- IMPLEMENT_DYNAMIC(CTipsDialog, CDialog)
- CTipsDialog::CTipsDialog(CWnd* pParent /*=NULL*/)
- : CDialog(CTipsDialog::IDD, pParent)
- {
- }
- CTipsDialog::~CTipsDialog()
- {
- }
- void CTipsDialog::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- }
- BEGIN_MESSAGE_MAP(CTipsDialog, CDialog)
- ON_COMMAND(1, SwitchTip)
- END_MESSAGE_MAP()
- // CTipsDialog message handlers
- BOOL CTipsDialog::OnInitDialog()
- {
- CDialog::OnInitDialog();
- m_scroller.SetFont("Microsoft Sans Serif", 10, FW_SEMIBOLD);
- m_scroller.SetText("tHello!");
- m_scroller.SetWrapping(FALSE);
- // short messages, read while paused, not scrolling
- // so scroll quickly and pause for a 6 secs.
- m_scroller.SetScrollDelay(0);
- m_scroller.SetScrollPause(6000);
- CRect rect;
- GetClientRect(&rect);
- m_scroller.Create(rect, this, WS_CHILD|WS_VISIBLE, 1);
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CTipsDialog::SwitchTip()
- {
- static const CString astrTips[] = {
- "This is an example of using CScrollerCtrl to present alternating messages.",
- "All public methods except Create() can be called before or after creation.",
- "Text shadows are displayed only when a pattern is set, and are a combination of the foreground and background colors.",
- "I'm too lazy to think up any more tips.",
- "nntt-o-"};
- static const int nNumTips = sizeof(astrTips)/sizeof(CString);
- static int nCurrentTip = 0;
- m_scroller.SetText(astrTips[nCurrentTip%nNumTips]);
- ++nCurrentTip;
- }