设为首页 加入收藏

TOP

vc 九宫格贴图(三)
2015-07-22 17:34:50 】 浏览:2837
Tags:九宫 贴图
etWidth()-left-right), top); if (!rcDest.IsRectEmpty() && !rcSrc.IsRectEmpty()) Draw(hDC, rcDest, rcSrc); } // 右上 { CRect rcDest(width- right-pright, ptop, (width- right-pright)+right, ptop+top); CRect rcSrc(GetWidth()-right, 0, (GetWidth()-right)+right, top); if (!rcDest.IsRectEmpty() && !rcSrc.IsRectEmpty()) Draw(hDC, rcDest, rcSrc); } // 右边 { CRect rcDest(width-right-pright, top+ptop, (width-right-pright)+right, (top+ptop)+(height-top-bottom-ptop-pbottom)); CRect rcSrc(GetWidth()-right, top, (GetWidth()-right)+right, top+(GetHeight()-top-bottom)); if (!rcDest.IsRectEmpty() && !rcSrc.IsRectEmpty()) Draw(hDC, rcDest, rcSrc); } // 下边 { CRect rcDest(left+pleft, height-bottom-pbottom, (left+pleft)+(width-left-right-pleft-pright), (height-bottom-pbottom)+bottom); CRect rcSrc(left, GetHeight()-bottom, left+(GetWidth()-left-right), (GetHeight()-bottom)+bottom); if (!rcDest.IsRectEmpty() && !rcSrc.IsRectEmpty()) Draw(hDC, rcDest, rcSrc); } // 右下 { CRect rcDest(width-right-pright, height-bottom-pbottom, (width-right-pright)+right, (height-bottom-pbottom)+bottom); CRect rcSrc(GetWidth()-right, GetHeight()-bottom, (GetWidth()-right)+right, (GetHeight()-bottom)+bottom); if (!rcDest.IsRectEmpty() && !rcSrc.IsRectEmpty()) Draw(hDC, rcDest, rcSrc); } // 左下 { CRect rcDest(pleft, height-bottom-pbottom, pleft+left, (height-bottom-pbottom)+bottom); CRect rcSrc(0, GetHeight()-bottom, left, (GetHeight()-bottom)+bottom); if (!rcDest.IsRectEmpty() && !rcSrc.IsRectEmpty()) Draw(hDC, rcDest, rcSrc); } // 中间 { CRect rcDest(left+pleft, top+ptop, (left+pleft)+(width-left-right-pleft-pright), (top+ptop)+(height-top-bottom-ptop-pbottom)); CRect rcSrc(left, top, left+(GetWidth()-left-right), top+(GetHeight()-top-bottom)); if (!rcDest.IsRectEmpty() && !rcSrc.IsRectEmpty()) Draw(hDC, rcDest, rcSrc); } return TRUE; } BOOL CImageEx::DrawNinePartImage(HDC hDC, int x, int y, int cx, int cy, int nLeft, int nTop, int nRight, int nBottom) { int cxImage = GetWidth(); int cyImage = GetHeight(); // 左上 { RECT rcDest = {x, y, x+nLeft, y+nTop}; RECT rcSrc = {0, 0, nLeft, nTop}; if (!::IsRectEmpty(&rcDest) && !::IsRectEmpty(&rcSrc)) Draw(hDC, rcDest, rcSrc); } // 左边 { RECT rcDest = {x, y+nTop, x+nLeft, (y+nTop)+(cy-nTop-nBottom)}; RECT rcSrc = {0, nTop, nLeft, nTop+(cyImage-nTop-nBottom)}; if (!::IsRectEmpty(&rcDest) && !::IsRectEmpty(&rcSrc)) Draw(hDC, rcDest, rcSrc); } // 上边 { RECT rcDest = {x+nLeft, y, (x+nLeft)+(cx-nLeft-nRight), y+nTop}; RECT rcSrc = {nLeft, 0, nLeft+(cxImage-nLeft-nRight), nTop}; if (!::IsRectEmpty(&rcDest) && !::IsRectEmpty(&rcSrc)) Draw(hDC, rcDest, rcSrc); } // 右上 { RECT rcDest = {x+(cx-nRight), y, (x+(cx-nRight))+nRight, y+nTop}; RECT rcSrc = {cxImage-nRight, 0, (cxImage-nRight)+nRight, nTop}; if (!::IsRectEmpty(&rcDest) && !::IsRectEmpty(&rcSrc)) Draw(hDC, rcDest, rcSrc); } // 右边 { RECT rcDest = {x+(cx-nRight), y+nTop, (x+(cx-nRight))+nRight, (y+nTop)+(cy-nTop-nBottom)}; RECT rcSrc = {cxImage-nRight, nTop, (cxI
首页 上一页 1 2 3 4 下一页 尾页 3/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇vc++多线程编程 下一篇VC设置字体

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目