19,464
社区成员
发帖
与我相关
我的任务
分享void CHdctestDlg::OnGetdcApinull()
{
HDC hDC=::GetDC(NULL);
::MoveToEx(hDC,10,10,NULL);
LineTo(hDC,800,600);
::ReleaseDC(NULL,hDC);
// TODO: Add your control notification handler code here
}
void CHdctestDlg::OnGetdcApi()
{
HDC hDC=::GetDC(m_hWnd);
::MoveToEx(hDC,0,0,NULL);
LineTo(hDC,200,200);
::ReleaseDC(NULL,hDC);
// TODO: Add your control notification handler code here
}
void CHdctestDlg::OnGetdcCwnd()
{
CDC *pDC = GetDC();
pDC->MoveTo(0,0);
pDC->LineTo(300,200);
ReleaseDC(pDC);
// TODO: Add your control notification handler code here
}
void CHdctestDlg::OnCclientdc()
{
CClientDC dc(this);
CBrush brush(RGB(255,0,0));
dc.Rectangle(0,0,50,50);
dc.FillRect(CRect(1,1,25,25),&brush);
CBrush brush1(RGB(255,255,0));
dc.FillRect(CRect(25,25,49,49),&brush1);
// TODO: Add your control notification handler code here
}
void CHdctestDlg::OnCwindowsdc()
{
CWindowDC dc(this);
CPen pen(PS_SOLID,3,RGB(0,255,0));
CPen *pOldPen = dc.SelectObject(&pen);
dc.MoveTo(0,0);
dc.LineTo(300,50);
dc.SelectObject(pOldPen);
// dc.MoveTo(300,50);
dc.LineTo(0,100);
// TODO: Add your control notification handler code here
}
void CHdctestDlg::OnPointer()
{
CWindowDC* pDC;
pDC = new CWindowDC(this);
pDC->MoveTo(0,100);
pDC->LineTo(300,150);
delete pDC;
// TODO: Add your control notification handler code here
}
void CHdctestDlg::OnCpaintdc()
{
CPaintDC dc(this);
CPen pen(PS_SOLID,3,RGB(0,255,0));
dc.SelectObject(&pen);
dc.MoveTo(0,0);
dc.LineTo(50,300);
// TODO: Add your control notification handler code here
}