📄 flowctrl.h
字号:
#ifndef __FLOWCTRL_H__
#define __FLOWCTRL_H__
#include "FlowImpl.h"
#include "PipeImpl.h"
#define FLOW_TIMER 0x0100
typedef enum _FlowPattern
{
FP_HORIZONTAL = 0,
FP_VERTICAL = 1
}FLOWPATTERN;
typedef enum _DirectionType
{
LEFT_TO_RIGHT = 0,
RIGHT_TO_LEFT = 1,
TOP_TO_BOTTOM = 2,
BOTTOM_TO_TOP = 3
}DIRECTIONTYPE;
class CFlowMemDC : public CDC {
private:
CBitmap* m_bitmap;
CBitmap* m_oldBitmap;
CDC* m_pDC;
CRect m_rcBounds;
public:
CFlowMemDC(CDC* pDC, const CRect& rcBounds) : CDC()
{
CreateCompatibleDC(pDC);
m_bitmap = new CBitmap;
m_bitmap->CreateCompatibleBitmap(pDC, rcBounds.Width(), rcBounds.Height());
m_oldBitmap = SelectObject(m_bitmap);
m_pDC = pDC;
m_rcBounds = rcBounds;
DWORD color = ::GetSysColor( COLOR_BTNFACE );
CBrush bkg(color);
FillRect(rcBounds, &bkg);
}
~CFlowMemDC()
{
m_pDC->BitBlt(m_rcBounds.left, m_rcBounds.top, m_rcBounds.Width(), m_rcBounds.Height(),
this, m_rcBounds.left, m_rcBounds.top, SRCCOPY);
SelectObject(m_oldBitmap);
if (m_bitmap != NULL) delete m_bitmap;
}
CFlowMemDC* operator->() {
return this;
}
};
class CFlowCtrl : public CStatic
{
public:
CFlowCtrl();
virtual ~CFlowCtrl();
void SetPipeStyle(int nInterpolationMethod);
void SetDirectionType(const DIRECTIONTYPE enumDirectionType);
void SetFlow(bool bFlow);
void SetBorderColor(const COLORREF colorBorder);
void SetCenterColor(const COLORREF colorCenter);
void SetUnitBackColor(const COLORREF colorBack);
void ReconstructControl();
inline void SetFlowPattern(const FLOWPATTERN enumFlowPattern)
{
m_enumFlowPattern = enumFlowPattern;
}
inline FLOWPATTERN GetFlowPattern() const
{
return m_enumFlowPattern;
}
inline DIRECTIONTYPE GetDirectionType() const
{
return m_enumDirectionType;
}
inline void SetUnitPattern(const UNITPATTERN enumUnitPattern)
{
m_pFlowImpl->SetUnitPattern(enumUnitPattern);
}
inline COLORREF GetBorderColor() const
{
return m_pPipeImpl->GetBorderColor();
}
inline COLORREF GetCenterColor() const
{
return m_pPipeImpl->GetCenterColor();
}
inline COLORREF GetUnitBackColor() const
{
return m_pFlowImpl->GetUnitBackColor();
}
protected:
virtual void PreSubclassWindow();
protected:
//{{AFX_MSG(CFlowCtrl)
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnPaint();
afx_msg void OnTimer(UINT nIDEvent);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
DIRECTIONTYPE m_enumDirectionType;
FLOWPATTERN m_enumFlowPattern;
CFlowImpl *m_pFlowImpl;
CPipeImpl *m_pPipeImpl;
COLORREF m_colorBack;
bool m_bFlow;
CDC MemDC;
CBitmap MemBitmap;
CBitmap *pOldBitmap;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -