"// MyCustomControl.h\n#pragma once\n#include ""\n#include "afxwin.h"\n\nclass CMyCustomControl : public CWnd\n{\n DECLARE_DYNAMIC(CMyCustomControl)\n\npublic:\n CMyCustomControl();\n virtual ~CMyCustomControl();\n\n BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);\n\n void SetQuestionAndAnswers(const CString& strQuestion, const std::vector& vecAnswers);\n int GetSelectedAnswerIndex() const;\n\nprotected:\n DECLARE_MESSAGE_MAP()\n\n afx_msg void OnSize(UINT nType, int cx, int cy);\n afx_msg void OnRadioButtonClicked();\n\nprivate:\n CStatic m_lblQuestion;\n std::vector<CRadioButton*> m_vecRadioButtons;\n CString m_strQuestion;\n std::vector m_vecAnswers;\n int m_nSelectedAnswerIndex;\n};\n\n// MyCustomControl.cpp\n#include "MyCustomControl.h"\n\nIMPLEMENT_DYNAMIC(CMyCustomControl, CWnd)\n\nCMyCustomControl::CMyCustomControl()\n{\n m_nSelectedAnswerIndex = -1;\n}\n\nCMyCustomControl::~CMyCustomControl()\n{\n}\n\nBOOL CMyCustomControl::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID)\n{\n if (!CWnd::Create(NULL, _T("""), dwStyle, rect, pParentWnd, nID))\n return FALSE;\n\n CRect rcClient;\n GetClientRect(&rcClient);\n\n m_lblQuestion.Create(_T("""), WS_CHILD | WS_VISIBLE | SS_LEFT, rcClient, this, 1);\n\n int nTop = rcClient.top + 20;\n for (UINT i = 0; i < m_vecAnswers.size(); ++i)\n {\n CRadioButton* pRadioButton = new CRadioButton();\n pRadioButton->Create(m_vecAnswers[i], WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,\n CRect(rcClient.left, nTop, rcClient.right, nTop + 20), this, i + 2);\n m_vecRadioButtons.push_back(pRadioButton);\n nTop += 25;\n }\n\n return TRUE;\n}\n\nvoid CMyCustomControl::SetQuestionAndAnswers(const CString& strQuestion, const std::vector& vecAnswers)\n{\n m_strQuestion = strQuestion;\n m_vecAnswers = vecAnswers;\n\n m_lblQuestion.SetWindowText(m_strQuestion);\n\n for (UINT i = 0; i < m_vecRadioButtons.size(); ++i)\n {\n CRadioButton* pRadioButton = m_vecRadioButtons[i];\n if (i < m_vecAnswers.size())\n {\n pRadioButton->SetWindowText(m_vecAnswers[i]);\n pRadioButton->ShowWindow(SW_SHOW);\n }\n else\n {\n pRadioButton->ShowWindow(SW_HIDE);\n }\n }\n\n m_nSelectedAnswerIndex = -1;\n}\n\nint CMyCustomControl::GetSelectedAnswerIndex() const\n{\n return m_nSelectedAnswerIndex;\n}\n\nBEGIN_MESSAGE_MAP(CMyCustomControl, CWnd)\n ON_WM_SIZE()\n ON_CONTROL_RANGE(BN_CLICKED, 2, 5, &CMyCustomControl::OnRadioButtonClicked)\nEND_MESSAGE_MAP()\n\nvoid CMyCustomControl::OnSize(UINT nType, int cx, int cy)\n{\n CWnd::OnSize(nType, cx, cy);\n\n CRect rcClient;\n GetClientRect(&rcClient);\n\n m_lblQuestion.SetWindowPos(NULL, rcClient.left, rcClient.top, rcClient.Width(), 20, SWP_NOZORDER);\n\n int nTop = rcClient.top + 20;\n for (UINT i = 0; i < m_vecRadioButtons.size(); ++i)\n {\n CRadioButton* pRadioButton = m_vecRadioButtons[i];\n pRadioButton->SetWindowPos(NULL, rcClient.left, nTop, rcClient.Width(), 20, SWP_NOZORDER);\n nTop += 25;\n }\n}\n\nvoid CMyCustomControl::OnRadioButtonClicked()\n{\n for (UINT i = 0; i < m_vecRadioButtons.size(); ++i)\n {\n if (m_vecRadioButtons[i]->GetCheck())\n {\n m_nSelectedAnswerIndex = i;\n break;\n }\n }\n}\n"