公共属性ColumnHeader [英] Public Property ColumnHeader

查看:89
本文介绍了公共属性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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆