我想用pDC画一个带箭头的线段用哪个函数呀?
解决方案 »
- 子线程能返回char或者CString吗?除了用全局变量
- 如何测试我网络代码传输数据的速度?
- 关于文件的打开
- 每隔3秒调用一次某函数,该函数的主要功能是建立一个工作线程,那万一线程函数3秒内没能退出,会发生什么事?
- GetShortPathName得到的目录怎么这么奇怪啊?
- 如何得到后台程序窗口上 某点的颜色值?
- 这是什么错误,请教高手
- Stdafx.h和Stdafx.cpp到底有什么用
- 這本上寫的是什麼意思??
- 一个未毕业的程序员,该怎么去走这条路?
- 哪位网络高手帮我看看这段代码(仿造MSDN里的ping.c代码),执行到recvfrom就停住不前。
- 如何将一个int型的数值赋给一个LPCTSTR 型的变量?
画一条直线,然后在moveto顶点,
lineto箭头一角
moveto 顶点
lineto箭关另一角
只需要看OnDraw()函数就可以了。
// ttView.cpp : implementation of the CTtView class
//#include "stdafx.h"
#include "tt.h"#include "ttDoc.h"
#include "ttView.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// CTtViewIMPLEMENT_DYNCREATE(CTtView, CView)BEGIN_MESSAGE_MAP(CTtView, CView)
//{{AFX_MSG_MAP(CTtView)
ON_WM_TIMER()
ON_COMMAND(ID_WHY, OnWhy)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CTtView construction/destructionCTtView::CTtView()
{
// TODO: add construction code here
}CTtView::~CTtView()
{
}BOOL CTtView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs return CView::PreCreateWindow(cs);
}/////////////////////////////////////////////////////////////////////////////
// CTtView drawingvoid CTtView::OnDraw(CDC* pDC)
{
CTtDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
pDC->MoveTo(100, 100);
pDC->LineTo(200,100);
pDC->MoveTo(200, 100);
pDC->LineTo(190, 90);
pDC->MoveTo(200, 100);
pDC->LineTo(190, 110);
}/////////////////////////////////////////////////////////////////////////////
// CTtView printingBOOL CTtView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}void CTtView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}void CTtView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}/////////////////////////////////////////////////////////////////////////////
// CTtView diagnostics#ifdef _DEBUG
void CTtView::AssertValid() const
{
CView::AssertValid();
}void CTtView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}CTtDoc* CTtView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTtDoc)));
return (CTtDoc*)m_pDocument;
}
#endif //_DEBUG/////////////////////////////////////////////////////////////////////////////
// CTtView message handlersvoid CTtView::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
CClientDC dc(this);
static int x = 10;
x += 10;
if(x > 600)
x = 0;
dc.TextOut(0, 10, " ");
dc.TextOut(x, 10, "Test Ok"); CView::OnTimer(nIDEvent);
}void CTtView::OnWhy()
{
// TODO: Add your command handler code here
SetTimer(1, 100, NULL);
}