?? realtime.h
字號:
// RealTime.h : interface of the CRealTime class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_REALTIME_H__0A8D66A9_30E0_4AAA_8E17_06B721FC0E97__INCLUDED_)
#define AFX_REALTIME_H__0A8D66A9_30E0_4AAA_8E17_06B721FC0E97__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/***
畫圖類,負責畫出分時行情圖中的所有部分
*/
class CRealTime
{
public:
CRealTime( );
virtual ~CRealTime( );
enum DrawMode {
modePriceLine = 0x01, // 分時價格線
modeReportDetail = 0x02, // 每筆成交明細
modeMinuteDetail = 0x03, // 分鐘成交明細
modeBigTradeDetail = 0x04, // 大單成交明細
};
enum TechLine {
techNone = 0x00,
techLBDK = 0x01,
techMMLD = 0x02
};
enum ReportWhat {
reportNone = 0x00,
reportQuote = 0x01,
reportPrice = 0x02,
reportMinute = 0x03,
reportBuySellEx = 0x04,
reportValue = 0x05,
reportDistribute= 0x06,
reportBigTrade = 0x07,
};
// 設定父窗口,以便在父窗口區域內畫圖線
void SetParent( CWnd * pParent );
// 設定邊框大小
void ResetMargins( int nMarginTop = 19, int nMarginLeft = 60,
int nMarginCenter = 45, int nMarginBottom = 19,
int nGapYAxis = 18, int nWidthReport = 200 );
// 清除當前股票及數據
void ClearCurStock( );
// 設定當前要畫的股票
BOOL SetCurStock( const char * szCode );
BOOL SetCurStock( CStockInfo & info );
CStock & GetCurStock( ) { return m_CurStock; }
BOOL PrepareStockData( ); // 準備股票數據
// 畫圖屬性
void SetDrawMode( int nDrawMode = modePriceLine, int nTechLine = techNone, int nReportWhat = CRealTime::reportQuote );
int GetDrawMode( );
int GetDrawTechLine( );
int GetReportWhat( );
// 刷新實時行情數據
LRESULT OnStkReceiverData( WPARAM wParam, LPARAM lParam );
// 重畫
void Redraw( CDC * pDC, CRect rectAll );
void DrawReportRegion( CDC * pDC );
public:
//////////////////////////////////////////////////////////
// modePriceLine 焦點移動,按左、右鍵移動
void MoveLeft( BOOL bShiftPressed = FALSE );
void MoveRight( BOOL bShiftPressed = FALSE );
void MoveUp( BOOL bShiftPressed = FALSE );
void MoveDown( BOOL bShiftPressed = FALSE );
void MoveHome( BOOL bShiftPressed = FALSE );
void MoveEnd( BOOL bShiftPressed = FALSE );
void MoveTo( int nIndex, BOOL bShiftPressed, BOOL bCtrlPressed );
void Move( int nMove, BOOL bShiftPressed, BOOL bCtrlPressed );
void OnLButtonDown( UINT nFlags, CPoint point, BOOL bShiftPressed, BOOL bCtrlPressed );
void OnLButtonDblClk( UINT nFlags, CPoint point );
void ResetIndexCurrent( int nIndexCurrent = -1 );
//////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////
// modeReportDetail, modeMinuteDetail, modeBigTradeDetail 明細使用
void PageUp( );
void PageDown( );
//////////////////////////////////////////////////////////
protected:
//////////////////////////////////////////////////////////
// modePriceLine 分時價格線使用
void ResetClient( CRect rectAll ); // 重新設定整圖區域
BOOL AddIndexCurrent( int nIndex );
void OnIndexCurrentChanged( );
void DrawSelectionLine( CDC * pDC, BOOL bAddOrRemove );
void DrawDateAxis( CDC * pDC ); // 畫時間軸
BOOL GetMinMaxInfo( double* pdLastClose, double *pdMin, double *pdMax, double *pdMaxVolume, BOOL bUptoAxis ); // 得到最高最低成交價格、最高成交量
void DrawPriceVolume( CDC * pDC ); // 畫價格線和成交量線
void DrawMMLD( CDC * pDC ); // 畫買賣力道指標
void DrawLBDK( CDC * pDC ); // 畫量比多空指標
int DrawBuySell( CDC * pDC, int xStart, int yStart, int nWidth ); // 畫報價信息
int DrawBuySellEx( CDC * pDC, int xStart, int yStart, int nWidth ); // 畫擴充盤報價信息
void DrawReportQuote( CDC * pDC ); // 畫報價信息、成交明細
void DrawReportPrice( CDC * pDC ); // 畫報價信息、分價表
void DrawReportMinute( CDC * pDC ); // 畫報價信息、分鐘成交明細
void DrawReportBuySellEx( CDC * pDC ); // 畫報價信息、擴充買賣盤
void DrawReportValue( CDC * pDC ); // 畫報價信息、價格信息
void DrawReportDistribute( CDC * pDC ); // 畫成交分布
void DrawReportBigTrade( CDC * pDC ); // 畫大單成交信息
BOOL LoadReportBigTrade( ); // 讀取保存的大單成交信息
//////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////
// modeReportDetail, modeMinuteDetail, modeBigTradeDetail 明細使用
int GetColumnPerPage( CRect rectAll );
int GetCountPerColumn( CRect rectAll );
int CheckValidStartPos( int nStartPosOld, int nTotalCount, int nPageCount, BOOL bAlignBegin );
void DrawReportDetail( CDC * pDC );
void DrawReportColumn( CDC * pDC, CStockInfo & info, CReport & aReport, int nStartPos, int nMaxCount, CRect rect );
void DrawMinuteDetail( CDC * pDC );
void DrawMinuteColumn( CDC * pDC, CStockInfo & info, CMinute & aMinute, int nStartPos, int nMaxCount, CRect rect );
void DrawBigTradeDetail( CDC * pDC );
void DrawBigTradeColumn( CDC * pDC, CReport & aMinute, int nStartPos, int nMaxCount, CRect rect );
//////////////////////////////////////////////////////////
protected:
// Attributes
int m_nMarginTop; // 上邊空白
int m_nMarginLeft; // 左邊空白
int m_nMarginCenter; // 中間空白
int m_nMarginBottom; // 下邊空白
int m_nGapYAxis; // 縱坐標格線高度
int m_nWidthReport; // 右邊信息欄寬度
CWnd * m_pParent; // 父窗口
CStock m_CurStock; // 當前股票
CRect m_rectAll; // 整個Rect
int m_nDrawMode; // See CRealTime::DrawMode,標記當前畫分時價格線、成交明細等
// modePriceLine use
CRect m_rectPrice; // 價格Rect
CRect m_rectVolume; // 成交量Rect
CRect m_rectLBDK; // 量比(多空)指標
CRect m_rectMMLD; // 買賣力道,總買盤減總賣盤
CRect m_rectReport; // 買賣信息及成交明細Rect
int m_nIndexCurrent; // 當前選中的序號
CUIntArray m_anIndexCurrent; // 當前多個選中的序號
int m_nTechLine; // see enum CRealTime::TechLine
int m_nReportWhat; // 是否畫買賣信息及成交明細,多股同列時不畫
// others
CReport m_aReportBigTrade;
int m_nCurrentStartPos; // 當前第一個明細數據在其數組中的位置指針
// modeReportDetail => m_CurStock.GetReport()
// modeMinuteDetail => m_CurStock.GetMinute()
// modeBigTradeDetail => m_aReportBigTrade
// modePriceLine's reportQuote => m_CurStock.GetReport()
// modePriceLine's reportPrice => m_CurStock.GetMinute().StateDealInfo(...)
// modePriceLine's reportMinute => m_CurStock.GetMinute()
// modePriceLine's reportBuySellEx => m_CurStock.GetReport()
// modePriceLine's reportBigTrade => m_aReportBigTrade
int m_nCurrentPageCount;// 當前數據每頁顯示個數,應用場合
// modePriceLine's reportQuote
// modePriceLine's reportPrice
// modePriceLine's reportMinute
// modePriceLine's reportBuySellEx
// modePriceLine's reportBigTrade
int m_nCurrentSelectPos;// 當前選中的某一個大單明細數據在m_aReportBigTrade中的位置指針
// 僅供大單成交明細(modeBigTradeDetail或reportBigTrade)使用
double m_dMaxPrice; // modePriceLine 當前價格線的最高值
double m_dMinPrice; // modePriceLine 當前價格線的最低值
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_REALTIME_H__0A8D66A9_30E0_4AAA_8E17_06B721FC0E97__INCLUDED_)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -