HeaderPane
Main
Hide
Share Link
Print

FillFontSizes Method, SftBox Class

Fills the list with the usual sizes of a font family.

Class: SftBox
Namespace: Softelvdm.SftBoxNET
Assembly: Softelvdm.SftBoxNET

Syntax

public void FillFontSizes( FontFamily family );
Public Sub FillFontSizes( ByVal family As FontFamily )

Parameters

family

The font family.

Comments

Fills the list with the usual sizes of a font family.

The list is cleared first and holds the sizes from 8 to 72 points that word processors offer. Each item's ItemClass.DataItem is the size in points (a float).

Examples

C# View entire sample code

        }

        // The sizes follow the chosen font; the preview shows the font at the chosen or typed size.
        private void sftBox3_SelectedItemChanged(object sender, EventArgs e) {
            FontFamily family = sftBox3.SelectedValue as FontFamily;
            if (family == null)
                return;
            string size = sftBox4.Text;
            sftBox4.FillFontSizes(family);
            sftBox4.Text = size.Length > 0 ? size : "12";
            UpdatePreview();
        }

        private void sftBox4_SelectedItemChanged(object sender, EventArgs e) {
            UpdatePreview();
        }

VB.NET View entire sample code

        combo.SelectedItem = current
    End Sub

    ' The sizes follow the chosen font; the preview shows the font at the chosen or typed size.
    Private Sub SftBox3_SelectedItemChanged(ByVal sender As Object, ByVal e As EventArgs) Handles SftBox3.SelectedItemChanged
        Dim family As FontFamily = TryCast(SftBox3.SelectedValue, FontFamily)
        If family Is Nothing Then Return
        Dim size As String = SftBox4.Text
        SftBox4.FillFontSizes(family)
        SftBox4.Text = If(size.Length > 0, size, "12")
        UpdatePreview()
    End Sub

    Private Sub SftBox4_SelectedItemChanged(ByVal sender As Object, ByVal e As EventArgs) Handles SftBox4.SelectedItemChanged
        UpdatePreview()
    End Sub

See Also SftBox Class | Classes | SftBox/NET 3.0