策略为王源代码扩展系列-K线图(4)-K线图将CStockGraph::DrawKData()改为可移动的窗口

Published

K线图CStockGraph::DrawKData()创建的无标题栏窗口,不可移动的窗口。

创建时修改为带标题栏的窗口

创建时修改为带标题栏的窗口,达到鼠标点击标题栏可以移动该窗口的目的

path:src\Client\StkUI\View\StockGraph.cpp

if (!m_wndKData.Create(NULL, "tt", WS_CHILD, m_rectKData, m_pParent, 0))
		if (!m_wndKData.Create(NULL, _T("tt"), WS_CHILD|WS_CAPTION, m_rectKData, m_pParent, 0))
		{
			TRACE("Failed to create m_wndKData!\n");
			return;
		}

 

 

改变可移动窗口高度

主要是在m_rectKData变量初始化时,修改其高度。

src\Client\StkUI\View\StockGraph.cpp

//CStockGraph:画窗口布局 by freeman
void CStockGraph::ResetClient(CRect rectAll)
{
	if (rectAll.IsRectEmpty())
		return;

	m_rectAll = rectAll;
	if (m_rectAll.IsRectEmpty())
		return;

	//	The Left Side m_rectKData
	m_rectKData.top = m_rectAll.top + m_nMarginTop + m_nMarginTop;
	m_rectKData.left = m_rectAll.left + 1;
	//m_rectKData.bottom = m_rectKData.top + 313; //old
	m_rectKData.bottom = m_rectKData.top + 280; //加了涨幅等指标,这里变长
	m_rectKData.right = m_rectKData.left + 182;