得到的TListView选定行的屏幕坐标 [英] Get screen coordinates of selected row in TListView

查看:260
本文介绍了得到的TListView选定行的屏幕坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个TListView的(实际上,定制的后裔)在ViewStyle显示 vsReport 。一个行被选中。我想获得该行(或该行内的单元格)的屏幕坐标。有没有办法为我做到这一点?

I have a TListView (actually, a custom descendant) display in ViewStyle vsReport. One row is selected. I would like to get the screen coordinates of that row (or a cell within that row). Is there any way for me to do this?

(我的目标是显示一个小表格在列表视图给它的下降,从选定行向下的影响)。

(My goal is to display a small form over the list view giving the effect that it dropped down from the selected row).

我使用德尔福2010年这个特殊的应用。

I am using Delphi 2010 for this particular application.

推荐答案

有关列表视图中的 vsReport 风格,我相信最好的办法就是使用的 LVM_GETITEMRECT LVM_GETSUBITEMRECT 消息。

For a list view in vsReport style I believe the best approach is to use the LVM_GETITEMRECT and LVM_GETSUBITEMRECT messages.

该VCL不会环绕此功能为你,但它不应该太难以从MSDN文档做得出来。

The VCL does not wrap this functionality up for you but it should not be too difficult to work it out from the MSDN docs.

虽然它是使用由VCL暴露了 TListItem.Position 属性很简单,据我可以告诉这并不能帮助您获得行高或确的子项的坐标。

Whilst it is very simple to use the TListItem.Position property exposed by the VCL, as far as I can tell this does not help you obtain the row height or indeed the coordinates of sub items.

更新

由于NGLN非常有益指出,CommCtrl单位不公开的 ListView_GetItemRect 和的 ListView_GetSubItemRect 它比上面相应的Windows消息,使用更方便。

As NGLN very helpfully points out, the CommCtrl unit does expose ListView_GetItemRect and ListView_GetSubItemRect which are more convenient to use than the equivalent Windows messages above.

这篇关于得到的TListView选定行的屏幕坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆