☆ListViewのヘッダー高さを取得する。
ViewStyleがvsReportの場合のヘッダー高さを取得します。
マクロを使った処理
GetWindowPlacementを使った処理
変数名を変えたり、マクロで処理させていますが、基本的に下記サイトにある処理のままです(^^;
[参考にしたサイト]
delphiDabbler.com
How to use the TListView OnCustomDrawXXX events
http://www.delphidabbler.com/articles?article=16
マクロを使った処理
uses CommCtrl, Types; function GetListViewHeaderHeight(ListView: TListView): Integer; var Header_Handle: THandle; Rect: TRect; begin Result := 0; Header_Handle := LISTVIEW_GETHEADER(ListView.Handle); if (ListView.Columns.Count > 0) then begin Header_GetItemRect(Header_Handle, 0, @Rect); Result := Rect.Bottom - Rect.Top; end; end;
GetWindowPlacementを使った処理
変数名を変えたり、マクロで処理させていますが、基本的に下記サイトにある処理のままです(^^;
uses CommCtrl; // ヘッダーの高さを取得します。 function GetListViewHeaderHeight(ListView: TListView): Integer; var Header_Handle: HWND; WindowPlacement: TWindowPlacement; begin Header_Handle := ListView_GetHeader(ListView.Handle); FillChar(WindowPlacement, SizeOf(WindowPlacement), 0); WindowPlacement.Length := SizeOf(WindowPlacement); GetWindowPlacement(Header_Handle, @WindowPlacement); Result := WindowPlacement.rcNormalPosition.Bottom - WindowPlacement.rcNormalPosition.Top; end;
[参考にしたサイト]
delphiDabbler.com
How to use the TListView OnCustomDrawXXX events
http://www.delphidabbler.com/articles?article=16
| 固定リンク