科目:
程式設計 |
學號: | 考試日期 | 2024.6.14 |
期末考 | 姓名: |
考試時間 | 08:10-11:00 |
1 | 2 | ||
3 | 4 | |
|
5 | |
6 | |
7 | 8 | |
|
9 | |
10 | |
void CMenuView::OnLineWidth()
{
CLineWidthDialog DialogWindow;
DialogWindow.m_DialogWidth = m_Width;
if (DialogWindow.DoModal() == IDOK) {
m_Width = DialogWindow.m_DialogWidth;
m_SolidPen.DeleteObject();
m_SolidPen.CreatePen(PS_SOLID, m_Width, m_Color);
CMenuDoc* pDoc = GetDocument();
pDoc->UpdateAllViews(NULL);
}
}
If we omit the statement to initialize the data member m_DialogWidth
before we activate the dialog, how will the program behave
differently? Can we still draw lines with different widths?
void CMenuDrawView::OnLineWidth()
if (DialogWindow.DoModal() == IDOK) {
{
CLineWidthDialog DialogWindow;
// DialogWindow.m_DialogWidth = m_Width;
m_Width = DialogWindow.m_DialogWidth;
m_SolidPen.DeleteObject();
m_SolidPen.CreatePen(PS_SOLID, m_Width, m_Color);
CMenuDrawDoc* pDoc = GetDocument();
pDoc->UpdateAllViews(NULL);
}
}