设为首页 加入收藏

TOP

VC按钮自绘的简单实现(三)
2015-11-21 03:28:02 】 浏览:2763
Tags:按钮 简单 实现
, rcLeftBottom.top, rcLeftBottom.Width(), rcLeftBottom.Height(), memdc, 0, m_nHeight-m_rcBorder9grid.bottom, m_rcBorder9grid.left, m_rcBorder9grid.bottom,RGB(255,0,255)); //左边 CRect rcLeft; rcLeft.left = rcItem.left; rcLeft.right = rcLeft.left+m_rcBorder9grid.left; rcLeft.top = rcItem.top+m_rcBorder9grid.top; rcLeft.bottom = rcItem.bottom-m_rcBorder9grid.bottom; ::StretchBlt(hSrcDC, rcLeft.left, rcLeft.top, rcLeft.Width(), rcLeft.Height(), memdc, 0, m_rcBorder9grid.top, m_rcBorder9grid.left, m_nHeight-m_rcBorder9grid.top-m_rcBorder9grid.bottom, SRCCOPY); //顶边 CRect rcTop; rcTop.left = rcItem.left+m_rcBorder9grid.left; rcTop.right = rcItem.right-m_rcBorder9grid.right; rcTop.top = rcItem.top; rcTop.bottom = rcTop.top+m_rcBorder9grid.top; ::StretchBlt(hSrcDC, rcTop.left, rcTop.top, rcTop.Width(), rcTop.Height(), memdc, m_rcBorder9grid.left, 0, m_nWidth-m_rcBorder9grid.left-m_rcBorder9grid.right, m_rcBorder9grid.top, SRCCOPY); //右边 CRect rcRight; rcRight.right = rcItem.right; rcRight.left = rcRight.right-m_rcBorder9grid.right; rcRight.top = rcItem.top+m_rcBorder9grid.top; rcRight.bottom = rcItem.bottom-m_rcBorder9grid.bottom; ::StretchBlt(hSrcDC, rcRight.left, rcRight.top, rcRight.Width(), rcRight.Height(), memdc, m_nWidth-m_rcBorder9grid.right, m_rcBorder9grid.top, m_rcBorder9grid.right, m_nHeight-m_rcBorder9grid.top-m_rcBorder9grid.bottom, SRCCOPY); //底边 CRect rcBottom; rcBottom.left = rcItem.left+m_rcBorder9grid.left; rcBottom.right = rcItem.right-m_rcBorder9grid.right; rcBottom.bottom = rcItem.bottom; rcBottom.top = rcBottom.bottom-m_rcBorder9grid.bottom; ::StretchBlt(hSrcDC, rcBottom.left, rcBottom.top, rcBottom.Width(), rcBottom.Height(), memdc, m_rcBorder9grid.left, m_nHeight-m_rcBorder9grid.bottom, m_nWidth-m_rcBorder9grid.left-m_rcBorder9grid.right, m_rcBorder9grid.bottom, SRCCOPY); //中心 CRect rcCenter; rcCenter.left = rcItem.left+m_rcBorder9grid.left; rcCenter.right = rcItem.right-m_rcBorder9grid.right; rcCenter.top = rcItem.top+m_rcBorder9grid.top; rcCenter.bottom = rcItem.bottom-m_rcBorder9grid.bottom; int nMode = ::SetStretchBltMode(hSrcDC,HALFTONE); ::StretchBlt(hSrcDC, rcCenter.left, rcCenter.top, rcCenter.Width(), rcCenter.Height(), memdc, m_rcBorder9grid.left, m_rcBorder9grid.top, m_nWidth-m_rcBorder9grid.left-m_rcBorder9grid.right, m_nHeight-m_rcBorder9grid.top-m_rcBorder9grid.bottom, SRCCOPY); ::SetStretchBltMode(hSrcDC,nMode); ::DeleteDC(memdc); } return TRUE; }

为了更清楚,现把顶边代码去掉看看:
这里写图片描述

通过控件自绘,你能够按照自己的需要和想法来实现一些酷炫的界面外观。人靠衣装,佛靠金装,一个好的软件产品也需要精致的外表,至少在审美上要满足用户的需求,提高用户体验。

首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇经验之谈―项目如何分模块(MVC) 下一篇vc获得窗口并枚举其子窗口

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目