- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
案例3:渐变背景色 需求与目标 我们使用电脑长时间工作以后,都会感到非常疲劳 此时,如果应用程序能够在我们工作一段时间后,自动为背景更换一些靓丽的颜色,生成一些美丽的图画,能够起到调节气氛,消除一些疲劳的作用 手段 渐变色的实现有多种方法,许多资料介绍了利用调色板的方法实现 但是其过程极其复杂,需要我们具有一定的图形编程的基础 手段 我们用一种比较简单的方法来实现,即使你一点都不了解图形编程和调色板的概念也没有问题 手段 绘制渐变色的方法实际上是通过填充一系列颜色逐渐变化的矩形来实现颜色渐变效果的 编程步骤(1) 用AppWizard建立一个单文档工程ShadowView(SDI) 编程步骤(2) 为CShadowViewView添加两个成员变量: private: int ColorR; //记录红色成分 int ColorG; // 记录绿色成分 编程步骤(3) 在CShadowViewView的构造函数中初始化这两个变量: ColorR = ColorG = 255; 编程步骤(4) 在OnDraw()中添加代码: CRect rcClient; GetClientRect(rcClient); int nWidth = rcClient.Width(); int nHeight = rcClient.Height(); CRect rectangle; for (int i=0; inWidth; i++) { rectangle.SetRect(i, 0, i+1, nHeight); pDC-FillSolidRect(rectangle, RGB(ColorR, ColorG, 255 - MulDiv(i, 255, nWidth))); } CView::OnDraw virtual void OnDraw( CDC* pDC ) = 0; pDC Points to the device context to be used for rendering(着色) an image of the document. Remarks Called by the framework to render an image of the document. The framework calls this function to perform screen display, printing, and print preview, and it passes a different device context in each case. There is no default implementation. You must override this function to display your view of the document. You can make graphic device interface (GDI) calls using the CDC object pointed to by the pDC parameter. You can select GDI resources, such as pens or fonts, into the device context before drawing and then deselect them afterwards. Often your drawing code can be device-independent; that is, it doesn’t require information about what type of device is displaying the image. CDC The CDC class encapsulates(装入胶囊, 压缩) the functionality of a Windows device-context, which is a GDI-managed structure containing information about the operating modes and current selections of a device, such as a display or printer. Header File : Afxwin.h CDC::FillSolidRect void FillSolidRect( LPCRECT lpRect, COLORREF clr ); lpRect Specifies the bounding rectangle (in logical units). You can pass either a poi
您可能关注的文档
最近下载
- 报表开发工具FineReport决策系统教程之【1】系统管理员.pdf VIP
- 螺旋钢管项目策划方案通用模板.pdf VIP
- 报表开发工具FineReport参数控件和报表内容自动居中设置方法.pdf VIP
- 健康管理课件PPT.pptx
- 【人教版】初中数学九年级知识点总结:26二次函数和经典题型(附答案).doc VIP
- Java报表开发工具FineReport自定义css使用方法.docx VIP
- 小朋友介绍枪支课件.pptx VIP
- 报表开发工具FineReport决策系统教程之【4】系统监控.pdf VIP
- 提高污水管道安装一次验收合格率(QC成果样板).pptx VIP
- 2021-2022学年四川省成都市武侯区西川中学七年级(上)第一次月考数学试卷(附答案详解).docx VIP
文档评论(0)