1.Slot小方块大小用两种配置,LoadPort和其它的分开
| | |
| | | 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; |
| | |
| | | m_pHighItem = nullptr; |
| | | m_hWndTooltip = nullptr; |
| | | m_slotBarSize = 0; |
| | | m_slotBarSize8 = 0; |
| | | m_slotBarSizeOther = 0; |
| | | } |
| | | |
| | | CServoGraph::~CServoGraph() |
| | |
| | | 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); |
| | |
| | | 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 |
| | |
| | | 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); |
| | |
| | | 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_) |