1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
BOOL CALLBACK MyPaintEnumProc(
HMONITOR hMonitor, // handle to display monitor
HDC hdc, // handle to monitor DC
LPRECT lprcMonitor, // monitor intersection rectangle
LPARAM data // data
)
{
RECT rc = *lprcMonitor;
// you have the rect which has coordinates of the monitor
int sizeX = (int) ceil( (rc.right-rc.left) *0.83);
int sizeY = (int) ceil( (rc.bottom-rc.top) *0.83);
Graphics graphics(hdc);
if (gpBitmapMotivation)
graphics.DrawImage(gpBitmapMotivation, rc.left, rc.top, sizeX, sizeY);
if (gpBitmapAvailability)
graphics.DrawImage(gpBitmapAvailability, rc.left, sizeY, rc.right - rc.left, rc.bottom - sizeY);
if (gpBitmapShared)
graphics.DrawImage(gpBitmapShared, sizeX, 0, rc.right-sizeX, sizeY);
SolidBrush brush(Color(255, 0, 0, 255));
FontFamily fontFamily(L"Times New Roman");
Font font(&fontFamily, 64, FontStyleRegular, UnitPixel);
PointF pointf(sizeX *0.8f, sizeY + (rc.bottom-sizeY)/2.0f );
std::wstringstream ss;
ss << L" Time: " << clock(); //++gTimeElapsed;
std::wstring resultwStr = ss.str();
SetBkMode(hdc, TRANSPARENT);
graphics.DrawString(resultwStr.c_str(), -1, &font, pointf, &brush);
return false; //temp hack to only draw on monitor1
}
|