我知道用CWindowDC類(lèi)的話 可以用CWindowDC(GetDesktopWindow);直接初始化\
如果用CDC的話~~怎么賦值 能在桌面繪圖~
-------------------------------
HDC hDC = ::GetDC(NULL);// 可以直接操縱hDC
CDC dc; // 在屏幕中繪制
dc.Attach(hDC);
dc.SetBkMode(TRANSPARENT);
dc.SetTextColor(RGB(255,0,0));
CRect rect;
GetWindowRect(&rect);
//ScreenToClient(&rect);
ClientToScreen(&rect);
dc.TextOut(rect.top,rect.left,"sdf");
//dc.Detach();
//ReleaseDC(&dc);
---------------------
客戶端的 DC
CClientDC dc(this);// CClientDC 是CDC 的子類(lèi),在CClientDC 在構(gòu)造時(shí)調(diào)用了Windows函數(shù)GetDC,在析構(gòu)時(shí)調(diào)用了ReleaseDC
dc.SetBkMode(TRANSPARENT);
dc.SetTextColor(RGB(255,0,0));
CRect rect;
GetWindowRect(&rect);
//ScreenToClient(&rect);
// ClientToScreen(&rect);
// dc.TextOut(rect.top,rect.left,"sdf");
dc.TextOut(0,0,"sdf");
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)
點(diǎn)擊舉報(bào)。