Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Visual C++ and MFC Fundamentals Chapter 15: Fundamental Controls


CDialog::OnRButtonDown(nFlags, point);
}


  1. To allow the user to resume playing the video, add a WM_LBUTTONDBLCLK
    message and implement its as follows:


void CAnimation1Dlg::OnLButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_Animator.Play(0, -1, -1);

CDialog::OnLButtonDblClk(nFlags, point);
}


  1. Test the application and return to MSVC


15.3 Group Boxes.................................................................................................


15.3.1..Introduction..........................................................................................


A group box is a static control used to set a visible or programmatic group of controls. A
group box primarily draws a rectangular box where it is positioned. This creates an
impression of controls that would be treated as a group. A group can then be used for its
ability to show a limiting box that encompasses some controls on the dialog box or form
but, as we will see when studying radio buttons, a group box can be used to create a
group of controls where such controls should or must be treated as one entity.

15.3.2..Group Box Properties and Data Exchange......................................


To create a group box, from the Controls toolbox, click the Group Box button and click
the desired area on the form or dialog box. To programmatically create a group box,
declare a pointer to CWnd, initialize it with the new operator, and call the Create()
method. Specify the class name as STATIC. In most circumstances, you can use a group
control without referring to it programmatically. If you had visually added the control to
your application and you plan to refer to it in your code, you should change its identifier
to something other than IDC_STATIC

As stated already, one of the most regular roles of a group box is to create a group of
controls visibly delimited by a rectangular frame. To indicate what the group represents,
the group box is equipped with a Caption property for which you supply a string. By
default, the text of the group box’ caption is aligned to the left. Alternatively, you can
position it to the center or the right by selecting the desired value in the Horizontal
Alignment combo box of the Properties window:

Horizontal Alignment: Default
Horizontal Alignment: Left

Horizontal Alignment: Center Horizontal Alignment: Right
Free download pdf