From e8a27bb203fe2aff70390a5eca002d7438da9b0f Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期三, 22 十月 2025 14:24:34 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang
---
SourceCode/Bond/Servo/CCjPageBase.cpp | 137 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 137 insertions(+), 0 deletions(-)
diff --git a/SourceCode/Bond/Servo/CCjPageBase.cpp b/SourceCode/Bond/Servo/CCjPageBase.cpp
new file mode 100644
index 0000000..d7c0391
--- /dev/null
+++ b/SourceCode/Bond/Servo/CCjPageBase.cpp
@@ -0,0 +1,137 @@
+锘�// CPjPage1.cpp: 瀹炵幇鏂囦欢
+//
+
+#include "stdafx.h"
+#include "Servo.h"
+#include "CCjPageBase.h"
+#include "afxdialogex.h"
+
+
+// CPjPage1 瀵硅瘽妗�
+
+IMPLEMENT_DYNAMIC(CCjPageBase, CDialogEx)
+
+CCjPageBase::CCjPageBase(UINT nID, CWnd* pPage) : CDialogEx(nID, pPage)
+{
+ m_crBkgnd = RGB(255, 255, 255);
+ m_crBkgndCached = CLR_INVALID;
+ m_onContentChanged = nullptr;
+ m_bContentChangedLock = FALSE;
+ m_pContext = nullptr;
+ m_nContextType = 0;
+}
+
+CCjPageBase::~CCjPageBase()
+{
+}
+
+void CCjPageBase::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CCjPageBase, CDialogEx)
+ ON_WM_CTLCOLOR()
+ ON_WM_SIZE()
+END_MESSAGE_MAP()
+
+
+// CPjPage1 娑堟伅澶勭悊绋嬪簭
+
+void CCjPageBase::SetTitle(CString strTitle)
+{
+ SetDlgItemText(IDC_LABEL_TITLE, strTitle);
+}
+
+void CCjPageBase::SetContext(void* pContext, int type)
+{
+ m_pContext = pContext;
+ m_nContextType = type;
+ OnSetContext(pContext);
+}
+
+void* CCjPageBase::GetContext()
+{
+ return m_pContext;
+}
+
+void CCjPageBase::SetOnContentChanged(ONCONTENTCHANGED onContentChanged)
+{
+ m_onContentChanged = onContentChanged;
+}
+
+BOOL CCjPageBase::OnInitDialog()
+{
+ CDialogEx::OnInitDialog();
+ Resize();
+
+
+ m_labelTitle.SubclassDlgItem(IDC_LABEL_TITLE, this);
+ m_labelTitle.Setpadding(PADDING_LEFT, 0);
+ m_labelTitle.Setpadding(PADDING_RIGHT, 0);
+
+ ;
+ return TRUE; // return TRUE unless you set the focus to a control
+ // 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
+}
+
+
+HBRUSH CCjPageBase::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
+{
+ HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);
+
+ // 鎯崇粰鍝簺鎺т欢鏀瑰簳鑹插氨鎶婂畠浠殑绫诲瀷鍐欒繘鏉ワ細
+ const bool needCustomBg =
+ (nCtlColor == CTLCOLOR_STATIC) ||
+ (nCtlColor == CTLCOLOR_DLG) || // 瀵硅瘽妗嗗簳鑹�
+ (nCtlColor == CTLCOLOR_BTN); // 鎸夐挳锛堝彲閫夛級
+
+ if (needCustomBg)
+ {
+ // 鑻ョ涓�娆″垱寤猴紝鎴栭鑹叉敼鍙樺垯閲嶅缓
+ if (m_brBkgnd.GetSafeHandle() == nullptr || m_crBkgndCached != m_crBkgnd)
+ {
+ if (m_brBkgnd.GetSafeHandle())
+ m_brBkgnd.DeleteObject();
+
+ m_brBkgnd.CreateSolidBrush(m_crBkgnd);
+ m_crBkgndCached = m_crBkgnd;
+ }
+
+ // 鏂囨湰鍓嶆櫙/鑳屾櫙璁剧疆锛堜粎褰卞搷鏂囨湰缁樺埗锛�
+ pDC->SetBkColor(m_crBkgnd);
+ pDC->SetTextColor(RGB(0, 0, 0));
+ // 濡傞渶璁╅潤鎬佹枃鏈�忔槑鍙犲湪搴曡壊涓婏紝鍙敤锛�
+ // pDC->SetBkMode(TRANSPARENT);
+
+ return (HBRUSH)m_brBkgnd; // 瀹夊叏鐨勯殣寮忚浆鎹�
+ }
+
+ // 鍏朵粬鎺т欢绫诲瀷娌跨敤鍩虹被榛樿鐨勫埛瀛�
+ return hbr;
+}
+
+void CCjPageBase::OnSize(UINT nType, int cx, int cy)
+{
+ CDialogEx::OnSize(nType, cx, cy);
+ if (GetDlgItem(IDC_LABEL_TITLE) == nullptr) return;
+ Resize();
+}
+
+void CCjPageBase::Resize()
+{
+ CWnd* pItem;
+ CRect rcClient, rcItem;
+ GetClientRect(&rcClient);
+ pItem = GetDlgItem(IDC_LABEL_TITLE);
+ pItem->GetWindowRect(&rcItem);
+ pItem->MoveWindow(12, 8, rcClient.Width() - 24, rcItem.Height());
+}
+
+void CCjPageBase::ContentChanged(int code)
+{
+ if (!m_bContentChangedLock && m_onContentChanged != nullptr) {
+ m_onContentChanged(this, code, m_pContext, m_nContextType);
+ }
+}
\ No newline at end of file
--
Gitblit v1.9.3