蓝桥之魂

Created by ZHU, Henry Cijun

导航

实现RadioButtonList自定义WinForm控件

目的:项目有需要,创建一个支持数据绑定的单选按钮列表。
设想:动态识别多种数据源, 动态生成一定数量的按钮。
准备:创建一个自定义控件,添加一个Panel对象。
优点: 支持多种数据源做绑定,并可以自己添加自定义数据源。
缺点:错误的抛出没有做到位,没有完全做到设计时定义所有数据。原因:懒。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Collections;

namespace RVProject
{
    
public partial class RadioButtonList : UserControl
    
{
        
Variable
        
        
ctor.
        
        
prop

        
event

        
public method

        
//Internal Function
        internal function

        
internal struct ButtonValueMapping
        
{
            
public int Index;
            
public string Value;
            
public string Text;
        }


        
public class SelectedEventArgs : EventArgs
        
{
            
public string Value;
        }

    }

}

posted on 2008-06-06 20:14  Henry Zhu  阅读(3209)  评论(2编辑  收藏  举报