-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCResizeDialog.cpp
72 lines (55 loc) · 1.41 KB
/
CResizeDialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// CResizeDialog.cpp: 实现文件
//
#include "pch.h"
#include "BmpView.h"
#include "afxdialogex.h"
#include "CResizeDialog.h"
// CResizeDialog 对话框
IMPLEMENT_DYNAMIC(CResizeDialog, CDialogEx)
CResizeDialog::CResizeDialog(CWnd* pParent /*=nullptr*/)
: CDialogEx(IDD_DIALOG1, pParent), m_lastClickedButton(0)
, m_scaleWidth(0)
, m_scaleHeight(0)
{
}
CResizeDialog::~CResizeDialog()
{
}
void CResizeDialog::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT1, m_scaleWidth);
DDX_Text(pDX, IDC_EDIT2, m_scaleHeight);
}
void CResizeDialog::OnOK()
{
UpdateData(TRUE); // 更新 m_scaleWidth 和 m_scaleHeight 的值
// 验证缩放因子是否合法
if (m_scaleWidth <= 0 || m_scaleHeight <= 0)
{
AfxMessageBox(_T("缩放因子必须大于0"));
return;
}
m_lastClickedButton = IDOK;
CDialogEx::OnOK();
}
void CResizeDialog::OnCancel()
{
CDialogEx::OnCancel();
}
void CResizeDialog::OnBilinear()
{
UpdateData(TRUE); // 更新 m_scaleWidth 和 m_scaleHeight 的值
// 验证缩放因子是否合法
if (m_scaleWidth <= 0 || m_scaleHeight <= 0)
{
AfxMessageBox(_T("缩放因子必须大于0"));
return;
}
m_lastClickedButton = ID_BILINEAR;
EndDialog(IDOK);
}
BEGIN_MESSAGE_MAP(CResizeDialog, CDialogEx)
ON_BN_CLICKED(ID_BILINEAR, &CResizeDialog::OnBilinear)
END_MESSAGE_MAP()
// CResizeDialog 消息处理程序