NM_CUSTOMDRAW 消息

时间:2022-08-28 11:36:53

When the control first starts to paint itself, in response to a WM_PAINT, you receive a NM_CUSTOMDRAW notification message, with the draw stage set to CDDS_PREPAINT. If you don’t handle this yourself that will be the end of it, as the default message handler will just tell the control to carry on with default drawing and not to interrupt you again.

If you do handle the message, you have a chance to do a bit of painting yourself if you want. You can then set a flag in the return result that says whether you want the control to do its default painting; you usually will. You can also set flags to say whether you want to receive further notifications. You can ask the control to send you a WM_CUSTOMDRAW notification for the CDDS_POSTPAINT draw stage when the control has finished drawing (you can then do some extra drawing yourself). You can also say that you want to get notifications for the CDDS_ITEMPREPAINT draw stage for each item drawn.

Similarly, when you get each WM_CUSTOMDRAW notification for the CDDS_ITEMPREPAINT draw stage, you can set up the colours to use, make changes to the device context including font changes, and maybe do some drawing yourself. You can then say whether you want the default painting for the item and whether you want to receive a CDDS_ITEMPOSTPAINT when the item drawing is finished.

If you are in report mode, you can also ask for individual notifications for each subitem. These have the draw stage set to (CDDS_ITEMPREPAINT | CDDS_SUBITEM), and again you can fiddle with the device context, do your own drawing and/or let the control do some drawing and optionally receive a (CDDS_ITEMPOSTPAINT | CDDS_SUBITEM) drawing stage message at the end of each subitem.

NOTE: subitem notifications are only available for custom controls V4.71 (that is, for IE4.0 or Windows 98) or later, so please ensure that you check the version of COMCTL32 you have on your machine if you intend to use custom draw controls.

NM_CUSTOMDRAW 消息的更多相关文章

  1. 针对NM_CUSTOMDRAW消息的学习

    消息的形式:1 窗口消息,2 命令消息,3 WM_NOTIFY消息,4 自定义消息 我们的NM_CUSTOMDRAW消息就是就属于第三种WM_NOTIFY消息,而添加消息映射的方法分为两种: BEGI ...

  2. MFC中ClistCtrl的=NM_CUSTOMDRAW消息

    =NM_CUSTOMDRAW是你点击列表内部是的消息映射: 例如:我想在我删除一行列表的数据,但是删除后下一行数据继续保持高亮状态 void CChildView::OnDel() { int cou ...

  3. mfc ui3

    引用:http://www.cnblogs.com/rainbowzc/archive/2010/06/02/1749872.html 本文专题讨论VC中的界面美化,适用于具有中等VC水平的读者.读者 ...

  4. (转)使用Custom Draw实现ListCtrl的重绘

    使用Custom Draw实现ListCtrl的重绘   common control 4.7版本介绍了一个新的特性叫做Custom Draw,这个名字显得模糊不清,让人有点摸不着头脑,而且MSDN里 ...

  5. 改变ListCtrl某行的背景色或者字体颜色

    大家也许熟悉WM_NOTIFY,控件通过WM_NOTIFY向父窗口发送消息.在WM_NOTIFY消息体中,部分控件会发送NM_CUSTOMDRAW告诉父窗口自己需要绘图. 也可以反射NM_CUSTOM ...

  6. ListControl常用操作汇总

    本文根据本人在项目中的应用,来谈谈CListCtrl的部分用法及技巧.当初学习时,查了很多资料,零零碎碎的作了些记录,现在主要是来做个总结,方便以后查阅.主要包括以下十三点内容:基本操作.获取选中行的 ...

  7. MFC窗口风格 WS_style/WS_EX_style(超详细)

    窗口风格(Window style) WS_BORDER   有边框窗口 WS_CAPTION   必须和WS_BORDER风格配合,但不能与WS_DLGFRAME风格一起使用.指示窗口包含标题要部分 ...

  8. 在 Visual C++ 中开发自定义的绘图控件

    本文讨论的重点介于两者 之间 — 公共控件赋予您想要的大部分功能,但控件的外观并不是您想要的.例如,列表视图控件提供在许多视图风格中显示数据列表的方式 — 小图标.大图标.列表和详细列表(报告).然而 ...

  9. VC之美化界面(内容覆盖十分全面,经典)

    界面美化 摘要本文专题讨论VC中的界面美化,适用于具有中等VC水平的读者.读者最好具有以下VC基础: 1. 大致了解MFC框架的基本运作原理: 2. 熟悉Windows消息机制,熟悉MFC的消息映射和 ...

随机推荐

  1. 第二十四课:jQuery.event.remove,dispatch的源码解读

    本课还是来讲解一下jQuery是如何实现它的事件系统的.这一课我们先来讲一下jQuery.event.remove的源码解读. remove方法的目的是,根据用户传参,找到事件队列,从里面把匹配的ha ...

  2. 用Arduino做一个可视化网络威胁级别指示器!

    在当今世界,网络监控器是非常重要的.互联网是个可怕的地方.人们已经采取措施以提高警戒----他们安装了入侵检测系统(IDS)比如SNORT. 通过把可视化部分从电脑中移出来,我们想让它更容易去观察.一 ...

  3. pytest框架之命令行参数1

    前言 pytest是一款强大的python自动化测试工具,可以胜任各种类型或者级别的软件测试工作.pytest提供了丰富的功能,包括assert重写,第三方插件,以及其他测试工具无法比拟的fixtur ...

  4. JavaScript基础知识(初识JS)

    js的组成部分 1. ECMAScript : JS的基础语法 变量 数据类型,操作语句,函数 es3 es5 es6; 2.DOM : document object model : 文档对象模型: ...

  5. 干货 | 请收下这份2018学习清单:150个最好的机器学习,NLP和Python教程

    机器学习的发展可以追溯到1959年,有着丰富的历史.这个领域也正在以前所未有的速度进化.在之前的一篇文章中,我们讨论过为什么通用人工智能领域即将要爆发.有兴趣入坑ML的小伙伴不要拖延了,时不我待! 在 ...

  6. oracle批量更新之使用游标进行分批次更新的5种方式及速度比对

      1.情景展示 一共有22w条数据, 需要将A表的主键更新至B表的指定字段,如何快速完成更新? 2.解决方案 声明: 解决方案不只一种,该文章只介绍快速游标法及代码实现: 两张表的ID和ID_CAR ...

  7. ZROI2018提高day5t3

    传送门 分析我们可以根据性质将这个序列构造成一个环:0,a[1~n],0,a[n~1] 这中间的0是为了起间隔作用的. 我们又知道b[i]=a[i-1]^a[i+1] c[i]=b[i-1]^b[i+ ...

  8. TeamCity实战(2):NuGet服务器

    如果有在内网架设NuGet服务器的需要,比如说公司要求所有开发人员的开发机与外网隔离,但是项目开发又必须要通过NuGet获取开发包的情况. 打开选项其实很简单,但是打开之后怎么样更新开发包要复杂些了. ...

  9. python学习_循环结构 and 类型判断

    # 循环结构 ### 循环结构(while) - 格式 ```python while 表达式: 语句块 ``` > 执行流程:当程序执行到while语句时,首先判断表达式的真假.若表达式的值为 ...

  10. POJ1144(割点入门题)

    Network Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 11378   Accepted: 5285 Descript ...