LAPTOP-SNT8I5JK\Boounion
2025-01-06 353400e7e6a1b68944b76ac086e626c83ce914d2
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
 
// BoounionPLCDlg.cpp : ÊµÏÖÎļþ
//
 
#include "stdafx.h"
#include "BoounionPLC.h"
#include "BoounionPLCDlg.h"
#include "afxdialogex.h"
 
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
 
 
// ÓÃÓÚÓ¦ÓóÌÐò¡°¹ØÓÚ¡±²Ëµ¥ÏîµÄ CAboutDlg ¶Ô»°¿ò
 
class CAboutDlg : public CDialogEx
{
public:
    CAboutDlg();
 
// ¶Ô»°¿òÊý¾Ý
#ifdef AFX_DESIGN_TIME
    enum { IDD = IDD_ABOUTBOX };
#endif
 
    protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV Ö§³Ö
 
// ÊµÏÖ
protected:
    DECLARE_MESSAGE_MAP()
};
 
CAboutDlg::CAboutDlg() : CDialogEx(IDD_ABOUTBOX)
{
}
 
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialogEx::DoDataExchange(pDX);
}
 
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
END_MESSAGE_MAP()
 
 
// CBoounionPLCDlg ¶Ô»°¿ò
 
 
 
CBoounionPLCDlg::CBoounionPLCDlg(CWnd* pParent /*=NULL*/)
    : CDialogEx(IDD_BOOUNIONPLC_DIALOG, pParent)
{
    m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
 
void CBoounionPLCDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialogEx::DoDataExchange(pDX);
}
 
BEGIN_MESSAGE_MAP(CBoounionPLCDlg, CDialogEx)
    ON_WM_SYSCOMMAND()
    ON_WM_PAINT()
    ON_WM_QUERYDRAGICON()
END_MESSAGE_MAP()
 
 
// CBoounionPLCDlg ÏûÏ¢´¦Àí³ÌÐò
 
BOOL CBoounionPLCDlg::OnInitDialog()
{
    CDialogEx::OnInitDialog();
 
    // ½«¡°¹ØÓÚ...¡±²Ëµ¥ÏîÌí¼Óµ½ÏµÍ³²Ëµ¥ÖС£
 
    // IDM_ABOUTBOX ±ØÐëÔÚϵͳÃüÁΧÄÚ¡£
    ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
    ASSERT(IDM_ABOUTBOX < 0xF000);
 
    CMenu* pSysMenu = GetSystemMenu(FALSE);
    if (pSysMenu != NULL)
    {
        BOOL bNameValid;
        CString strAboutMenu;
        bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
        ASSERT(bNameValid);
        if (!strAboutMenu.IsEmpty())
        {
            pSysMenu->AppendMenu(MF_SEPARATOR);
            pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
        }
    }
 
    // ÉèÖô˶Ի°¿òµÄͼ±ê¡£  µ±Ó¦ÓóÌÐòÖ÷´°¿Ú²»ÊǶԻ°¿òʱ£¬¿ò¼Ü½«×Ô¶¯
    //  Ö´Ðд˲Ù×÷
    SetIcon(m_hIcon, TRUE);            // ÉèÖôóͼ±ê
    SetIcon(m_hIcon, FALSE);        // ÉèÖÃСͼ±ê
 
    // TODO: ÔÚ´ËÌí¼Ó¶îÍâµÄ³õʼ»¯´úÂë
 
    return TRUE;  // ³ý·Ç½«½¹µãÉèÖõ½¿Ø¼þ£¬·ñÔò·µ»Ø TRUE
}
 
void CBoounionPLCDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
    if ((nID & 0xFFF0) == IDM_ABOUTBOX)
    {
        CAboutDlg dlgAbout;
        dlgAbout.DoModal();
    }
    else
    {
        CDialogEx::OnSysCommand(nID, lParam);
    }
}
 
// Èç¹ûÏò¶Ô»°¿òÌí¼Ó×îС»¯°´Å¥£¬ÔòÐèÒªÏÂÃæµÄ´úÂë
//  À´»æÖƸÃͼ±ê¡£  ¶ÔÓÚʹÓÃÎĵµ/ÊÓͼģÐ͵ĠMFC Ó¦ÓóÌÐò£¬
//  Õ⽫ÓÉ¿ò¼Ü×Ô¶¯Íê³É¡£
 
void CBoounionPLCDlg::OnPaint()
{
    if (IsIconic())
    {
        CPaintDC dc(this); // ÓÃÓÚ»æÖƵÄÉ豸ÉÏÏÂÎÄ
 
        SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
 
        // Ê¹Í¼±êÔÚ¹¤×÷Çø¾ØÐÎÖоÓÖÐ
        int cxIcon = GetSystemMetrics(SM_CXICON);
        int cyIcon = GetSystemMetrics(SM_CYICON);
        CRect rect;
        GetClientRect(&rect);
        int x = (rect.Width() - cxIcon + 1) / 2;
        int y = (rect.Height() - cyIcon + 1) / 2;
 
        // »æÖÆÍ¼±ê
        dc.DrawIcon(x, y, m_hIcon);
    }
    else
    {
        CDialogEx::OnPaint();
    }
}
 
//µ±Óû§Í϶¯×îС»¯´°¿Úʱϵͳµ÷Óô˺¯ÊýÈ¡µÃ¹â±ê
//ÏÔʾ¡£
HCURSOR CBoounionPLCDlg::OnQueryDragIcon()
{
    return static_cast<HCURSOR>(m_hIcon);
}