From 60e4e45bee9bb45c20dd2d25631efaca69980c20 Mon Sep 17 00:00:00 2001
From: LAPTOP-T815PCOQ\25526 <mr.liuyang@126.com>
Date: 星期四, 14 十一月 2024 17:44:12 +0800
Subject: [PATCH] 1. 添加Axis设定界面

---
 SourceCode/Bond/BondEq/AxisSettingsDlg.cpp         |  242 ++++++++++++++++++++++++++++++++++++++++
 SourceCode/Bond/BondEq/Resource.h                  |    0 
 SourceCode/Bond/BondEq/AxisSettingsDlg.h           |   51 ++++++++
 SourceCode/Bond/BondEq/BondEq.rc                   |    0 
 SourceCode/Bond/BLControlsSDK/include/BLControls.h |   37 ++++++
 SourceCode/Bond/BondEq/BondEqDlg.cpp               |    6 +
 SourceCode/Bond/BondEq/BondEq.vcxproj              |    2 
 7 files changed, 338 insertions(+), 0 deletions(-)

diff --git a/SourceCode/Bond/BLControlsSDK/include/BLControls.h b/SourceCode/Bond/BLControlsSDK/include/BLControls.h
new file mode 100644
index 0000000..933e9cb
--- /dev/null
+++ b/SourceCode/Bond/BLControlsSDK/include/BLControls.h
@@ -0,0 +1,37 @@
+#if !defined(AFX_BLCONTROLS_H__16C6D980_BD45_11D3_BDA3_00104B133581__INCLUDED_)
+#define AFX_BLCONTROLS_H__16C6D980_BD45_11D3_BDA3_00104B133581__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// BLControls.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CBLControls window
+#include "BLButton.h"
+#include "BLFolderScheduling.h"
+#include "BLJogBtn2Parent.h"
+#include "BLJogButton.h"
+#include "BLLabel.h"
+#include "BLListBoxLog.h"
+#include "BLListCtrlExt.h"
+#include "CellCtrl.h"
+#include "ColorButton.h"
+#include "FontStatic.h"
+#include "GradientStatic.h"
+#include "HeadCtrl.h"
+#include "InPlaceComboBox.h"
+#include "InPlaceEdit.h"
+#include "LogCtrl.h"
+#include "SortClass.h"
+#include "StaticMap.h"
+#include "WKButton.h"
+#include "XTabCtrl.h"
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_BLCONTROLS_H__16C6D980_BD45_11D3_BDA3_00104B133581__INCLUDED_)
\ No newline at end of file
diff --git a/SourceCode/Bond/BondEq/AxisSettingsDlg.cpp b/SourceCode/Bond/BondEq/AxisSettingsDlg.cpp
new file mode 100644
index 0000000..9bd1482
--- /dev/null
+++ b/SourceCode/Bond/BondEq/AxisSettingsDlg.cpp
@@ -0,0 +1,242 @@
+锘�// AxisSettingsDlg.cpp: 瀹炵幇鏂囦欢
+//
+
+#include "stdafx.h"
+#include "BondEq.h"
+#include "afxdialogex.h"
+#include "AxisSettingsDlg.h"
+
+
+// CAxisSettingsDlg 瀵硅瘽妗�
+
+IMPLEMENT_DYNAMIC(CAxisSettingsDlg, CDialogEx)
+
+CAxisSettingsDlg::CAxisSettingsDlg(CWnd* pParent /*=nullptr*/)
+	: CDialogEx(IDD_DIALOG_AXIS_SETTINGS, pParent)
+{
+	m_nInitialWidth = 0;
+	m_nInitialHeight = 0;
+}
+
+CAxisSettingsDlg::~CAxisSettingsDlg()
+{
+}
+
+void CAxisSettingsDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CAxisSettingsDlg, CDialogEx)
+	ON_BN_CLICKED(IDC_BUTTON_AXIS_LAST, &CAxisSettingsDlg::OnBnClickedButtonAxisLast)
+	ON_BN_CLICKED(IDC_BUTTON_AXIS_NEXT, &CAxisSettingsDlg::OnBnClickedButtonAxisNext)
+	ON_BN_CLICKED(IDC_BUTTON_AXIS_ANCHOR_POINT_GROUP1, &CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPointGroup1)
+	ON_BN_CLICKED(IDC_BUTTON_AXIS_ANCHOR_POINT_GROUP2, &CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPointGroup2)
+	ON_BN_CLICKED(IDC_BUTTON_AXIS_ANCHOR_POINT_GROUP3, &CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPointGroup3)
+	ON_BN_CLICKED(IDC_BUTTON_AXIS_ANCHOR_POINT_GROUP4, &CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPointGroup4)
+	ON_BN_CLICKED(IDC_BUTTON_AXIS_ANCHOR_POINT_GROUP5, &CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPointGroup5)
+	ON_BN_CLICKED(IDC_BUTTON_AXIS_ANCHOR_POINT1, &CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPoint1)
+	ON_BN_CLICKED(IDC_BUTTON_AXIS_ANCHOR_POINT2, &CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPoint2)
+	ON_BN_CLICKED(IDC_BUTTON_AXIS_ANCHOR_POINT3, &CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPoint3)
+	ON_BN_CLICKED(IDC_BUTTON_AXIS_ANCHOR_POINT4, &CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPoint4)
+	ON_BN_CLICKED(IDC_BUTTON_AXIS_ANCHOR_POINT5, &CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPoint5)
+	ON_BN_CLICKED(IDC_BUTTON_AXIS_TEST_OPR, &CAxisSettingsDlg::OnBnClickedButtonAxisTestOpr)
+	ON_BN_CLICKED(IDC_BUTTON_AXIS_TEST_JOG_ADD, &CAxisSettingsDlg::OnBnClickedButtonAxisTestJogAdd)
+	ON_BN_CLICKED(IDC_BUTTON_AXIS_TEST_JOG_SUB, &CAxisSettingsDlg::OnBnClickedButtonAxisTestJogSub)
+	ON_BN_CLICKED(IDC_BUTTON_AXIS_TEST_STOP, &CAxisSettingsDlg::OnBnClickedButtonAxisTestStop)
+	ON_WM_SIZE()
+	ON_WM_CTLCOLOR()
+	ON_WM_SIZING()
+END_MESSAGE_MAP()
+
+
+// CAxisSettingsDlg 娑堟伅澶勭悊绋嬪簭
+
+
+BOOL CAxisSettingsDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// TODO:  鍦ㄦ娣诲姞棰濆鐨勫垵濮嬪寲
+	//ModifyStyle(0, WS_THICKFRAME | WS_SIZEBOX);
+
+	CRect rect;
+	GetClientRect(&rect);
+	m_nInitialWidth = rect.Width();
+	m_nInitialHeight = rect.Height();
+
+	rect.right *= 1.5;
+	rect.bottom *= 1.5;
+	// 璋冩暣瀵硅瘽妗嗗ぇ灏�
+	MoveWindow(rect);
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+	// 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
+}
+
+void CAxisSettingsDlg::OnSize(UINT nType, int cx, int cy)
+{
+	CDialogEx::OnSize(nType, cx, cy);
+
+	// TODO: 鍦ㄦ澶勬坊鍔犳秷鎭鐞嗙▼搴忎唬鐮�
+	CRect rect;
+	GetClientRect(&rect);
+
+	// 閬嶅巻瀵硅瘽妗嗕腑鐨勬墍鏈夋帶浠�
+	AdjustControls(rect.Width(), rect.Height());
+}
+
+void CAxisSettingsDlg::OnSizing(UINT fwSide, LPRECT pRect)
+{
+	if (fwSide == WMSZ_BOTTOMRIGHT) {
+		if (pRect->right - pRect->left < 200) {
+			pRect->right = pRect->left + 200;
+		}
+		if (pRect->bottom - pRect->top < 150) {
+			pRect->bottom = pRect->top + 150;
+		}
+	}
+
+	CDialogEx::OnSizing(fwSide, pRect);
+}
+
+HBRUSH CAxisSettingsDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
+{
+	HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);
+
+	// TODO:  鍦ㄦ鏇存敼 DC 鐨勪换浣曠壒鎬�
+
+	// TODO:  濡傛灉榛樿鐨勪笉鏄墍闇�鐢荤瑪锛屽垯杩斿洖鍙︿竴涓敾绗�
+	return hbr;
+}
+
+void CAxisSettingsDlg::OnBnClickedButtonAxisLast()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+}
+
+void CAxisSettingsDlg::OnBnClickedButtonAxisNext()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+}
+
+void CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPointGroup1()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+}
+
+void CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPointGroup2()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+}
+
+void CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPointGroup3()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+}
+
+void CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPointGroup4()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+}
+
+void CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPointGroup5()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+}
+
+void CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPoint1()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+}
+
+void CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPoint2()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+}
+
+void CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPoint3()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+}
+
+void CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPoint4()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+}
+
+void CAxisSettingsDlg::OnBnClickedButtonAxisAnchorPoint5()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+}
+
+void CAxisSettingsDlg::OnBnClickedButtonAxisTestOpr()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+}
+
+void CAxisSettingsDlg::OnBnClickedButtonAxisTestJogAdd()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+}
+
+void CAxisSettingsDlg::OnBnClickedButtonAxisTestJogSub()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+}
+
+void CAxisSettingsDlg::OnBnClickedButtonAxisTestStop()
+{
+	// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
+}
+
+void CAxisSettingsDlg::AdjustControls(int nWidth, int nHeight)
+{
+	CWnd* pWnd = GetWindow(GW_CHILD);
+	while (pWnd) {
+		UINT nCtrlID = pWnd->GetDlgCtrlID();
+
+		CRect ctrlRect;
+		pWnd->GetWindowRect(&ctrlRect);
+		ScreenToClient(&ctrlRect);
+
+		// 璁$畻鎺т欢鐨勬柊浣嶇疆鍜屽ぇ灏忥紝鎸夋瘮渚嬭皟鏁�
+		int newX = (int)(ctrlRect.left * (nWidth / (float)m_nInitialWidth));
+		int newY = (int)(ctrlRect.top * (nHeight / (float)m_nInitialHeight));
+		int newWidth = (int)(ctrlRect.Width() * (nWidth / (float)m_nInitialWidth));
+		int newHeight = (int)(ctrlRect.Height() * (nHeight / (float)m_nInitialHeight));
+
+		pWnd->MoveWindow(newX, newY, newWidth, newHeight);
+		AdjustControlFont(pWnd, newWidth, newHeight);
+
+		if (pWnd->IsKindOf(RUNTIME_CLASS(CComboBox))) {
+			CComboBox* pComboBox = (CComboBox*)pWnd;
+			pComboBox->SetItemHeight(-1, newHeight);  // -1 琛ㄧず鎵�鏈夐」鐨勯珮搴�
+		}
+
+		if (pWnd->IsKindOf(RUNTIME_CLASS(CStatic))) {
+			CStatic* pStatic = (CStatic*)pWnd;
+			pStatic->ModifyStyle(0, SS_CENTER | SS_CENTERIMAGE);
+		}
+
+		// 鑾峰彇涓嬩竴涓帶浠�
+		pWnd = pWnd->GetNextWindow();
+	}
+}
+
+void CAxisSettingsDlg::AdjustControlFont(CWnd* pWnd, int nWidth, int nHeight)
+{
+	int fontSize = nHeight - 10;
+
+	CFont* pCurrentFont = pWnd->GetFont();
+	LOGFONT logFont;
+	pCurrentFont->GetLogFont(&logFont);
+	logFont.lfHeight = -fontSize;
+
+	CFont newFont;
+	newFont.CreateFontIndirect(&logFont);
+
+	pWnd->SetFont(&newFont);
+	pWnd->Invalidate();
+}
diff --git a/SourceCode/Bond/BondEq/AxisSettingsDlg.h b/SourceCode/Bond/BondEq/AxisSettingsDlg.h
new file mode 100644
index 0000000..793b693
--- /dev/null
+++ b/SourceCode/Bond/BondEq/AxisSettingsDlg.h
@@ -0,0 +1,51 @@
+锘�#pragma once
+#include "afxdialogex.h"
+
+
+// CAxisSettingsDlg 瀵硅瘽妗�
+
+class CAxisSettingsDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CAxisSettingsDlg)
+
+public:
+	CAxisSettingsDlg(CWnd* pParent = nullptr);   // 鏍囧噯鏋勯�犲嚱鏁�
+	virtual ~CAxisSettingsDlg();
+
+// 瀵硅瘽妗嗘暟鎹�
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_AXIS_SETTINGS };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 鏀寔
+	virtual BOOL OnInitDialog();
+	afx_msg void OnSize(UINT nType, int cx, int cy);
+	afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
+	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
+	afx_msg void OnBnClickedButtonAxisLast();
+	afx_msg void OnBnClickedButtonAxisNext();
+	afx_msg void OnBnClickedButtonAxisAnchorPointGroup1();
+	afx_msg void OnBnClickedButtonAxisAnchorPointGroup2();
+	afx_msg void OnBnClickedButtonAxisAnchorPointGroup3();
+	afx_msg void OnBnClickedButtonAxisAnchorPointGroup4();
+	afx_msg void OnBnClickedButtonAxisAnchorPointGroup5();
+	afx_msg void OnBnClickedButtonAxisAnchorPoint1();
+	afx_msg void OnBnClickedButtonAxisAnchorPoint2();
+	afx_msg void OnBnClickedButtonAxisAnchorPoint3();
+	afx_msg void OnBnClickedButtonAxisAnchorPoint4();
+	afx_msg void OnBnClickedButtonAxisAnchorPoint5();
+	afx_msg void OnBnClickedButtonAxisTestOpr();
+	afx_msg void OnBnClickedButtonAxisTestJogAdd();
+	afx_msg void OnBnClickedButtonAxisTestJogSub();
+	afx_msg void OnBnClickedButtonAxisTestStop();
+	DECLARE_MESSAGE_MAP()
+
+private:
+	void AdjustControls(int nWidth, int nHeight);
+	void AdjustControlFont(CWnd* pWnd, int nWidth, int nHeight);
+
+private:
+	int m_nInitialWidth;
+	int m_nInitialHeight;
+};
diff --git a/SourceCode/Bond/BondEq/BondEq.rc b/SourceCode/Bond/BondEq/BondEq.rc
index ca272da..85188b8 100644
--- a/SourceCode/Bond/BondEq/BondEq.rc
+++ b/SourceCode/Bond/BondEq/BondEq.rc
Binary files differ
diff --git a/SourceCode/Bond/BondEq/BondEq.vcxproj b/SourceCode/Bond/BondEq/BondEq.vcxproj
index 9f72b98..9b0e384 100644
--- a/SourceCode/Bond/BondEq/BondEq.vcxproj
+++ b/SourceCode/Bond/BondEq/BondEq.vcxproj
@@ -192,6 +192,7 @@
   <ItemGroup>
     <ClInclude Include="AccordionWnd.h" />
     <ClInclude Include="ApredTreeCtrl.h" />
+    <ClInclude Include="AxisSettingsDlg.h" />
     <ClInclude Include="BaseSetPage.h" />
     <ClInclude Include="BlButton.h" />
     <ClInclude Include="BondEq.h" />
@@ -230,6 +231,7 @@
   <ItemGroup>
     <ClCompile Include="AccordionWnd.cpp" />
     <ClCompile Include="ApredTreeCtrl.cpp" />
+    <ClCompile Include="AxisSettingsDlg.cpp" />
     <ClCompile Include="BaseSetPage.cpp" />
     <ClCompile Include="BlButton.cpp" />
     <ClCompile Include="BondEq.cpp" />
diff --git a/SourceCode/Bond/BondEq/BondEqDlg.cpp b/SourceCode/Bond/BondEq/BondEqDlg.cpp
index 656307c..eb1cde7 100644
--- a/SourceCode/Bond/BondEq/BondEqDlg.cpp
+++ b/SourceCode/Bond/BondEq/BondEqDlg.cpp
@@ -12,6 +12,9 @@
 #include "UserManager.h"
 #include "LoginDlg.h"
 
+// test
+#include "AxisSettingsDlg.h"
+
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -535,6 +538,9 @@
 				userManager.logout();
 				m_pTopToolbar->SetOperatorBtnText(_T("未登录"));
 			}
+
+			CAxisSettingsDlg loginDlg;
+			loginDlg.DoModal();
 		}
 	}
 
diff --git a/SourceCode/Bond/BondEq/Resource.h b/SourceCode/Bond/BondEq/Resource.h
index f5bfc3b..7433bc4 100644
--- a/SourceCode/Bond/BondEq/Resource.h
+++ b/SourceCode/Bond/BondEq/Resource.h
Binary files differ

--
Gitblit v1.9.3