-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65a17fa
commit ec686a7
Showing
17 changed files
with
333 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -286,3 +286,4 @@ __pycache__/ | |
*.btm.cs | ||
*.odx.cs | ||
*.xsd.cs | ||
*.diagsession |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// MainWndColorDlg.cpp : 实现文件 | ||
// | ||
|
||
#include "stdafx.h" | ||
#include "Resource.h" | ||
#include "MainWndColorDlg.h" | ||
#include "afxdialogex.h" | ||
|
||
|
||
// CMainWndColorDlg 对话框 | ||
|
||
IMPLEMENT_DYNAMIC(CMainWndColorDlg, CDialog) | ||
|
||
CMainWndColorDlg::CMainWndColorDlg(COLORREF colors[MAIN_WND_COLOR_NUM], CWnd* pParent /*=NULL*/) | ||
: CDialog(IDD_MAIN_COLOR_DIALOG, pParent) | ||
{ | ||
for (int i{}; i < MAIN_WND_COLOR_NUM; i++) | ||
m_colors[i] = colors[i]; | ||
} | ||
|
||
CMainWndColorDlg::~CMainWndColorDlg() | ||
{ | ||
} | ||
|
||
void CMainWndColorDlg::DoDataExchange(CDataExchange* pDX) | ||
{ | ||
CDialog::DoDataExchange(pDX); | ||
DDX_Control(pDX, IDC_UP_STATIC, m_statics[0]); | ||
DDX_Control(pDX, IDC_DOWN_STATIC, m_statics[1]); | ||
DDX_Control(pDX, IDC_CPU_STATIC, m_statics[2]); | ||
DDX_Control(pDX, IDC_MEMORY_STATIC, m_statics[3]); | ||
} | ||
|
||
|
||
BEGIN_MESSAGE_MAP(CMainWndColorDlg, CDialog) | ||
ON_MESSAGE(WM_STATIC_CLICKED, &CMainWndColorDlg::OnStaticClicked) | ||
END_MESSAGE_MAP() | ||
|
||
|
||
// CMainWndColorDlg 消息处理程序 | ||
|
||
|
||
BOOL CMainWndColorDlg::OnInitDialog() | ||
{ | ||
CDialog::OnInitDialog(); | ||
|
||
// TODO: 在此添加额外的初始化 | ||
for (int i{}; i < MAIN_WND_COLOR_NUM; i++) | ||
{ | ||
m_statics[i].SetFillColor(m_colors[i]); | ||
m_statics[i].SetLinkCursor(); | ||
} | ||
|
||
return TRUE; // return TRUE unless you set the focus to a control | ||
// 异常: OCX 属性页应返回 FALSE | ||
} | ||
|
||
|
||
afx_msg LRESULT CMainWndColorDlg::OnStaticClicked(WPARAM wParam, LPARAM lParam) | ||
{ | ||
int item_id = ::GetDlgCtrlID(((CWnd*)wParam)->m_hWnd); | ||
int index{}; | ||
switch (item_id) | ||
{ | ||
case IDC_UP_STATIC: | ||
index = 0; | ||
break; | ||
case IDC_DOWN_STATIC: | ||
index = 1; | ||
break; | ||
case IDC_CPU_STATIC: | ||
index = 2; | ||
break; | ||
case IDC_MEMORY_STATIC: | ||
index = 3; | ||
break; | ||
default: | ||
return 0; | ||
} | ||
CColorDialog colorDlg(m_colors[index], 0, this); | ||
if (colorDlg.DoModal() == IDOK) | ||
{ | ||
m_colors[index] = colorDlg.GetColor(); | ||
m_statics[index].SetFillColor(m_colors[index]); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#pragma once | ||
#include "ColorStatic.h" | ||
#include "afxwin.h" | ||
|
||
// CMainWndColorDlg 对话框 | ||
|
||
class CMainWndColorDlg : public CDialog | ||
{ | ||
DECLARE_DYNAMIC(CMainWndColorDlg) | ||
|
||
public: | ||
CMainWndColorDlg(COLORREF colors[MAIN_WND_COLOR_NUM], CWnd* pParent = NULL); // 标准构造函数 | ||
virtual ~CMainWndColorDlg(); | ||
|
||
const COLORREF* GetColors() const { return m_colors; } | ||
|
||
// 对话框数据 | ||
#ifdef AFX_DESIGN_TIME | ||
enum { IDD = IDD_MAIN_COLOR_DIALOG }; | ||
#endif | ||
protected: | ||
COLORREF m_colors[MAIN_WND_COLOR_NUM]; | ||
|
||
//控件变量 | ||
CColorStatic m_statics[MAIN_WND_COLOR_NUM]; //颜色控件 | ||
|
||
protected: | ||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 | ||
|
||
DECLARE_MESSAGE_MAP() | ||
public: | ||
virtual BOOL OnInitDialog(); | ||
protected: | ||
afx_msg LRESULT OnStaticClicked(WPARAM wParam, LPARAM lParam); | ||
}; |
Oops, something went wrong.