Example #1
0
        /// <summary>
        /// Calculates the size of one character in the current font.
        /// </summary>
        private void UpdateCharacterSize()
        {
            Size size = FontFunctions.MeasureText("W", Font);

            if (!this.IsFixedWidth)
            {
                size.Width = ValuesToVariableWidthTextConverter.CharacterWidth;
            }

            this.characterSize = size;
        }
Example #2
0
        /// <summary>
        /// Handles the DropDown event of the cmbCharacters control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void CmbCharacters_DropDown(object sender, System.EventArgs e)
        {
            int width = this.cmbCharacters.Width;

            foreach (string characters in this.cmbCharacters.Items)
            {
                Size size = FontFunctions.MeasureText(characters + "  ", this.cmbCharacters.Font);

                if (size.Width > width)
                {
                    width = size.Width;
                }
            }

            this.cmbCharacters.DropDownWidth = width;
        }