⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tipsdialog.cpp

📁 文本滚动控件
💻 CPP
字号:
// 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.",
      "\n\n\t\t-o-"};
   static const int nNumTips = sizeof(astrTips)/sizeof(CString);
   static int nCurrentTip = 0;
   m_scroller.SetText(astrTips[nCurrentTip%nNumTips]);
   ++nCurrentTip;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -