Make your Toolbar colorful

Source: Internet
Author: User

 

 

 ---- On the toolbar of the application, you can place graphical buttons and some controls for quick operations,

We can also play an animation on it.To increase the program dynamics and make the user know that the program is working. This function

InYou can add CanimateCtrl, a standard control for playing an animation, to the toolbar in VC ++.

1. This program allows users to passPlay and close the animation in the "View/animation" menu.

---- Select an AVI file for the program to call before you start programming. This document uses sample. avi .,

Placed inC: emp directory.

 

---- AVI files can be created by yourself in some AVI editors, such as Adobe Premiere 5.1,

Corel Photo-Paint 8 and so on, you can also use existing AVI resources, when creating and selecting, the toolbar should be taken into account

Suitable for Playing videos with smaller images(The image size in the AVI file selected in this article is 27x14 pixels,

Pixel depth is 4 bits.

 

The procedure is as follows:

 

---- 1. Create a project

 

---- Use MFC AppWizard (exe) to create a new project "AnimateToolbar", in the MFC AppWizard-Step 1

Dialog Box selected"Single Document" option, click Finish, and then click OK in the pop-up dialog box.

Button. The project has been created.

 

---- 2. Create menu Resources

 

---- Add the "animation (A)" menu item in "View" and set its ID to ID_VIEW_ANIMATE,

Status Bar prompt (Prompt) is set to "play/Stop Animation ".

 

---- 3. Add the bitmap resource on the toolbar.

 

---- Add a new button to the bitmap resource and set the ID number to ID_ANIMATE.

 

---- 4. Add a CanimateCtrl control to the toolbar and play the animation.

 

---- (1) declare the following member variables in the CmainFrame class:

 

Class CMainFrame: public CFrameWnd

{

...

Public:

BOOLIsAnimationActive; // whether to play the animation identifier

CAnimateCtrlM_Animate;

 ...

}

 

---- (2) initialize the IsAnimationActive variable in the CmainFrame class constructor:

CMainFrame: CMainFrame ()

{

// TODO: add member initialization code here

IsAnimationActive = TRUE;

}

 

---- (3) create the CAnimateCtrl control in the CMainFrame: OnCreate Function

Int CMainFrame: OnCreate (maid)

{

...

CRect rect;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.