I know that there are available Properties
for ListView to change the common styles but I just want to test this. That is for example the View = View.LargeIcon
applies the style LVS_ICON = 0
to the ListView
or GridLines = true
applies the style LVS_EX_GRIDLINES = 1
to the ListView
. I would like to test with CreateParams
. I think using GetWindowLong
and SetWindowLong
Win32 functions would be OK, but for convenience, as far as I know, CreateParams
can change the style of a control. But this time with a ListView
, I can't make it work, it has no effect at all, I wonder if ListView
is a special case?. Here is my code:
public class CustomListView : ListView {
protected override CreateParams CreateParams {
get {
CreateParams cp = base.CreateParams;
cp.Style |= 3; //Apply LVS_LIST (View as List)
return cp;
}
}
}
Only LVS_EX_GRIDLINES = 1
makes some effect but the effect is not Grid lines are drawn on the ListView
but the Border becomes thicker and looks like 3D-border
. That's strange, most of other applies have not effect at all.
Could you explain it or at least give me some example which works? Again please don't give me any solution or code which uses GetWindowLong
and SetWindowLong
, just use CreateParams
.
Thanks!