The simple fabrication of MFC digital clock in VS2013

Source: Internet
Author: User

First, create a new project: File---> New--Project. Select the MFC Application. Name is clock

After the next selection dialog-based application, click Finish.

Second, the dialog box of the OK and Cancel button Delete, add two static text box in the toolbar, in the property settings of the two text boxes, the text (Align text) set the center, the boundary (Border) set false, first name (Caption) To set the ID of the two text box to Idc_static1 and Idc_static2, respectively, in the static delete.

Three, click the project, add the message Vm_timer in the Class Wizard, add the handler, and edit the code.

Add the corresponding function in the time message

Add code in the Initialize interface function (BOOL cclockdlg::oninitdialog ()): SetTimer (1, +, NULL);

Four, set the font and color: You can also add the message Vm_ctlcolor in the Class Wizard, add code in the ClockDlg.h header file: CFont datefont; CFont Timefont;

and add a bit of code to the message response function. For the date and time text box to set a different color, the specific color can be Baidu RGB color table query.

Five. In the initialized function (BOOL cclockdlg::oninitdialog ()) Add the following code to apply the set font and color to the date and time text box

Finally, build the solution and run it OK! This run:

Write a bit wordy, look master do not spray, only hope to write digital clock Novice to provide reference!

The simple fabrication of MFC digital clock in VS2013

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.