Beispiel #1
0
        /// <summary>
        /// Handles the <see cref="NumericUpDown.ValueChanged"/> event for the "Side Length" <see
        /// cref="NumericUpDown"/> control on the <see cref="StructureTab"/> page.</summary>
        /// <param name="sender">
        /// The <see cref="NumericUpDown"/> control sending the event.</param>
        /// <param name="args">
        /// An <see cref="EventArgs"/> object containing event data.</param>
        /// <remarks>
        /// <b>OnLengthChanged</b> resizes the <see cref="PolygonGrid.Element"/> of the <see
        /// cref="MapGrid"/> to the value of the "Side Length" control, and sets the <see
        /// cref="DataChanged"/> flag if the value has changed.</remarks>

        private void OnLengthChanged(object sender, EventArgs args)
        {
            if (this._ignoreEvents)
            {
                return;
            }

            // get new polygon side length
            double         length  = (float)LengthUpDown.Value;
            RegularPolygon element = MapGrid.Element;

            // create polygon with new side length if changed
            if (length != element.Length)
            {
                this._mapGrid.Element = element.Resize(length);

                // broadcast data changes
                DataChanged = true;
            }
        }