我是不是很笨啊?连画条直线都不行~:RECT rectClient;
GetClientRect(&rectClient);
int iX = rectClient.left;
int iY = rectClient.top;
int jX = rectClient.right;
int jY = rectClient.bottom ;
CDC *cdc;
cdc = GetDC();
MoveToEx(*cdc,iX,iY,NULL);
LineTo(*cdc,jX,jY);哪里有问题~?
GetClientRect(&rectClient);
int iX = rectClient.left;
int iY = rectClient.top;
int jX = rectClient.right;
int jY = rectClient.bottom ;
CDC *cdc;
cdc = GetDC();
MoveToEx(*cdc,iX,iY,NULL);
LineTo(*cdc,jX,jY);哪里有问题~?
GetClientRect(&rc);
CClientDC dc(this);
dc.MoveTo(rc.TopLeft());
dc.LineTo(rc.BottomRight());
LineTo(cdc->m_hDC,jX,jY);
GetClientRect(&rectClient);
int iX = rectClient.left;
int iY = rectClient.top;
int jX = rectClient.right;
int jY = rectClient.bottom ;
CDC *cdc;
cdc = GetDC();
cdc->MoveTo(iX,iY);
cdc->LineTo(jX,jY);api 的 MoveToEx()第一个参数是HDC,不是cdc
void CDrawTestView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
里面继续打我,不过没分了~嘿嘿
RECT rectClient;
GetClientRect(hWnd,&rectClient);//hWnd is a valide window's handle
int iX = rectClient.left;
int iY = rectClient.top;
int jX = rectClient.right;
int jY = rectClient.bottom ;
HDC hdc; //if you write sdk code, don't bore mfc class CDC
hdc = GetDC();
MoveToEx(hdc,iX,iY,NULL);
LineTo(hdc,jX,jY);
ReleaseDC(hdc); //don't forget to release resourceif code from mfc app, like this
void CXXXXXWnd::OnPaint()
{
CPaintDC dc(this);
CRect rc;
GetClientRect(&rc);
dc.MoveTo(rc.TopLeft());
dc.LineTo(rc.BottomRight());
}