www.pudn.com > TestLinearGrap.rar > LinearGraph.h
#if !defined(AFX_LINEARGRAPH_H__0DB3F6D4_3830_4465_9777_FAE554D122D4__INCLUDED_)
#define AFX_LINEARGRAPH_H__0DB3F6D4_3830_4465_9777_FAE554D122D4__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// LinearGraph.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CLinearGraph window
struct SPosValue
{
BOOL bUnkownValue;
int value;
};
class CLine
{
public:
CLine();
~CLine();
void SetLinePosCount(UINT nCount);
int GetLineCount();
void ShiftValue(UINT nCount);
void SetPosValue(UINT nPos, int nValue);
BOOL GetPosValue(UINT nPos, int &Value);
COLORREF m_LineColr;
protected:
SPosValue *m_pValues;
UINT m_ValueCount;
};
class CLinearGraph : public CStatic
{
// Construction
public:
CLinearGraph();
virtual ~CLinearGraph();
// Attributes
public:
enum COLOR_ITEM
{ BORDER_COLOR, BK_COLOR, GRID_LINE_COLOR, COLOR_ITEM_BUTT};
void SetColor(COLOR_ITEM, COLORREF colr);
void SetLineColor(UINT iLineID, COLORREF colr);
void SetLines(UINT nLineCount, UINT nUnits);
void SetDrawGrid(BOOL bDraw=TRUE);
void SetGridSize(const CSize &size);
void SetValueUnit(int nWidth);
void ShiftUnit(int nUnit=1);
void SetCurLine(UINT nLineID);
void SetValue(int nValue);
void SetValue(UINT nLineID, int nValue);
//void SetValue(int nLineID, UINT nUnit, int nValue);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CLinearGraph)
//}}AFX_VIRTUAL
// Implementation
protected:
COLORREF m_Colors[COLOR_ITEM_BUTT];
BOOL m_bDrawDrid;
CSize m_GridSize;
UINT m_nYUnitWidth;
int m_xMin;
int m_xMax;
UINT m_nUints;
int m_nUintPos;
UINT m_CurLineID;
CLine *m_LineMap;
UINT m_nLineCount;
// Generated message map functions
protected:
//{{AFX_MSG(CLinearGraph)
afx_msg void OnPaint();
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_LINEARGRAPH_H__0DB3F6D4_3830_4465_9777_FAE554D122D4__INCLUDED_)