从右到左TListView [英] Right to left TListView
问题描述
我正在编程一个tlistview,以便它从右到左显示其列(以便正确显示希伯来语文本)。我在表单的create方法中使用以下代码,其中 lv是列表视图
I am programming a tlistview so that it displays its columns from right to left (so as to properly display Hebrew text). I am using the following code in the form's create method, where 'lv' is the listview
SetWindowLong (lv.Handle, GWL_EXSTYLE,
GetWindowLong(lv.Handle, GWL_EXSTYLE) or
WS_EX_LAYOUTRTL or WS_EX_NOINHERITLAYOUT);
lv.invalidate;
虽然此代码使列表视图中的行正确显示,但标题行从左到右显示!列不匹配,每列的标题是错误的。
Whilst this code makes the lines in the listview display correctly, the header line displays from left to right! The columns don't match up and the heading for each column is wrong.
有人知道如何使标题行从右向左显示吗?
Does anyone have an idea how to get the header line to display right to left?
我正在使用Delphi 7,并不是说应该有很大的不同。
I am using Delphi 7, not that this should make much difference.
TIA,
否' am
TIA, No'am
推荐答案
下面是设置标头和行的完整代码:
Here is the full code to set the header and the lines:
procedure TForm1.FormCreate(Sender: TObject);
const
LVM_FIRST = $1000; // ListView messages
LVM_GETHEADER = LVM_FIRST + 31;
var
header: thandle;
begin
header:= SendMessage (lv.Handle, LVM_GETHEADER, 0, 0);
SetWindowLong (header, GWL_EXSTYLE,
GetWindowLong (header, GWL_EXSTYLE) or
WS_EX_LAYOUTRTL or WS_EX_NOINHERITLAYOUT);
SetWindowLong (lv.Handle, GWL_EXSTYLE,
GetWindowLong (lv.Handle, GWL_EXSTYLE) or
WS_EX_LAYOUTRTL or WS_EX_NOINHERITLAYOUT);
lv.invalidate; // get the list view to display right to left
end;
这篇关于从右到左TListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!