From 656228d05e6fa5200ae41621d2250de210d95600 Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期二, 03 二月 2026 15:34:43 +0800
Subject: [PATCH] 1.Slot小方块大小用两种配置,LoadPort和其它的分开
---
SourceCode/Bond/x64/Debug/Res/Servo001.bmp | 0
SourceCode/Bond/Servo/ServoGraph.cpp | 24 +++++++++++++++++++++++-
SourceCode/Bond/Servo/ServoGraph.h | 3 +++
SourceCode/Bond/Servo/CPageGraph1.cpp | 12 ++++++++----
4 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/SourceCode/Bond/Servo/CPageGraph1.cpp b/SourceCode/Bond/Servo/CPageGraph1.cpp
index 2427181..b2d932a 100644
--- a/SourceCode/Bond/Servo/CPageGraph1.cpp
+++ b/SourceCode/Bond/Servo/CPageGraph1.cpp
@@ -407,10 +407,14 @@
int boxSize = GetPrivateProfileIntA("Graph1", "BoxSize", 56, iniPath.c_str());
if (boxSize < 40) boxSize = 40;
if (boxSize > 80) boxSize = 80;
- int slotSize = GetPrivateProfileIntA("Graph1", "SlotSize", 6, iniPath.c_str());
- if (slotSize < 2) slotSize = 2;
- if (slotSize > 12) slotSize = 12;
- m_pGraph->SetSlotBarSize(slotSize);
+ int slotSizeDefault = GetPrivateProfileIntA("Graph1", "SlotSize", 6, iniPath.c_str());
+ int slotSize8 = GetPrivateProfileIntA("Graph1", "SlotSize8", slotSizeDefault, iniPath.c_str());
+ int slotSizeOther = GetPrivateProfileIntA("Graph1", "SlotSizeOther", slotSizeDefault, iniPath.c_str());
+ if (slotSize8 < 2) slotSize8 = 2;
+ if (slotSize8 > 12) slotSize8 = 12;
+ if (slotSizeOther < 2) slotSizeOther = 2;
+ if (slotSizeOther > 12) slotSizeOther = 12;
+ m_pGraph->SetSlotBarSizeByCount(slotSize8, slotSizeOther);
int armBoxSize = GetPrivateProfileIntA("Graph1", "ArmBoxSize", boxSize, iniPath.c_str());
if (armBoxSize < 30) armBoxSize = 30;
if (armBoxSize > 80) armBoxSize = 80;
diff --git a/SourceCode/Bond/Servo/ServoGraph.cpp b/SourceCode/Bond/Servo/ServoGraph.cpp
index b14ed32..735f2c4 100644
--- a/SourceCode/Bond/Servo/ServoGraph.cpp
+++ b/SourceCode/Bond/Servo/ServoGraph.cpp
@@ -22,6 +22,8 @@
m_pHighItem = nullptr;
m_hWndTooltip = nullptr;
m_slotBarSize = 0;
+ m_slotBarSize8 = 0;
+ m_slotBarSizeOther = 0;
}
CServoGraph::~CServoGraph()
@@ -370,7 +372,18 @@
int slotSize = 4;
if (slotCount > 0) {
const int maxSize = (item.box1Width - gap * (slotCount - 1)) / slotCount;
- slotSize = (m_slotBarSize > 0) ? m_slotBarSize : maxSize;
+ if (slotCount == 8 && m_slotBarSize8 > 0) {
+ slotSize = m_slotBarSize8;
+ }
+ else if (slotCount != 8 && m_slotBarSizeOther > 0) {
+ slotSize = m_slotBarSizeOther;
+ }
+ else if (m_slotBarSize > 0) {
+ slotSize = m_slotBarSize;
+ }
+ else {
+ slotSize = maxSize;
+ }
if (slotSize < 2) slotSize = 2;
}
const int barWidth = slotCount * slotSize + gap * (slotCount - 1);
@@ -721,6 +734,15 @@
InvalidateRect(m_hWnd, nullptr, TRUE);
}
+void CServoGraph::SetSlotBarSizeByCount(int size8, int sizeOther)
+{
+ if (size8 < 0) size8 = 0;
+ if (sizeOther < 0) sizeOther = 0;
+ m_slotBarSize8 = size8;
+ m_slotBarSizeOther = sizeOther;
+ InvalidateRect(m_hWnd, nullptr, TRUE);
+}
+
void CServoGraph::DrawImage(HDC hMemDC, IMAGE& item)
{
// 载入BMP
diff --git a/SourceCode/Bond/Servo/ServoGraph.h b/SourceCode/Bond/Servo/ServoGraph.h
index 4fcc730..296aae7 100644
--- a/SourceCode/Bond/Servo/ServoGraph.h
+++ b/SourceCode/Bond/Servo/ServoGraph.h
@@ -189,6 +189,7 @@
void SetIndicateBoxSlotBarPosition(int id, SlotBarPos pos);
void SetIndicateBoxSlotColors(int id, const std::vector<COLORREF>& colors);
void SetSlotBarSize(int size);
+ void SetSlotBarSizeByCount(int size8, int sizeOther);
private:
void DrawImage(HDC hMemDC, IMAGE& item);
@@ -205,6 +206,8 @@
void* m_pHighItem;
HWND m_hWndTooltip;
int m_slotBarSize;
+ int m_slotBarSize8;
+ int m_slotBarSizeOther;
};
#endif // !defined(AFX_EQUIPMENTGRAPH_H__FBB8916A_DE77_4EA3_9C21_E51E6B06194C__INCLUDED_)
diff --git a/SourceCode/Bond/x64/Debug/Res/Servo001.bmp b/SourceCode/Bond/x64/Debug/Res/Servo001.bmp
index 3eb0061..e427c5e 100644
--- a/SourceCode/Bond/x64/Debug/Res/Servo001.bmp
+++ b/SourceCode/Bond/x64/Debug/Res/Servo001.bmp
Binary files differ
--
Gitblit v1.9.3