Announcement

Collapse
No announcement yet.

Custom Control - Value does not fall within the expected range.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom Control - Value does not fall within the expected range.

    Hi @all,

    ich hab mir ein customcontrol gemacht, welches von TabPage erbt. will ich diesen tab nun zu einem tabcontrol hinzufügen wird die im titel beschriebene Argumentexception geworfen.

    das ist der custom tab

    Code:
     public partial class TabPageEx : Control
        {
            private int startx = 10;
            private int starty = 10;
            private int offsety = 30;
    
            public TabPageEx()
            {
                InitializeComponent();
            }
    
            public void populate(Patient patient)
            {
                int lblcounter = 0;
    
                foreach (CareMeasure measure in patient.Measures)
                {
                    Label lbl = new Label();
                    lbl.Dock = DockStyle.Fill;
                    lbl.Text = measure.Time.ToShortTimeString();
                    lbl.Location = new Point(startx, starty + offsety * lblcounter);
    
                    lblcounter++;
                }
            }
    
            public void reset()
            {
                this.Controls.Clear();
            }
    
            protected override void OnPaint(PaintEventArgs pe)
            {
                base.OnPaint(pe);
            }
        }
    und so füge ich den tab dem tabcontrol hinzu:

    Code:
    private CuraPocket.UI.CustomControl.TabPageEx TAB_MEASURES;
    this.TAB_TEST = new CuraPocket.UI.CustomControl.TabPageEx();
    this.TAB_TEST.Location = new System.Drawing.Point(0, 0);
    this.TAB_TEST.Name = "TAB_TEST";
    this.TAB_TEST.Size = new System.Drawing.Size(240, 203);
    this.TAB_TEST.Text = "test";
    this.TC_MAINTABCONTROL.Controls.Add(this.TAB_MEASURES);
    danke wie immer im vorraus ^^

    mfg daniel

  • #2
    Ok, ich sollte so späte nichmehr programmieren ^^ .. nachdem ich mir meine beitrag nochmal durchgelesen hatte, is mir aufgefallen das ich mein customtab nich von Tabpage erben lassen -.- ^^..

    Comment

    Working...
    X