Custom Component Collection (Collection Class)

Source: Internet
Author: User

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
Using System.Windows.Forms;
using System.Drawing;
using System.ComponentModel;
using System.ComponentModel.Design;
using Mylib;
Namespace Mylib
{
Class Dynamics: Label
{
Private list<typedfilter> _filters = new List<t Ypedfilter> ();

[Category ("Businessobjectcontrol")]
[DesignerSerializationVisibility (Designerserializationvisibilit y.content)]
[Editor (typeof (Filtercollectioneditor), typeof (System.Drawing.Design.UITypeEditor))]
Public L Ist<typedfilter> Filters
{
get {return _filters;}
Set {_filters = value;}     
}
}

public class Typedfilter
{
private string _datapropertyname = ' Name ';
public string DataPropertyName The
{
get {_datapropertyname;}
Set {_datapropertyname = VALue     
}

Private int _value = 0;
public int Value
{
get {_value;}
Set {_value = value;}
}

public override string ToString ()
{
return _datapropertyname + ' = ' + _value. ToString ();
}
}

class Filtercollectioneditor:collectioneditor
{
Public Filtercollectionedito R (Type type)
: Base (Type)
{
}
}

Can actually achieve a simple collection class ... Or a lot of places are not enough,,, if you are fortunate to encounter experts also hope to help answer ...

1. The above examples can only produce local variables. It doesn't produce a global. How can i solve

Can I generate, I want variables, such as local, or global ...

2.public class Typedfilter:control The result is that after the control is deleted, the variable is not deleted

The above code is expected to help you, especially in doing this.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.