Click here to Skip to main content
Licence CPOL
First Posted 9 Jan 2000
Views 49,885
Downloads 1,156
Bookmarked 12 times

Tip-Static control like

By | 9 Jan 2000 | Article
A tip-of-the-day control that uses a cool sliding effect to show each tip

Sample Image - tip_static.gif

Introduction

CTipStatic is a Cstatic derived class that allows you to implement a sliding 'Tip of the day' like Microsft Outlook.

Usage

  1. Include TipStatic.cpp and TipStatic.h in your project.
  2. Create a new CTipStatic class object and just invoke Create function.

    In your header file.

        #include "TipStatic.cpp"
        
        class CMyDialog : public CDialog
        {
        
        ....
        // Attributes
        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;
        }
  3. Initialize CTipStatic class object by using AddTip(), SetSliderColor(), SetSliderMode().
        BOOL CStaticTipDlg::OnInitDialog()
        {
            CDialog::OnInitDialog();
            
            ....
    
            // TODO: Add extra initialization here
        
            // Add Tip..
            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;  // return TRUE  unless you set the focus to a control
        }
  4. 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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Wooseok Seo

Software Developer (Senior)

Korea (Republic Of) Korea (Republic Of)

Member

Woo Seok Seo have been a Microsoft MVP for 7 years and have translated several books into Korean. Author of C# Programming for Beginner (DevPress, 2001), he is interested in Debugging techniques and .NET technology. Get in touch with Woo Seok Seo at wooseok.seo@gmail.com

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 1 Pinmemberscristian718:58 8 Aug '09  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 9 Jan 2000
Article Copyright 2000 by Wooseok Seo
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid