我知道用CWindowDC類(lèi)的話(huà) 可以用CWindowDC(GetDesktopWindow);直接初始化\ 如果用CDC的話(huà)~~怎么賦值 能在桌面繪圖~ ------------------------------- 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); --------------------- 客戶(hù)端的 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"); |
|