公共属性ColumnHeader

编程入门 行业动态 更新时间:2024-10-22 20:23:21
本文介绍了公共属性ColumnHeader的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试为自定义组件中的listview框的列设置公共属性,我拥有的代码如下

I am trying to make a public property for the columns of a listview box in a custom component, the code I have is as follows

Public Property Columns() As ListView.ColumnHeaderCollection Get Return ListView1.Columns End Get Set(ByVal value As ListView.ColumnHeaderCollection) 'This event does not seem to trigger End Set End Property

现在,在主窗体中单击属性后,将打开列编辑器,您可以进行更改或添加和删除列,但是当您关闭它时,我找不到将新列存储到组件列表视图的方法.

now when the property is clicked in the main form the columns editor open, you can make changes or add and delete the columns, but when you close it I can''t find the way to store the new columns to my components list view.

推荐答案

您如何将columnheadercollection发送给该类?是这样吗? how are you sending the columnheadercollection to the class? is it something like this? dim x as new customcomponent x.columns = "variable here"

不,我没有将columnheader传递给Component类,这是我要做的,开始一个空白项目,添加一个新的Component类,在该组件上,放置一个列表视图,将其视图更改为详细信息,然后在该组件添加以下代码 Hi, No I am not passing the columnheader to the Component class,this is what I have done, start a blank project, add a new Component class, on the component, place a listview, change its view to details, then in the code window of the component add the following code Public Property Columns() As ListView.ColumnHeaderCollection Get Return ListView1.Columns End Get Set(ByVal value As ListView.ColumnHeaderCollection) 'This event I cant get to trigger to return the changes End Set End Property

现在,如果您添加Windows窗体并编译Component,然后转到该窗体,然后在工具箱中将看到该组件,将该组件添加到该窗体中并转到设置,则在打开时,您将找到Columns设置,它表示collection.该设置并对列进行更改,但我无法对组件进行更改. 我想我会以错误的方式进行操作,但不确定. 谢谢.

Now if you add a windows form and compile the Component then goto the form and in your toolbox you will see the component, add the component to the form and goto the settings, you will find the Columns setting, it says collection, when you open that setting and make changes to the columns I cant get the changes to the component. I think I am going about this the wrong way, but not sure. Thanks.

更多推荐

公共属性ColumnHeader

本文发布于:2023-11-14 00:07:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1585669.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:属性   ColumnHeader

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!