XTicker
Tickers are commonly seen in news-feed viewers and stock-tracking software. XTicker implements a very small and efficient non-MFC ticker control that can be used in any Win32 or MFC application.
Demo Application
The demo application shows how XTicker can display text (from a string directly passed or from a string resource) on gradient backgrounds:
XTicker Features
XTicker offers the following features:| You can display strings of any length (limited to 2,000 characters if loaded from string resource). | |
| You can choose the text and background colors. Background color may be gradient or solid. | |
| You can specify both the scrolling speed and the number of pixels to shift, to optimize XTicker for your application and users. | |
| The ticker display automatically stops when the mouse cursor is hovering, and will resume scrolling when the cursor leaves the control. | |
| Clicking on the control will send a message to the parent window. |
CXTicker Class Members
| Construction | ||
| CXTicker() | Default constructor | |
| virtual BOOL Create(LPCTSTR lpszText, DWORD dwStyle, const RECT& rect, HWND hParent, UINT nID, HINSTANCE hInstance, HINSTANCE hResInstance, COLORREF textcolor, COLORREF bgcolor1, COLORREF bgcolor2) | Creates and initializes the window associated with the CXTicker object | |
Attributes |
||
| m_hWnd | Window handle of XTicker | |
| BOOL GetBold() | Retrieves bold setting. | |
| HFONT GetFont() | Retrieves font handle | |
| int GetPixelsToShift() | Retrieves number of pixels to shift | |
| int GetTickerSpeed() | Retrieves ticker scroll speed | |
| int GetWindowText(LPTSTR lpszText, int nMaxCount) | Copies the display text into a buffer | |
| BOOL IsWindowEnabled() | Determines whether control is enabled | |
| CXTicker& SetBold(BOOL bBold) | Set display font to bold or normal | |
| CXTicker& SetColors(COLORREF textcolor, COLORREF bgcolor1, COLORREF bgcolor2) | Set display text and background colors | |
| CXTicker& SetFont(LOGFONT& lf) | Set display font | |
| CXTicker& SetPixelsToShift(int pixels) | Set number of pixels to shift | |
| CXTicker& SetTickerSpeed(int speed) | Set ticker scroll speed | |
| CXTicker& SetWindowText(LPCTSTR lpszText) | Set display text | |
Operations |
||
| void EnableWindow(BOOL bEnable) | Enables/disables control | |
| CXTicker& Start() | Start ticker scrolling display | |
| CXTicker& Stop() | Stop ticker scrolling display | |
| void UpdateWindow() | Redraws control | |
How To Use
Step 1: Add Files
All the files you need to add to your project are in the XTicker folder in the download:- CXDC.h
- CXRect.h
- XTicker.cpp
- XTicker.h
- XTrace.h
Step 2: Create XTicker
XTickerTestDlg.cpp shows how to create the XTicker object: VERIFY(m_Ticker1.Create(
_T("Status: GREEN All systems nominal."),
0, rect, m_hWnd, 9001, AfxGetInstanceHandle(), 0,
RGB(0,0,0),
RGB(229,252,229), RGB(102,252,102)));
Step 3: Set XTicker Attributes
You should now set the speed, font, and other attributes for the XTicker object.Step 4: Start XTicker
Start scrolling by using theStart() API:
m_Ticker1.Start();
Revision History
Version 1.0
- Initial release
Buy latest version
| Buy XTicker 1.0 license – $20.00 per developer. Includes full source code to XTicker and MFC dialog sample, with VS6, VS2008, and VS2010 projects. |