listview控件标题加CheckBox

时间:2021-06-14 19:35:16

窗口load:

listViewLayersName.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
listViewLayersName.View = System.Windows.Forms.View.Details;
ColumnHeader clh = new ColumnHeader();
clh.Width = listViewLayersName.Width;
clh.Text = "图层名称";
listViewLayersName.Columns.Add(clh);
listViewLayersName.HeaderStyle = ColumnHeaderStyle.Clickable;
listViewLayersName.CheckBoxes = true;
listViewLayersName.OwnerDraw = true;

详见:

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/d1af317c-35f9-4293-a1fb-c39b7601b55c/how-to-access-listview-check-box-in-header-in-code-c?forum=winforms

C# winform项目中ListView控件使用CheckBoxes属性实现单选功能

https://blog.csdn.net/blacet/article/details/25737167