Document directory
Progress Control
When a time-consuming operation is in the process, the user is usually prompted, indicating that you are performing the operation, rather than stuck there. the most common prompt is the progress bar. in addition, the progress bar is generally used with timer, because it will be automatically refreshed if it is used.
Use timer see: http://blog.csdn.net/weiwenhp/article/details/8733216
In addition, the most important operations of progress control are as follows:
1. Specify the range, and use numbers. Just like in our system work progress, we need to specify a time, such as a week to deal with something.
2. Specify the current POs, which is the progress. For example, after half a week, the progress is 50%.
Usage example
/////// Cmfc_ctrl_dlg.h //////////////
Cprogressctrl m_pro;
Afx_msg void ontimer (uint_ptr nidevent );
/// // Cmfc_ctrl_dlg.cpp //////////////////////
# Define time_id 88
//..........
Ddx_control (PDX, idc_pro, m_pro );
//...............
On_wm_timer ()
Bool cmfc_ctrl_dlg: oninitdialog ()
{
Cdialog: oninitdialog ();
Settimer (time_id,); // set the timer to run once every second
M_pro.setrange (0,250 );
M_pro.setpos (0); // set the initial position
}
Void cmfc_ctrl_dlg: ontimer (uint_ptr nidevent)
{
If (nidevent = time_id)
{
Pos + = 10;
If (Pos> 250)
Pos = 250;
M_pro.setpos (POS); // specifies the current progress
}
}
Slider Control
In fact, Slider ctrono is similar to progress control. progress is the progress that the program tells the user what to do, and slider allows the user to specify the progress. the most typical one is that we pull a progress bar when playing a video. it is a slider control.
Usage example.
Csliderctrl m_slider;
Ddx_control (PDX, idc_slider1, m_slider );
// Initialization
M_slider.setrange (0, 59 );// If the user is asked to select a minute, it can only be a number from 0 to 59
M_slider.setpos (0 );
Message Processing. process the message when pulling the progress bar.
On_notify (nm_customdraw, Idc_slider1, & cmfc_ctrl_dlg: onnmcustomdrawslider1)
Void cmfc_ctrl_dlg: onnmcustomdrawslider1 (nmhdr * pnmhdr, lresult * presult)
{
Int nminute = m_slider.getpos ();// Obtain the selected location.
// You can perform other operations based on this information. For example, if the video is used, load the corresponding content according to this number.
}