zoukankan      html  css  js  c++  java
  • HDN_TRACK and HDS_FULLDRAG

    I'm posting this, because it took me two hours to find the issue.

    I wanted to customize a listview's header control, i.e. changing its behavior when the user resizes a column. According to the MSDN documentation, the header sends following notifications:

    I've had no problem getting HDN_BEGINTRACK and HDN_ENDTRACK. Unfortunately, I didn't receive the HDN_TRACK notification.

    I've found many examples in the internet, which, instead of HDN_TRACK, intercepted the HDN_ITEMCHANGING notification. Well, after some more research, I've found a hint to the header control's style HDS_FULLDRAG, which causes the control to render its content while being resized. If this style is set, no HDN_TRACK notifications are sent. And the System.Windows.Forms.ListView's header has this style by default. That's ok, but what's not ok is that nowhere in the MSDN the relation between HDN_TRACK and HDS_FULLDRAG is documented.

    I hope that if someone stumbles over this issue, Google will refer him to here. It would save him some time.

    Update: I've got a request from Martin Welker, who asked how to remove HDS_FULLDRAG. I've found the article INFO: HDN_TRACK Notifications and Full Window Drag Style in the Microsoft Knowledge Base:

    SUMMARY
    Starting with version 4.70 of ComCtl32.dll, the header control of a list view control in report view (LVS_REPORT) automatically receives the HDS_FULLDRAG style. When this style is set, the parent of a list view control receives HDN_ITEMCHANGING notifications, rather than HDN_TRACK notifications, when the column divider of the header control is dragged. To receive HDN_TRACK notifications, the header control of the list view control must not have the HDS_FULLDRAG style set. Note that the HDS_FULLDRAG style is ignored in versions of ComCtl32.dll prior to 4.70.

    This article also includes some sample code how to remove the HDS_FULLDRAG flag.

  • 相关阅读:
    添加活动记录的小坑
    用windows的批处理文件批量更改文件后缀
    js日期的初始化的格式
    对象的继承
    关于换行字符的问题
    js获取dom对象style样式的值
    判断邮箱是否合法
    Python控制函数运行时间
    如何用python编写一个计时器的程序
    TF-IDF算法介绍及实现
  • 原文地址:https://www.cnblogs.com/csuchao/p/1766996.html
Copyright © 2011-2022 走看看