点计算机如何能把文件放大或全屏

展开阅读全文

如何对图片进行放大或缩小

06-15

我有一个函数,功能是显示程序里用到的画图,现在需要加一个放大或是缩小功能,没做过这方面的,没思路了,有谁做个吗,大家讨论下吧,rn[code=C/C++]rn_VOID Canvas_Flip(_HANDLE hCanvas, _INT nX, _INT nY, _INT nWidth, _INT nHeight)rnrn HDC hDC = (HDC)::SendMessage(SimulatorData.m_hMainFrame, UM_GetDrawDevices, NULL, NULL);rn _CANVASOBJECT* pCanvas = (_CANVASOBJECT*)hCanvas;rn if (hDC && pCanvas)rn rn _RECT rect;rn GetScreenRect(&rect);rn rn if ((MediaPlayerRect.nWidth <= 0) || (MediaPlayerRect.nHeight <= 0))rn BitBlt(hDC, rect.nLeft + nX, rect.nTop + nY, nWidth, nHeight, pCanvas->hMemDC, nX, nY, SRCCOPY);rn elsern rnrn _INT x1 = nX, x2 = MediaPlayerRect.nLeft, x3 = MediaPlayerRect.nLeft + MediaPlayerRect.nWidth, x4 = nX + nWidth;rn _INT y1 = nY, y2 = MediaPlayerRect.nTop, y3 = MediaPlayerRect.nTop + MediaPlayerRect.nHeight, y4 = nY + nHeight;rn if (x4 > x1 > 0 && y2 > y1)rn BitBlt(hDC, rect.nLeft + x1, rect.nTop + y1, x4 - x1, y2 - y1, pCanvas->hMemDC, x1, y1, SRCCOPY);rn if (x2 > x1 > 0 && y3 > y2)rn BitBlt(hDC, rect.nLeft + x1, rect.nTop + y2, x2 - x1, y3 - y2, pCanvas->hMemDC, x1, y2, SRCCOPY);rn if (x4 > x3 > 0 && y3 > y2)rn BitBlt(hDC, rect.nLeft + x3, rect.nTop + y2, x4 - x3, y3 - y2, pCanvas->hMemDC, x3, y2, SRCCOPY);rn if (x4 > x1 > 0 && y4 > y3)rn BitBlt(hDC, rect.nLeft + x1, rect.nTop + y3, x4 - x1, y4 - y3, pCanvas->hMemDC, x1, y3, SRCCOPY);rn rnrn rn ::SendMessage(SimulatorData.m_hMainFrame, UM_ReleaseDrawDevices, (WPARAM)hDC, NULL);rnrn[/code] 论坛

没有更多推荐了,返回首页