日期:2014-05-20  浏览次数:20805 次

C#封装WinForm控件遇到的问题

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Windows.Forms;
using System.Drawing;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Reflection;
using System.Windows.Forms.Design;
using System.Drawing.Design;

namespace CommonControl
{
    public class MyListControl : Control
    {
        public MyListControl()
        {

        }

        private MlyScope scopes = new MlyScope(0, 0);

        [Browsable(true)]
        public MlyScope Scopes
        {
            get { return scopes; }
            set { scopes = value; }
        }

    }
    [TypeConverter(typeof(MlyScopeConverter))]
    public class MlyScope
    {
        private Int32 _min;
        private Int32 _max;

        public MlyScope()
        {
        }

        public MlyScope(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