📄 realtime.cpp
字号:
double dVolRatio = 0;
strTemp = "-";
if( info.GetRatioVolume( &dVolRatio, info.m_datetech, AfxGetProfile().GetRatioVolumeDays() ) )
{
CSPTime tTrade;
if( tTrade.FromStockTimeDay( info.m_datetech ) )
dVolRatio = dVolRatio / CSPTime::GetTimeTradeRatioOfOneDay( tTrade, CSPTime::GetCurrentTime() );
strTemp.Format( "%.2f", dVolRatio );
}
pDC->TextOut( x2, y+251, strTemp );
// 外盘
pDC->SetTextColor( clrRise );
strTemp = "-";
if( bStatSuc )
strTemp.Format( "%.0f", dVolOuter/100 );
pDC->TextOut( x, y+270, strTemp );
// 内盘
pDC->SetTextColor( clrFall );
strTemp = "-";
if( bStatSuc )
strTemp.Format( "%.0f", dVolInner/100 );
pDC->TextOut( x2, y+270, strTemp );
// 涨家数,跌家数
int nRetValue = 287;
if( info.IsIndex() )
{
pDC->SetTextColor( clrRise );
strTemp = "-";
if( info.m_dwAdvance > 0 )
strTemp.Format( "%uf", info.m_dwAdvance );
pDC->TextOut( x, y+289, strTemp );
pDC->SetTextColor( clrFall );
strTemp = "-";
if( info.m_dwDecline > 0 )
strTemp.Format( "%uf", info.m_dwDecline );
pDC->TextOut( x2, y+289, strTemp );
nRetValue = 306;
}
pDC->SetTextAlign( nOldAlign );
pDC->SelectObject( pOldFont );
return nRetValue;
}
int CRealTime::DrawBuySellEx( CDC * pDC, int xStart, int yStart, int nWidth )
{
DECLARE_COLOR_DEFINATION
CStockInfo & info = m_CurStock.GetStockInfo();
CString strTemp, strTempFmt;
// Draw Name And Code
CFont * pOldFont = AfxSelectDCFont( pDC, 18 );
pDC->SetTextColor( clrTitle );
pDC->TextOut( xStart+1, m_rectAll.top+3, info.GetStockName() );
pDC->SetTextColor( clrText );
pDC->TextOut( xStart+96, m_rectAll.top+3, info.GetStockCode() );
// Select Report Font
AfxSelectDCFont( pDC, 14 );
// Draw Report Names
int x = xStart+2;
int x2 = xStart+2+nWidth/2;
int y = yStart;
pDC->SetTextColor( clrText );
// 委比和委差
strTemp = "委比"; // "委比";
pDC->TextOut( x, y+2, strTemp );
strTemp = "委差"; // "委差";
pDC->TextOut( x2, y+2, strTemp );
// 委卖数
DrawLine( pDC, 1, clrBorder, xStart, y+19, xStart+nWidth, y+19 );
pDC->SetTextColor( clrNewKLine );
strTemp = "卖⑧"; // "卖⑧";
pDC->TextOut( x, y+21, strTemp );
strTemp = "卖⑦"; // "卖⑦";
pDC->TextOut( x, y+37, strTemp );
strTemp = "卖⑥"; // "卖⑥";
pDC->TextOut( x, y+53, strTemp );
pDC->SetTextColor( clrText );
strTemp = "卖⑤"; // "卖⑤";
pDC->TextOut( x, y+69, strTemp );
strTemp = "卖④"; // "卖④";
pDC->TextOut( x, y+85, strTemp );
strTemp = "卖③"; // "卖③";
pDC->TextOut( x, y+101, strTemp );
strTemp = "卖②"; // "卖②";
pDC->TextOut( x, y+117, strTemp );
strTemp = "卖①"; // "卖①";
pDC->TextOut( x, y+133, strTemp );
// 委买数
DrawLine( pDC, 1, clrBorder, xStart, y+150, xStart+nWidth, y+150 );
strTemp = "买①";
pDC->TextOut( x, y+152, strTemp );
strTemp = "买②";
pDC->TextOut( x, y+168, strTemp );
strTemp = "买③";
pDC->TextOut( x, y+184, strTemp );
strTemp = "买④";
pDC->TextOut( x, y+200, strTemp );
strTemp = "买⑤";
pDC->TextOut( x, y+216, strTemp );
pDC->SetTextColor( clrNewKLine );
strTemp = "买⑥";
pDC->TextOut( x, y+232, strTemp );
strTemp = "买⑦";
pDC->TextOut( x, y+248, strTemp );
strTemp = "买⑧";
pDC->TextOut( x, y+264, strTemp );
pDC->SetTextColor( clrText );
// 其他信息报告
DrawLine( pDC, 1, clrBorder, xStart, y+281, xStart+nWidth, y+281 );
strTemp = "成交";
pDC->TextOut( x, y+283, strTemp );
strTemp = "均价";
pDC->TextOut( x2, y+283, strTemp );
strTemp = "涨跌";
pDC->TextOut( x, y+299, strTemp );
strTemp = "开盘";
pDC->TextOut( x2, y+299, strTemp );
strTemp = "幅度";
pDC->TextOut( x, y+315, strTemp );
strTemp = "最高";
pDC->TextOut( x2, y+315, strTemp );
strTemp = "总手";
pDC->TextOut( x, y+331, strTemp );
strTemp = "最低";
pDC->TextOut( x2, y+331, strTemp );
strTemp = "现手";
pDC->TextOut( x, y+347, strTemp );
strTemp = "量比";
pDC->TextOut( x2, y+347, strTemp );
// 内外盘
DrawLine( pDC, 1, clrBorder, xStart, y+364, xStart+nWidth, y+364 );
strTemp = "外盘";
pDC->TextOut( x, y+366, strTemp );
strTemp = "内盘";
pDC->TextOut( x2, y+366, strTemp );
DrawLine( pDC, 1, clrBorder, xStart, y+383, xStart+nWidth, y+383 );
// 涨家数,跌家数
if( info.IsIndex() )
{
strTemp = "涨家数";
pDC->TextOut( x, y+385, strTemp );
strTemp = "跌家数";
pDC->TextOut( x2, y+385, strTemp );
DrawLine( pDC, 1, clrBorder, xStart, y+402, xStart+nWidth, y+402 );
}
// Draw Report Values
x = xStart-1+nWidth/2;
x2 = xStart+nWidth-1;
UINT nOldAlign = pDC->SetTextAlign( TA_RIGHT | TA_TOP );
pDC->SetTextColor( clrPlane );
// 委比和委差
double dRatio = 0, dDiff = 0;
if( info.IsIndex() || info.GetSellBuyRatio( &dRatio, &dDiff ) )
{
strTemp.Format( "%.2f%%", dRatio );
pDC->TextOut( x, y+2, strTemp );
strTemp.Format( "%.0f", dDiff*0.01 );
pDC->TextOut( x2, y+2, strTemp );
}
// 价格小数位数格式串
CString strPriceFmt;
strPriceFmt.Format( "%%.%df", info.DigitBit() );
// 委卖数
float fSellPrice[8], fSellVolume[8], fBuyPrice[8], fBuyVolume[8];
m_CurStock.GetReport().StatBuySellEx( fSellPrice, fSellVolume, fBuyPrice, fBuyVolume, 8 );
if( info.IsIndex() )
{
memset( fSellPrice, 0, sizeof(fSellPrice) );
memset( fSellVolume, 0, sizeof(fSellVolume) );
memset( fBuyPrice, 0, sizeof(fBuyPrice) );
memset( fBuyVolume, 0, sizeof(fBuyVolume) );
}
pDC->SetTextColor( RT_DETERMINE_COLOR(fSellPrice[7],info.m_fLast) );
strTemp.Format( strPriceFmt, fSellPrice[7] );
pDC->TextOut( x, y+21, strTemp );
strTemp.Format( "%.0f", fSellVolume[7]/100 );
pDC->TextOut( x2, y+21, strTemp );
pDC->SetTextColor( RT_DETERMINE_COLOR(fSellPrice[6],info.m_fLast) );
strTemp.Format( strPriceFmt, fSellPrice[6] );
pDC->TextOut( x, y+37, strTemp );
strTemp.Format( "%.0f", fSellVolume[6]/100 );
pDC->TextOut( x2, y+37, strTemp );
pDC->SetTextColor( RT_DETERMINE_COLOR(fSellPrice[5],info.m_fLast) );
strTemp.Format( strPriceFmt, fSellPrice[5] );
pDC->TextOut( x, y+53, strTemp );
strTemp.Format( "%.0f", fSellVolume[5]/100 );
pDC->TextOut( x2, y+53, strTemp );
pDC->SetTextColor( RT_DETERMINE_COLOR(fSellPrice[4],info.m_fLast) );
strTemp.Format( strPriceFmt, fSellPrice[4] );
pDC->TextOut( x, y+69, strTemp );
strTemp.Format( "%.0f", fSellVolume[4]/100 );
pDC->TextOut( x2, y+69, strTemp );
pDC->SetTextColor( RT_DETERMINE_COLOR(fSellPrice[3],info.m_fLast) );
strTemp.Format( strPriceFmt, fSellPrice[3] );
pDC->TextOut( x, y+85, strTemp );
strTemp.Format( "%.0f", fSellVolume[3]/100 );
pDC->TextOut( x2, y+85, strTemp );
pDC->SetTextColor( RT_DETERMINE_COLOR(fSellPrice[2],info.m_fLast) );
strTemp.Format( strPriceFmt, fSellPrice[2] );
pDC->TextOut( x, y+101, strTemp );
strTemp.Format( "%.0f", fSellVolume[2]/100 );
pDC->TextOut( x2, y+101, strTemp );
pDC->SetTextColor( RT_DETERMINE_COLOR(fSellPrice[1],info.m_fLast) );
strTemp.Format( strPriceFmt, fSellPrice[1] );
pDC->TextOut( x, y+117, strTemp );
strTemp.Format( "%.0f", fSellVolume[1]/100 );
pDC->TextOut( x2, y+117, strTemp );
pDC->SetTextColor( RT_DETERMINE_COLOR(fSellPrice[0],info.m_fLast) );
strTemp.Format( strPriceFmt, fSellPrice[0] );
pDC->TextOut( x, y+133, strTemp );
strTemp.Format( "%.0f", fSellVolume[0]/100 );
pDC->TextOut( x2, y+133, strTemp );
// 委买数
pDC->SetTextColor( RT_DETERMINE_COLOR(fBuyPrice[0],info.m_fLast) );
strTemp.Format( strPriceFmt, fBuyPrice[0] );
pDC->TextOut( x, y+152, strTemp );
strTemp.Format( "%.0f", fBuyVolume[0]/100 );
pDC->TextOut( x2, y+152, strTemp );
pDC->SetTextColor( RT_DETERMINE_COLOR(fBuyPrice[1],info.m_fLast) );
strTemp.Format( strPriceFmt, fBuyPrice[1] );
pDC->TextOut( x, y+168, strTemp );
strTemp.Format( "%.0f", fBuyVolume[1]/100 );
pDC->TextOut( x2, y+168, strTemp );
pDC->SetTextColor( RT_DETERMINE_COLOR(fBuyPrice[2],info.m_fLast) );
strTemp.Format( strPriceFmt, fBuyPrice[2] );
pDC->TextOut( x, y+184, strTemp );
strTemp.Format( "%.0f", fBuyVolume[2]/100 );
pDC->TextOut( x2, y+184, strTemp );
pDC->SetTextColor( RT_DETERMINE_COLOR(fBuyPrice[3],info.m_fLast) );
strTemp.Format( strPriceFmt, fBuyPrice[3] );
pDC->TextOut( x, y+200, strTemp );
strTemp.Format( "%.0f", fBuyVolume[3]/100 );
pDC->TextOut( x2, y+200, strTemp );
pDC->SetTextColor( RT_DETERMINE_COLOR(fBuyPrice[4],info.m_fLast) );
strTemp.Format( strPriceFmt, fBuyPrice[4] );
pDC->TextOut( x, y+216, strTemp );
strTemp.Format( "%.0f", fBuyVolume[4]/100 );
pDC->TextOut( x2, y+216, strTemp );
pDC->SetTextColor( RT_DETERMINE_COLOR(fBuyPrice[5],info.m_fLast) );
strTemp.Format( strPriceFmt, fBuyPrice[5] );
pDC->TextOut( x, y+232, strTemp );
strTemp.Format( "%.0f", fBuyVolume[5]/100 );
pDC->TextOut( x2, y+232, strTemp );
pDC->SetTextColor( RT_DETERMINE_COLOR(fBuyPrice[6],info.m_fLast) );
strTemp.Format( strPriceFmt, fBuyPrice[6] );
pDC->TextOut( x, y+248, strTemp );
strTemp.Format( "%.0f", fBuyVolume[6]/100 );
pDC->TextOut( x2, y+248, strTemp );
pDC->SetTextColor( RT_DETERMINE_COLOR(fBuyPrice[7],info.m_fLast) );
strTemp.Format( strPriceFmt, fBuyPrice[7] );
pDC->TextOut( x, y+264, strTemp );
strTemp.Format( "%.0f", fBuyVolume[7]/100 );
pDC->TextOut( x2, y+264, strTemp );
// 其他信息报告
// 成交
pDC->SetTextColor( RT_DETERMINE_COLOR(info.m_fClose,info.m_fLast) );
strTemp.Format( strPriceFmt, info.m_fClose );
pDC->TextOut( x, y+283, strTemp );
// 均价
pDC->SetTextColor( clrPlane );
strTemp = "-";
if( info.m_fVolume > 0 )
{
double dAve = info.m_fAmount/info.m_fVolume;
pDC->SetTextColor( RT_DETERMINE_COLOR(dAve,info.m_fLast) );
strTemp.Format( strPriceFmt, dAve );
}
pDC->TextOut( x2, y+283, strTemp );
// 涨跌
pDC->SetTextColor( RT_DETERMINE_COLOR(info.m_fClose,info.m_fLast) );
strTemp.Format( strPriceFmt, info.m_fClose-info.m_fLast );
pDC->TextOut( x, y+299, strTemp );
// 开盘
pDC->SetTextColor( RT_DETERMINE_COLOR(info.m_fOpen,info.m_fLast) );
strTemp.Format( strPriceFmt, info.m_fOpen );
pDC->TextOut( x2, y+299, strTemp );
// 幅度
pDC->SetTextColor( RT_DETERMINE_COLOR(info.m_fClose,info.m_fLast) );
strTemp = "-";
if( info.m_fLast > 1e-4 )
strTemp.Format( "%.2f%%", 100*(info.m_fClose-info.m_fLast)/info.m_fLast );
pDC->TextOut( x, y+315, strTemp );
// 最高
pDC->SetTextColor( RT_DETERMINE_COLOR(info.m_fHigh,info.m_fLast) );
strTemp.Format( strPriceFmt, info.m_fHigh );
pDC->TextOut( x2, y+315, strTemp );
// 总手
pDC->SetTextColor( clrPlane );
strTemp.Format( "%.0f", info.m_fVolume/100. );
pDC->TextOut( x, y+331, strTemp );
// 最低
pDC->SetTextColor( RT_DETERMINE_COLOR(info.m_fLow,info.m_fLast) );
strTemp.Format( strPriceFmt, info.m_fLow );
pDC->TextOut( x2, y+331, strTemp );
// 现手
pDC->SetTextColor( clrPlane );
strTemp = "-";
double dVolNow = 0, dVolOuter = 0, dVolInner = 0;
BOOL bStatSuc = m_CurStock.GetMinute().StatVolumeInfo( &dVolNow, &dVolOuter, &dVolInner );
if( bStatSuc )
strTemp.Format( "%.0f", dVolNow/100. );
pDC->TextOut( x, y+347, strTemp );
// 量比
pDC->SetTextColor( clrPlane );
double dVolRatio = 0;
strTemp = "-";
if( info.GetRatioVolume( &dVolRatio, info.m_datetech, AfxGetProfile().GetRatioVolumeDays() ) )
{
CSPTime tTrade;
if( tTrade.FromStockTimeDay( info.m_datetech ) )
dVolRatio = dVolRatio / CSPTime::GetTimeTradeRatioOfOneDay( tTrade, CSPTime::GetCurrentTime() );
strTemp.Format( "%.2f", dVolRatio );
}
pDC->TextOut( x2, y+347, strTemp );
// 外盘
pDC->SetTextColor( clrRise );
strTemp = "-";
if( bStatSuc )
strTemp.Format( "%.0f", dVolOuter/100 );
pDC->TextOut( x, y+366, strTemp );
// 内盘
pDC->SetTextColor( clrFall );
strTemp = "-";
if( bStatSuc )
strTemp.Format( "%.0f", dVolInner/100 );
pDC->TextOut( x2, y+366, strTemp );
// 涨家数,跌家数
int nRetValue = 383;
if( info.IsIndex() )
{
pDC->SetTextColor( clrRise );
strTemp = "-";
if( info.m_dwAdvance > 0 )
strTemp.Format( "%uf", info.m_dwAdvance );
pDC->TextOut( x, y+385, strTemp );
pDC->SetTextColor( clrFall );
strTemp = "-";
if( info.m_dwDecline > 0 )
strTemp.Format( "%uf", info.m_dwDecline );
pDC->TextOut( x2, y+385, strTemp );
nRetValue = 402;
}
pDC->SetTextAlign( nOldAlign );
pDC->SelectObject( pOldFont );
return nRetValue;
}
void CRealTime::DrawReportQuote( CDC * pDC )
{
DECLARE_COLOR_DEFINATION
if( m_rectReport.IsRectEmpty() )
return;
// Draw Rect
pDC->FillSolidRect( &m_rectReport, clrBK );
pDC->Draw3dRect( &m_rectReport, clrBorder, clrBorder );
pDC->SetBkColor( clrBK );
int nBuySellHeight = DrawBuySell( pDC, m_rectReport.left, m_rectReport.top, m_rectReport.Width() );
CStockInfo & info = m_CurStock.GetStockInfo();
CReport & aReport = m_CurStock.GetReport();
CRect rect = m_rectRep
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -