chenluhua1980
9 天以前 656228d05e6fa5200ae41621d2250de210d95600
1.Slot小方块大小用两种配置,LoadPort和其它的分开
已修改4个文件
39 ■■■■ 文件已修改
SourceCode/Bond/Servo/CPageGraph1.cpp 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/ServoGraph.cpp 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/ServoGraph.h 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/x64/Debug/Res/Servo001.bmp 补丁 | 查看 | 原始文档 | blame | 历史
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;
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
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_)
SourceCode/Bond/x64/Debug/Res/Servo001.bmp