chenluhua1980
5 天以前 43cd50ae5629f8e18c349fe5e9a58aac298df9f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once
#include <vector>
#include <afxwin.h>
 
class CSlotTableCtrl : public CWnd
{
public:
    struct Row {
        CString slot;
        CString glassId;
        CString type;
    };
 
    BOOL Create(CWnd* pParent, const RECT& rc, UINT nID);
    void SetRows(const std::vector<Row>& rows);
    void SetTitle(const CString& title);
    void SetRowHeight(int height);
    void SetPadding(int padding);
    void SetHeaderHeight(int height);
    void SetTitleHeight(int height);
    void SetLineColor(COLORREF color);
    void SetHeaderBgColor(COLORREF color);
    void Clear();
 
protected:
    afx_msg void OnPaint();
    afx_msg BOOL OnEraseBkgnd(CDC* pDC);
    DECLARE_MESSAGE_MAP()
 
private:
    std::vector<Row> m_rows;
    CString m_title;
    int m_rowHeight = 20;
    int m_padding = 8;
    int m_headerHeight = 22;
    int m_titleHeight = 20;
    COLORREF m_lineColor = RGB(230, 230, 230);
    COLORREF m_headerBgColor = RGB(245, 245, 245);
};