Exemplo n.º 1
0
        public void RemoveAt(int index)
        {
            TableRow row = this [index] as TableRow;

            if (row != null)
            {
                row.Container = null;
            }

            cc.RemoveAt(index);
        }
Exemplo n.º 2
0
        public void RemoveAt(int index)
        {
#if NET_2_0
            TableRow row = this [index] as TableRow;
            if (row != null)
            {
                row.Container = null;
            }
#endif

            cc.RemoveAt(index);
        }
        /// <summary>
        /// Removes the given split control from the panel's collection.
        /// </summary>
        public void Remove(SplitControl control)
        {
            int index = splitControls.IndexOf(control);

            splitControls.RemoveAt(index);

            if (splitControls.Count > 0)
            {
                for (int i = index; i < splitControls.Count; i++)
                {
                    SplitControl toMove = (SplitControl)splitControls[i];
                    toMove.Location = toMove.Location.Subtract(spacing);
                    toMove.Index    = i + 1;
                }

                if (index == 0)
                {
                    ((SplitControl)splitControls[index]).ToggleUp(false);
                }

                if (index == splitControls.Count)
                {
                    ((SplitControl)splitControls.Last()).ToggleDown(false);
                }
            }

            UpdateCountLabel();
            SaveSplits(false);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Moves controls from one control collection to the other.
        /// </summary>
        /// <param name="source">Source control collection. Will be
        /// emptied.</param>
        /// <param name="target">Target collection to be filled.</param>
        public static void MoveControls(ControlCollection source, ControlCollection target)
        {
            int count = source.Count;

            for (int i = 0; i < count; i++)
            {
                Control ctrl = source[0];
                source.RemoveAt(0);
                target.Add(ctrl);
            }
        }
Exemplo n.º 5
0
        public void handleMiddleCell()
        {
            int max   = Math.Max(leftControl.Count, rightControl.Count);
            int count = midControl.Count;

            for (int i = count; i < max; i++)
            {
                MiddleCell mc = new MiddleCell(lco);
                midControl.Add(mc);
            }

            for (int i = max; i < count; i++)
            {
                midControl.RemoveAt(0);
            }
        }
Exemplo n.º 6
0
        private static void SmartInsert(this ControlCollection originalCollection, int index, Control newControl)
        {
            Control tempControl = new Control();

            // Save collection contents until next index is the new control
            while (originalCollection.Count > index)
            {
                tempControl.Controls.Add(originalCollection[originalCollection.Count - 1]);
                originalCollection.RemoveAt(originalCollection.Count - 1);
            }

            // Add control
            originalCollection.Add(newControl);

            // Add old list contents
            while (tempControl.Controls.Count > 0)
            {
                originalCollection.Add(tempControl.Controls[tempControl.Controls.Count - 1]);
                tempControl.Controls.RemoveAt(tempControl.Controls.Count - 1);
            }
        }
Exemplo n.º 7
0
        private static void BasicInsert(this ControlCollection originalCollection, int index, Control newControl)
        {
            int     i           = 0;
            Control tempControl = new Control();

            // Loop through original collection until point at which index is to be added
            while (originalCollection.Count > 0)
            {
                // Inserts the new control if currently at the desired index
                if (i == index)
                {
                    tempControl.Controls.Add(newControl);
                }
                tempControl.Controls.Add(originalCollection[0]);
                originalCollection.RemoveAt(0);
                i++;
            }

            // Finally add modified collection
            originalCollection.AddRange(tempControl.Controls.ToArray());
        }
Exemplo n.º 8
0
        public void Deny_Unrestricted()
        {
            // note: using the same control (as owner) to add results
            // in killing the ms runtime with a stackoverflow - FDBK36722
            ControlCollection cc = new ControlCollection(new Control());

            Assert.AreEqual(0, cc.Count, "Count");
            Assert.IsFalse(cc.IsReadOnly, "IsReadOnly");
            Assert.IsFalse(cc.IsSynchronized, "IsSynchronized");
            Assert.IsNotNull(cc.SyncRoot, "SyncRoot");

            cc.Add(control);
            Assert.IsNotNull(cc[0], "this[int]");
            cc.Clear();
            cc.AddAt(0, control);
            Assert.IsTrue(cc.Contains(control), "Contains");

            cc.CopyTo(new Control[1], 0);
            Assert.IsNotNull(cc.GetEnumerator(), "GetEnumerator");
            Assert.AreEqual(0, cc.IndexOf(control), "IndexOf");
            cc.RemoveAt(0);
            cc.Remove(control);
        }
Exemplo n.º 9
0
 public void RemoveAt(int index)
 {
     ChildList.RemoveAt(index);
 }
Exemplo n.º 10
0
        /// <summary>
        /// This is called to force the control to refresh the radio buttons with information from the data
        /// source.
        /// </summary>
        public override void RefreshSubControls()
        {
            Panel       bp = this.ButtonPanel;
            RadioButton rb;
            int         imageIdx = 0;

            ControlCollection cc             = bp.Controls;
            EventHandler      CheckedChanged = RadioButton_CheckedChanged;

            // Dispose of any prior radio buttons
            while (cc.Count > 0)
            {
                rb = (RadioButton)cc[0];
                rb.CheckedChanged -= CheckedChanged;
                cc.RemoveAt(0);
                rb.Dispose();
            }

            foreach (object oItem in this.Items)
            {
                rb = new RadioButton();

                // In .NET 2.0, we could use the UseMnemonic property but it doesn't work with FlatStyle.System
                // so we'll modify the text which works with it and with .NET 1.1.
                if (this.UseMnemonic)
                {
                    rb.Text = this.GetItemText(oItem).Replace("&&", "&");
                }
                else
                {
                    rb.Text = this.GetItemText(oItem).Replace("&", "&&");
                }

                rb.Appearance = base.Appearance;
                rb.FlatStyle  = this.FlatStyle;
                rb.CheckAlign = base.CheckAlign;
                rb.TextAlign  = base.TextAlign;
                rb.ImageAlign = base.ImageAlign;
                rb.ImageList  = base.ImageList;

                // Don't hook up the event in design mode.  They are clickable.
                if (!this.DesignMode)
                {
                    rb.CheckedChanged += CheckedChanged;
                }

                if (base.ImageList != null)
                {
                    rb.ImageIndex = imageIdx;
                    imageIdx++;

                    // Wrap the index if there are more items than images
                    if (imageIdx == base.ImageList.Images.Count)
                    {
                        imageIdx = 0;
                    }
                }

                bp.Controls.Add(rb);
            }

            // Restore the currently selected item if necessary
            if (this.SelectedIndex != -1 && this.SelectedIndex < bp.Controls.Count)
            {
                ((RadioButton)bp.Controls[this.SelectedIndex]).Checked = true;
            }

            base.RefreshSubControls();
            this.PerformLayout();
        }
Exemplo n.º 11
0
        //=====================================================================

        /// <summary>
        /// This is called to force the control to refresh the checkboxes with information from the data source
        /// </summary>
        /// <exception cref="InvalidOperationException">This is thrown if a <see cref="BindingMembersDataSource"/>
        /// has been specified and there are more checkbox list items that members specified in
        /// <see cref="BindingMembers"/>.</exception>
        public override void RefreshSubControls()
        {
            Panel    bp = this.ButtonPanel;
            Binding  b;
            CheckBox cb;

            CheckState[] states;
            int          idx = 0, imageIdx = 0, memberIdx = 0;

            ControlCollection cc = bp.Controls;

            states = new CheckState[cc.Count];

            // Dispose of any prior checkboxes
            while (cc.Count > 0)
            {
                cb                    = (CheckBox)cc[0];
                states[idx]           = cb.CheckState;
                cb.Enter             -= CheckBox_Enter;
                cb.CheckStateChanged -= CheckBox_CheckStateChanged;
                cc.RemoveAt(0);
                cb.Dispose();
                idx++;
            }

            idx = 0;

            foreach (object oItem in this.Items)
            {
                cb = new CheckBox();

                // In .NET 2.0, we could use the UseMnemonic property but it doesn't work with FlatStyle.System
                // so we'll modify the text which works with it and with .NET 1.1.
                if (this.UseMnemonic)
                {
                    cb.Text = this.GetItemText(oItem).Replace("&&", "&");
                }
                else
                {
                    cb.Text = this.GetItemText(oItem).Replace("&", "&&");
                }

                cb.Appearance = base.Appearance;
                cb.FlatStyle  = this.FlatStyle;
                cb.ThreeState = threeState;
                cb.CheckAlign = base.CheckAlign;
                cb.TextAlign  = base.TextAlign;
                cb.ImageAlign = base.ImageAlign;
                cb.ImageList  = base.ImageList;

                // Don't hook up the event in design mode.  They are clickable.  We'll also skip hooking up the
                // data bindings.
                if (!this.DesignMode)
                {
                    cb.Enter             += CheckBox_Enter;
                    cb.CheckStateChanged += CheckBox_CheckStateChanged;

                    // If we have a data source and available members, bind the checkbox's CheckState to the
                    // member.
                    if (bindingDataSource != null)
                    {
                        if (memberIdx < bindingMembers.Count)
                        {
                            if (bindingContext != null)
                            {
                                cb.BindingContext = bindingContext;
                            }

                            b         = new Binding("CheckState", bindingDataSource, bindingMembers[memberIdx]);
                            b.Format += BindingMember_Format;
                            b.Parse  += BindingMember_Parse;
                            cb.DataBindings.Add(b);
                            memberIdx++;
                        }
                        else
                        {
                            throw new InvalidOperationException(LR.GetString("ExTooFewBindingMembers"));
                        }
                    }
                }

                if (base.ImageList != null)
                {
                    cb.ImageIndex = imageIdx;
                    imageIdx++;

                    // Wrap the index if there are more items than images
                    if (imageIdx == base.ImageList.Images.Count)
                    {
                        imageIdx = 0;
                    }
                }

                // Restore the state if necessary
                if (this.SelectedIndex != -1 && idx < states.Length)
                {
                    cb.CheckState = states[idx];
                }

                bp.Controls.Add(cb);
                idx++;
            }

            base.RefreshSubControls();
            this.PerformLayout();
        }
Exemplo n.º 12
0
 public void deleteCell(L_ListCell lc)
 {
     leftNameControl.RemoveAt(leftNameControl.Count - 1);
     leftControl.Remove(lc);
     handleMiddleCell();
 }
Exemplo n.º 13
0
 /// <summary>
 /// Replaces a specific index in a control collection
 /// </summary>
 /// <param name="originalCollection">The collection that is being modified</param>
 /// <param name="indexToReplace">The index to be replaced</param>
 /// <param name="newControl">The new control to replace the old control</param>
 public static void Replace(this ControlCollection originalCollection, int indexToReplace, Control newControl)
 {
     originalCollection.Insert(indexToReplace, newControl);
     originalCollection.RemoveAt(indexToReplace + 1);
 }
 public void RemoveAt(int index)
 {
     cc.RemoveAt(index);
 }
Exemplo n.º 15
0
 public void RemoveAt(int index)
 {
     controls.RemoveAt(index);
     Owner.UpdateSort();
 }
Exemplo n.º 16
0
 public void RemoveThumb(Thumb newThumb)
 {
     myControls.RemoveAt(myControls.GetChildIndex(newThumb));
     UpdateGridView();
 }