示例#1
0
        /// <summary>
        /// Change the number of elements in our LED array. This destroys
        /// the previous elements, and creates new ones in their place, applying
        /// all the current options to the new ones.
        /// </summary>
        /// <param name="count">Number of elements to create.</param>
        public void RecreateSegments(int count)
        {
            if (segments != null)
            {
                for (int i = 0; i < segments.Length; i++)
                {
                    segments[i].Parent = null; segments[i].Dispose();
                }
            }

            if (count <= 0)
            {
                return;
            }
            segments = new SevenSegment[count];

            for (int i = 0; i < count; i++)
            {
                segments[i]            = new SevenSegment();
                segments[i].Parent     = this;
                segments[i].Top        = 0;
                segments[i].gridHeight = this.Height - elementPadding.Vertical;
                segments[i].Height     = this.Height;
                segments[i].Anchor     = AnchorStyles.Top | AnchorStyles.Bottom;
                segments[i].Visible    = true;
            }

            ResizeSegments(true);
            UpdateSegments();
            this.Value = theValue;
        }
示例#2
0
        /// <summary>
        /// Change the number of elements in our LED array. This destroys
        /// the previous elements, and creates new ones in their place, applying
        /// all the current options to the new ones.
        /// </summary>
        /// <param name="count">Number of elements to create.</param>
        public void RecreateSegments(int count)
        {
            if (segments != null)
                for (int i = 0; i < segments.Length; i++) { segments[i].Parent = null; segments[i].Dispose(); }

            if (count <= 0) return;
            segments = new SevenSegment[count];

            for (int i = 0; i < count; i++)
            {
                segments[i] = new SevenSegment();
                segments[i].Parent = this;
                segments[i].Top = 0;
                segments[i].gridHeight = this.Height - elementPadding.Vertical;
                segments[i].Height = this.Height;
                segments[i].Anchor = AnchorStyles.Top | AnchorStyles.Bottom;
                segments[i].Visible = true;
            }

            ResizeSegments(true);
            UpdateSegments();
            this.Value = theValue;
        }