Jumpy Text Class

Environment: VC6 SP2, NT4 SP5, CE 2.11

Sample Image This class is derived from CStatic and presents a special effect that will kick your ass. It is very simple to use and I hope you'll enjoy it very much. Here is how you use this class:

    1. Download the source code.
    2. Insert the .h and .cpp files into your project.
    3. Add a static control into your dialog resource.
    4. Add a member variable for that static control.
    5. Modify the varible declaration.
Change this:

    CStatic m_ctrlYourStaticControl; 
To this:

    CJumpyDraw m_ctrlYourStaticControl; 
    6. In your InitDialog message handler set the JumpyText parameters. Use these member functions:

    SetCharHeight()
    SetText()
    7. When you want to start the animation call StartJumpyText.

Downloads

Download demo project (including Release build) - 137 Kb
Download source - 4.77 Kb


Comments

  • Urgent help

    Posted by Legacy on 05/03/2001 12:00am

    Originally posted by: Hoa AN

    Dear sir,

    Can you help me to overcome the following problem:
    I want to have a static text control in VC++ 6.0 that has background transparent just like a label control in VB that has BackStyle set to TRANSPARENT. Because I want to use this static text to display text over an image background on a dialog box.
    Thanks for you help.

    H.A

    Reply
  • use float values in gradient generation

    Posted by Legacy on 01/29/2001 12:00am

    Originally posted by: Achim Hentschel

    Great modification of CStatic! Exactly what I was looking for - a gradient static control.
    
    But while using I recognized that gradient generation was not that precise. I changed the int values to float and used a casting in RGB() function.

    void CJumpyDraw::DrawLinearWash(CDC* pDC, CRect* prc, COLORREF crStart, COLORREF crEnd)
    {
    // Get the starting RGB values and calculate the incremental
    // changes to be applied.

    COLORREF cr;
    float iR = GetRValue(crStart);
    float iG = GetGValue(crStart);
    float iB = GetGValue(crStart);
    float idR = (GetRValue(crEnd) - iR) / (m_iGradientSteps - 1);
    float idG = (GetGValue(crEnd) - iG) / (m_iGradientSteps - 1);
    float idB = (GetBValue(crEnd) - iB) / (m_iGradientSteps - 1);
    int icx = prc->Width() / m_iGradientSteps, iLeft = prc->left, iRight;
    pDC->SelectStockObject(NULL_PEN);

    for (int i = 0; i < m_iGradientSteps; i++, iR += idR, iG += idG, iB += idB)
    {
    // Use special code for the last segment to avoid any problems
    // with integer division.

    if (i == (m_iGradientSteps - 1))
    iRight = prc->right;
    else
    iRight = iLeft + icx;

    cr = RGB((int) iR, (int) iG, (int) iB);

    // The following extra stack frame allocates and disposes
    // of the GDI objects nicely.

    {
    // Perform the drawing and restore the DC; the objects
    // will be freed automatically.

    CBrush br(cr);
    CBrush* pbrOld = pDC->SelectObject(&br);
    pDC->Rectangle(iLeft, prc->top, iRight + 1, prc->bottom);
    pDC->SelectObject(pbrOld);
    }
    // Reset the left side of the drawing rectangle.

    iLeft = iRight;
    }
    }

    I also added a member variable for the gradient steps (m_iGradientSteps) replacing the const int.

    Achim Hentschel


    Reply
  • Greate Work.But I need a help

    Posted by Legacy on 01/10/2001 12:00am

    Originally posted by: Arun Jose

    But how could u make a static control to capture BN_CLICKED message.ie. if I click on a static box it should fire an event.Have u got any idea .If do pls mail me thank u.

    Reply
  • Good job Fabian Toader. Thank you.

    Posted by Legacy on 02/23/2000 12:00am

    Originally posted by: De Tran

    Reply
  • Very cool

    Posted by Legacy on 01/19/2000 12:00am

    Originally posted by: Jason Hattingh

    Thanks for that - I like it. Very well presented demo project, too.

    Jason

    Reply
  • Great job...but could be greater....

    Posted by Legacy on 12/03/1999 12:00am

    Originally posted by: Dani alias Zizi

    HA HA

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: May 11, 2015 @ 1:00 p.m. ET / 10:00 a.m. PT One of the languages that have always been supported with the Intel® RealSense™ SDK (Software Developer Kit) is JavaScript, specifically so that web-enabled apps could be created. Come hear from Intel Expert Bob Duffy as he reviews his own little "space shooting" game where the orientation of your face controls the aiming reticle to help teach developers how to write apps and games in JavaScript that can use facial and gesture …

  • You may not realize the complexity you could be creating when developing mobile apps – many companies don't initially. You could be doubling your IT costs for development and delivery; not to mention, risking sales, productivity and brand satisfaction. Read this IBM-commissioned Forrester Study to understand the key cost drivers of mobile app delivery -- for both customer-facing and enterprise applications. Find out how you could lower costs and increase success with the right strategy and investment.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date