LAPTOP-SNT8I5JK\Boounion
2025-03-04 cb3d913e147acce92bfacc34dab441abb9ab8735
1.属性页面板增加关闭按钮,关闭时隐藏,默认隐藏。
已添加2个文件
已修改5个文件
42 ■■■■ 文件已修改
SourceCode/Bond/Servo/CPanelAttributes.cpp 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CPanelAttributes.h 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Servo.rc 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/ServoDlg.cpp 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/resource.h 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/x64/Debug/Res/panel_close_24_a.ico 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/x64/Debug/Res/panel_close_24_b.ico 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CPanelAttributes.cpp
@@ -37,6 +37,7 @@
    ON_WM_DESTROY()
    ON_WM_SIZE()
    ON_NOTIFY(BYVERTICALLINE_MOVEX, IDC_LINE1, &CPanelAttributes::OnVLineMoveX)
    ON_BN_CLICKED(IDC_BUTTON_CLOSE, &CPanelAttributes::OnBnClickedButtonClose)
END_MESSAGE_MAP()
@@ -62,11 +63,10 @@
    for (unsigned int i = 0; i < nSize; i++) {
        SERVO::CAttribute* pAttribute = attrubutes.getAttribute(i);
        CMFCPropertyGridProperty* pProp1 = new CMFCPropertyGridProperty(
        m_gridCtrl.AddProperty(new CMFCPropertyGridProperty(
            pAttribute->getName().c_str(),
            pAttribute->getValue().c_str(),
            pAttribute->getDescription().c_str());
        m_gridCtrl.AddProperty(pProp1);
            pAttribute->getDescription().c_str()));
    }
}
@@ -74,6 +74,19 @@
{
    CDialogEx::OnInitDialog();
    // 关闭按钮
    CString strIcon1;
    strIcon1.Format(_T("%s\\Res\\panel_close_24_b.ico"), theApp.m_strAppDir);
    HICON hIcon1 = (HICON)::LoadImage(AfxGetInstanceHandle(),
        strIcon1, IMAGE_ICON, 24, 24,
        LR_LOADFROMFILE | LR_DEFAULTCOLOR | LR_CREATEDIBSECTION | LR_DEFAULTSIZE);
    m_btnClose.SubclassDlgItem(IDC_BUTTON_CLOSE, this);
    m_btnClose.SetIcon(hIcon1, hIcon1, 24);
    m_btnClose.SetFaceColor(m_crBkgnd);
    m_btnClose.SetFrameColor(m_crBkgnd);
    m_btnClose.SetFrameColor(BS_HOVER, RGB(218, 218, 218));
    m_btnClose.SetFrameColor(BS_PRESS, RGB(168, 168, 168));
    CVerticalLine* pLine1 = CVerticalLine::Hook(GetDlgItem(IDC_LINE1)->GetSafeHwnd());
    pLine1->SetBkgndColor(RGB(225, 225, 225));
@@ -137,6 +150,10 @@
    pItem = GetDlgItem(IDC_LABEL_TITLE);
    pItem->GetWindowRect(&rcItem);
    pItem->MoveWindow(5, y, rcClient.Width() - 8, rcItem.Height());
    pItem = GetDlgItem(IDC_BUTTON_CLOSE);
    pItem->GetWindowRect(&rcItem);
    pItem->MoveWindow(rcClient.right - 6 - rcItem.Width(), y, rcItem.Width(), rcItem.Height());
    y += rcItem.Height();
    y += 3;
@@ -163,3 +180,9 @@
    *result = 0;
}
void CPanelAttributes::OnBnClickedButtonClose()
{
    ShowWindow(SW_HIDE);
    GetParent()->SendMessage(ID_MSG_PANEL_RESIZE, m_nPanelWidth, 0);
}
SourceCode/Bond/Servo/CPanelAttributes.h
@@ -1,4 +1,6 @@
#pragma once
#include "BlButton.h"
// CPanelAttributes 对话框
@@ -18,7 +20,7 @@
    HBRUSH m_hbrBkgnd;
    int m_nPanelWidth;
    CMFCPropertyGridCtrl m_gridCtrl;
    CBlButton m_btnClose;
// 对话框数据
#ifdef AFX_DESIGN_TIME
@@ -35,4 +37,5 @@
    afx_msg void OnDestroy();
    afx_msg void OnSize(UINT nType, int cx, int cy);
    afx_msg void OnVLineMoveX(NMHDR* nmhdr, LRESULT* result);
    afx_msg void OnBnClickedButtonClose();
};
SourceCode/Bond/Servo/Servo.rc
Binary files differ
SourceCode/Bond/Servo/ServoDlg.cpp
@@ -173,6 +173,10 @@
                    ASSERT(pStep);
                    ASSERT(m_pPanelAttributes);
                    m_pPanelAttributes->loadDataFromStep(pStep);
                    if (!m_pPanelAttributes->IsWindowVisible()) {
                        m_pPanelAttributes->ShowWindow(SW_SHOW);
                        Resize();
                    }
                }
            }
@@ -316,7 +320,7 @@
    m_pPanelMaster->ShowWindow(SW_SHOW);
    m_pPanelAttributes = new CPanelAttributes();
    m_pPanelAttributes->Create(IDD_PANEL_ATTRIBUTES, this);
    m_pPanelAttributes->ShowWindow(SW_SHOW);
    // m_pPanelAttributes->ShowWindow(SW_SHOW);
@@ -782,7 +786,7 @@
        x += nPanelWidth;
    }
    if (m_pPanelAttributes != nullptr) {
    if (m_pPanelAttributes != nullptr && m_pPanelAttributes->IsWindowVisible()) {
        nPanelWidth = m_pPanelAttributes->getPanelWidth();
        m_pPanelAttributes->MoveWindow(x, y, nPanelWidth, rcClient.Height());
        x += nPanelWidth;
SourceCode/Bond/Servo/resource.h
Binary files differ
SourceCode/Bond/x64/Debug/Res/panel_close_24_a.ico
SourceCode/Bond/x64/Debug/Res/panel_close_24_b.ico