//カスタムコントロール
public class CustomControl1 : System.Windows.Forms.Control {
//略
SingleCollection sc = new SingleCollection();
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public SingleCollection Singles {
get {
return sc;
}
}
}
//コレクション
public class SingleCollection : CollectionBase {
public Single this[int i] {
get { return (Single)(base.List[i]);}
set { base.List[i] = value; }
}
public void Add(Single value) { List.Add(value); }
public void AddRange(Single[] values) {
for (int i = values.GetLowerBound(0); i <= values.GetUpperBound(0); i++) { List.Add(values[i]); }
}
public void Remove(Single value) { List.Remove(value); }
public void IndexOf(Single value) { List.IndexOf(value); }
public void Insert(int index, Single value) { List.Insert(index, value); }
public bool Contains(Single value) { return List.Contains(value); }
public void CopyTo(Array array, int index) { base.InnerList.CopyTo(array, index); }
}
//フォーム
public class Form1 : System.Windows.Forms.Form
{
//略
private void InitializeComponent()
{
this.customControl11 = new GraphControl.CustomControl1();
this.SuspendLayout();
//
// customControl11
//
this.customControl11.Location = new System.Drawing.Point(0, 0);
this.customControl11.Name = "customControl11";
//この辺でエラーがでているっぽい
this.customControl11.Singles.AddRange(new System.Single[] {
1F,
2F});
this.customControl11.Size = new System.Drawing.Size(1, 1);
this.customControl11.TabIndex = 0;
this.customControl11.Text = "customControl11";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 12);
this.ClientSize = new System.Drawing.Size(584, 454);
this.Controls.Add(this.customControl11);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
//略
}
|