调整列表列大小时出现 HDN_ENDTRACK 问题
在处理派生自 CListCtrl 的自定义类的 HDN_ENDTRACKW 消息时,我遇到了一些问题。
本质上,似乎当发送此消息时,存储列宽度的实际值直到执行我的处理代码后才会更新。
句柄内的代码只是指示进度条调整大小,以填充调整大小的列的宽度。 代码:
void ProgListCtrl::OnEndTrack(NMHDR* pNMHDR, LRESULT* pResult)
{
int width = ListView_GetColumnWidth(GetSafeHwnd(), m_nProgressColumn);
ResizeProgressbar();
}
ListView_GetColumnWidth 只是为了帮助目前的调试。
我要更改的特定列的默认值是 150,当我在 UI 中调整列大小时,会调用此方法,但宽度保持在 150 不变,进度条不会调整大小。仅当再次调整列大小时,宽度值现在才会反映第一次调整大小后的列值,ResizeProgressBar 方法然后正确更改 progbar 大小以填充其所在的列。这是连续的,宽度值似乎总是比实际值落后一步。
我将不胜感激任何帮助。干杯。
I am having a bit of a problem when handling a HDN_ENDTRACKW message for a custom class which derives from CListCtrl .
Essentially, it seem that when this message is sent, the actual value which stores the width of the column is not updated until after my handling code has been executed.
The code inside the handle simply instructs a progress bar to resize, to fill the width of the resized column.
The code:
void ProgListCtrl::OnEndTrack(NMHDR* pNMHDR, LRESULT* pResult)
{
int width = ListView_GetColumnWidth(GetSafeHwnd(), m_nProgressColumn);
ResizeProgressbar();
}
The ListView_GetColumnWidth is there just to help with debugging at the moment.
The default value for the particular column I am changing is 150, when i resize the column in the UI, this method is called but the width stays at the same 150, the progress bar does not resize. Only when a column is resized again does the width value now reflect the value of the column after the first resize, the ResizeProgressBar method then correctly changes the progbar size to fill the column it is in. This is continuous, the width value always seems to be one step behind the actual value.
I would apreciate any help. Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
HDN_ENDTRACK
本身向您提供的信息,即:或者,查看
HDN_ITEMCHANGING
和HDN_ITEMCHANGED
通知,而不是HDN_ENDTRACK
代码>.Use the information that
HDN_ENDTRACK
itself provides to you, ie:Alternatively, look at the
HDN_ITEMCHANGING
andHDN_ITEMCHANGED
notifications instead ofHDN_ENDTRACK
.