WinForm Control Development Summary (v) provide a type converter for complex properties of a control

Source: Internet
Author: User
Tags min

I have already introduced the role of TypeConverterAttribute metadata in the previous article, this article will show you the concrete implementation through the code. In this case, I'm going to add a complex attribute to the control that has no function for the control, purely for demonstration purposes, and somewhat far-fetched.

Now add a scope property to the control code that you created in the previous article:

[Browsable (True)]

Public scope scope

{

get

{return

_scope;

}

set

{

_scope = value;

}

}

The type of this property is the scope class, and the code is as follows:

public class Scope

{

private Int32 _min;

Private Int32 _max;


Public scope ()

{

} public

scope (Int32 min, Int32 max)

{

_min = min            ;

_max = max;

[Browsable (true)] public

Int32 Min

{get

{
  
    return _min;

}

set

{

_min = value;

}

[Browsable (true)] public

Int32 Max

{

get            {return

_max;

}

set

{

_max = value;

}

}


  

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.