QuakeGod
2023-09-05 df03213660361b1c771f0a3f21b6ddaeaef7763a
提交 | 用户 | age
418cb3 1 // CDialogProgress.cpp: 实现文件
Q 2 //
3
4 #include "pch.h"
5 #include "MTerm1.h"
6 #include "DialogProgress.h"
7 #include "afxdialogex.h"
8
9
10 // CDialogProgress 对话框
11
12 IMPLEMENT_DYNAMIC(CDialogProgress, CDialogEx)
13
14 CDialogProgress::CDialogProgress(CWnd* pParent /*=nullptr*/)
15     : CDialogEx(IDD_DIALOG_PROGRESS, pParent)
16 {
17
18 }
19
20 CDialogProgress::~CDialogProgress()
21 {
22 }
23
24 void CDialogProgress::DoDataExchange(CDataExchange* pDX)
25 {
26     CDialogEx::DoDataExchange(pDX);
27     DDX_Control(pDX, IDC_PROGRESS1, m_progress1);
28 }
29
30
31 BEGIN_MESSAGE_MAP(CDialogProgress, CDialogEx)
32     ON_WM_TIMER()
33 END_MESSAGE_MAP()
34
35
36 // CDialogProgress 消息处理程序
37
38
39 BOOL CDialogProgress::OnInitDialog()
40 {
41     CDialogEx::OnInitDialog();
42
43     // TODO:  在此添加额外的初始化
44     this->SetWindowText(m_TitleStr);
45     GetDlgItem(IDC_STATIC_HINT)->SetWindowText(m_HintStr);
46     m_progress1.SetRange(0, 100);
47 //    m_progress1.SetRange32(0, 99);
48     SetTimer(1, 100, NULL);
49     return TRUE;  // return TRUE unless you set the focus to a control
50                   // 异常: OCX 属性页应返回 FALSE
51 }
52
53
54 void CDialogProgress::OnTimer(UINT_PTR nIDEvent)
55 {
56     // TODO: 在此添加消息处理程序代码和/或调用默认值
57     if (nIDEvent == 0){
58
59     }
60     else if (nIDEvent == 1)    {
61         if (m_bAutoPos)
62         {
63             m_nPreogress++;
64         }
65     //    m_progress1.SetPos(m_nPreogress);
66         //if (m_nPreogress == 100) {
67         //    this->OnCancel();
68         //}
69     }
70     CDialogEx::OnTimer(nIDEvent);
71 }
72
73
74 int CDialogProgress::SetPos(int nPos)
75 {
76     // TODO: 在此处添加实现代码.
77     m_nPreogress = nPos;
78     m_progress1.SetPos(nPos);
79     return 0;
80 }
81
82
83 int CDialogProgress::SetTitle(CString sTitleStr)
84 {
85     // TODO: 在此处添加实现代码.
86     m_TitleStr = sTitleStr;
87     this->SetWindowText(m_TitleStr);
88     return 0;
89 }
90
91 int CDialogProgress::SetHintStr(CString sHintStr)
92 {
93     // TODO: 在此处添加实现代码.
94     m_HintStr = sHintStr;
95     GetDlgItem(IDC_STATIC_HINT)->SetWindowText(m_HintStr);
96     return 0;
97 }