分类: C/C++
2008-03-11 17:27:30
一、经常使用Microsoft visio画流程图,
觉得其中的智能连接线非常好用,可以手动调节,非常灵活,所以自己写了一个同样功能的类。
图一 连接线
二、步骤
1.创建一个工程,基于文档视图结构的(单文档、多文档都可以)
2.添加文件SmartLines.h到工程
3.在要显示连接线的视图中包含SmartLines.h
...4.拷贝SmartLines.dll和SmartLines.lib到工程文件夹
#include "SmartLines.h"
...

CSmartLines m_lines;
void CTestSmartLinesView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_lines.Track(this,point);
CScrollView::OnLButtonDown(nFlags, point);
}
BOOL CTestSmartLinesView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
// TODO: Add your message handler code here and/or call default
if (m_lines.OnSetCursor(pWnd, nHitTest))
{
return TRUE;
}
return CScrollView::OnSetCursor(pWnd, nHitTest, message);
}
void CTestSmartLinesView::OnDraw(CDC* pDC)
{
CTestSmartLinesDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
m_lines.Draw(pDC);
}