ラジオボタンとグループ

ファイル名:MyGroup.cs

using System;
using System.Windows.Forms;
using System.ComponentModel;

/// 
/// Summary description for Class1
/// 
public class MyGroup : GroupBox
{
    private RadioButton[] rbtns = new RadioButton[5];
	public MyGroup( System.EventHandler clickEvent ) : base()
	{
		//
		// TODO: Add constructor logic here
		//
        for (int i = 0; i < 5; i++)
        {
            this.rbtns[i] = new RadioButton();
            this.rbtns[i].Dock = DockStyle.Right;
            this.rbtns[i].Click += clickEvent;
            int  num = i + 1;
            this.rbtns[i].Text = num.ToString(); 
        }
        Controls.AddRange( this.rbtns);
	}
    public RadioButton getRadioButton(int i)
    {
        if (i >= 5 || i < 0)
        {
            throw new InvalidEnumArgumentException();
        }
        return this.rbtns[i];
    }

}

ファイル名:MyTabControlWithRadio.cs

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace ABCS
{
    public class MyTabControlWidthRadio : TabControl
    {
        public MyTabControlWidthRadio()
            : base()
        {
            //子タブ追加
            for (int i = 0; i < 5; i++)
            {
                TabPage ctab = new TabPage();
                GroupBox gbox = new MyGroup(this.OnRadioBtnClick);
                gbox.Dock = DockStyle.Top;
                ctab.Controls.Add(gbox);
                this.TabPages.Add(ctab);
            }
            TabPage ctabend = new TabPage();
            Button recbtn = new Button();
            recbtn.Text = "記録";
            recbtn.Dock = DockStyle.Right;
            ctabend.Controls.Add(recbtn);
            this.TabPages.Add(ctabend);

        }

        public void OnRadioBtnClick(object sender, System.EventArgs e)
        {
            int i = base.SelectedIndex;
            
            if (i == 5) i = 0;
            else i++;

            base.SelectedIndex = i;
        }

    }
}