첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
유용한 소스 코드가 있으면 icodebroker@naver.com으로 보내주시면 감사합니다.
블로그 자료는 자유롭게 사용하세요.

■ Window 클래스 : 폰트 대화 상자 만들기 예제

----------------------------------------------------------------------------------------------------

using System.Windows.Controls;

using System.Windows.Media;

 

private TextBox textBox;

 

...

 

FontDialog fontDialog = new FontDialog();

 

fontDialog.Owner = this;

 

fontDialog.Typeface = new Typeface

(

    this.textBox.FontFamily,

    this.textBox.FontStyle,

    this.textBox.FontWeight,

    this.textBox.FontStretch

);

 

fontDialog.FaceSize = this.textBox.FontSize;

 

if(fontDialog.ShowDialog().GetValueOrDefault())

{

    this.textBox.FontFamily  = fontDialog.Typeface.FontFamily;

    this.textBox.FontSize    = fontDialog.FaceSize;

    this.textBox.FontStyle   = fontDialog.Typeface.Style;

    this.textBox.FontWeight  = fontDialog.Typeface.Weight;

    this.textBox.FontStretch = fontDialog.Typeface.Stretch;

}

----------------------------------------------------------------------------------------------------

 

■ Window 클래스 : 폰트 대화 상자 만들기

----------------------------------------------------------------------------------------------------

using System;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Media;

 

/// <summary>

/// 폰트 대화 상자

/// </summary>

public class FontDialog : Window

{

    //////////////////////////////////////////////////////////////////////////////////////////////////// Field

    ////////////////////////////////////////////////////////////////////////////////////////// Private

 

    #region Field

 

    /// <summary>

    /// 폰트 패밀리 텍스트 리스트 컨트롤

    /// </summary>

    private TextListControl fontFamilyTextListControl;

 

    /// <summary>

    /// 폰트 스타일 텍스트 리스트 컨트롤

    /// </summary>

    private TextListControl fontStyleTextListControl;

 

    /// <summary>

    /// 폰트 웨이트 텍스트 리스트 컨트롤

    /// </summary>

    private TextListControl fontWeightTextListControl;

 

    /// <summary>

    /// 폰트 스트레치 텍스트 리스트 컨트롤

    /// </summary>

    private TextListControl fontStretchTextListControl;

 

    /// <summary>

    /// 폰트 크기 텍스트 리스트 컨트롤

    /// </summary>

    private TextListControl fontSizeTextListControl;

 

    /// <summary>

    /// 디스플레이 레이블

    /// </summary>

    private Label displayLabel;

 

    /// <summary>

    /// 업데이트 금지 여부

    /// </summary>

    private bool isUpdateSuppressed = true;

 

    #endregion

 

    //////////////////////////////////////////////////////////////////////////////////////////////////// Property

    ////////////////////////////////////////////////////////////////////////////////////////// Public

 

    #region 타입 페이스 - Typeface

 

    /// <summary>

    /// 타입 페이스

    /// </summary>

    public Typeface Typeface

    {

        get

        {

            return new Typeface

            (

                (FontFamily)this.fontFamilyTextListControl.SelectedItem,

                (FontStyle)this.fontStyleTextListControl.SelectedItem,

                (FontWeight)this.fontWeightTextListControl.SelectedItem,

                (FontStretch)this.fontStretchTextListControl.SelectedItem

            );

        }

        set

        {

            if(this.fontFamilyTextListControl.Contains(value.FontFamily))

            {

                this.fontFamilyTextListControl.SelectedItem  = value.FontFamily;

            }

            else

            {

                this.fontFamilyTextListControl.SelectedIndex = 0;

            }

 

            if(this.fontStyleTextListControl.Contains(value.Style))

            {

                this.fontStyleTextListControl.SelectedItem  = value.Style;

            }

            else

            {

                this.fontStyleTextListControl.SelectedIndex = 0;

            }

 

            if(this.fontWeightTextListControl.Contains(value.Weight))

            {

                this.fontWeightTextListControl.SelectedItem  = value.Weight;

            }

            else

            {

                this.fontWeightTextListControl.SelectedIndex = 0;

            }

 

            if(this.fontStretchTextListControl.Contains(value.Stretch))

            {

                this.fontStretchTextListControl.SelectedItem  = value.Stretch;

            }

            else

            {

                this.fontStretchTextListControl.SelectedIndex = 0;

            }

        }

    }

 

    #endregion

 

    #region 폰트 크기 - FaceSize

 

    /// <summary>

    /// 폰트 크기

    /// </summary>

    public double FaceSize

    {

        get

        {

            double size;

 

            if(!Double.TryParse(this.fontSizeTextListControl.Text, out size))

            {

                size = 8.25d;

            }

 

            return size / 0.75d;

        }

        set

        {

            double size = 0.75d * value;

 

            this.fontSizeTextListControl.Text = size.ToString();

 

            if(!this.fontSizeTextListControl.Contains(size))

            {

                this.fontSizeTextListControl.Insert(0, size);

            }

 

            this.fontSizeTextListControl.SelectedItem = size;

        }

    }

 

    #endregion

 

    //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor

    ////////////////////////////////////////////////////////////////////////////////////////// Public

 

    #region 생성자 - FontDialog()

 

    /// <summary>

    /// 생성자

    /// </summary>

    public FontDialog()

    {

        ShowInTaskbar         = false;

        WindowStyle           = WindowStyle.ToolWindow;

        WindowStartupLocation = WindowStartupLocation.CenterOwner;

        SizeToContent         = SizeToContent.WidthAndHeight;

        ResizeMode            = ResizeMode.NoResize;

        FontFamily            = new FontFamily("맑은 고딕");

        FontSize              = 16d;

        Title                 = "폰트";

 

 

        Grid layoutGrid = new Grid();

 

        layoutGrid.Margin = new Thickness(10);

 

        Content = layoutGrid;

 

 

        #region 레이아웃 행 1 정의

 

        RowDefinition layourRowDefinition1 = new RowDefinition();

 

        layourRowDefinition1.Height = new GridLength(200, GridUnitType.Pixel);

 

        layoutGrid.RowDefinitions.Add(layourRowDefinition1);

 

        #endregion

 

        #region 레이아웃 행 2 정의

 

        RowDefinition layourRowDefinition2 = new RowDefinition();

 

        layourRowDefinition2.Height = new GridLength(10, GridUnitType.Pixel);

 

        layoutGrid.RowDefinitions.Add(layourRowDefinition2);

 

        #endregion

 

        #region 레이아웃 행 3 정의

 

        RowDefinition layourRowDefinition3 = new RowDefinition();

 

        layourRowDefinition3.Height = new GridLength(150, GridUnitType.Pixel);

 

        layoutGrid.RowDefinitions.Add(layourRowDefinition3);

 

        #endregion

 

        #region 레이아웃 행 4 정의

 

        RowDefinition layourRowDefinition4 = new RowDefinition();

 

        layourRowDefinition4.Height = new GridLength(10, GridUnitType.Pixel);

 

        layoutGrid.RowDefinitions.Add(layourRowDefinition4);

 

        #endregion

 

        #region 레이아웃 행 5 정의

 

        RowDefinition layourRowDefinition5 = new RowDefinition();

 

        layourRowDefinition5.Height = GridLength.Auto;

 

        layoutGrid.RowDefinitions.Add(layourRowDefinition5);

 

        #endregion

 

        #region 레이아웃 열 정의

 

        ColumnDefinition layoutColumnDefinition = new ColumnDefinition();

 

        layoutColumnDefinition.Width = new GridLength(650, GridUnitType.Pixel);

 

        layoutGrid.ColumnDefinitions.Add(layoutColumnDefinition);

 

        #endregion

 

 

        Grid controlGrid = new Grid();

 

        layoutGrid.Children.Add(controlGrid);

 

        Grid.SetRow(controlGrid, 0);

 

 

        #region 헤더 컨트롤 행 정의

 

        RowDefinition headerControlRowDefinition = new RowDefinition();

 

        headerControlRowDefinition.Height = GridLength.Auto;

 

        controlGrid.RowDefinitions.Add(headerControlRowDefinition);

 

        #endregion

 

        #region 컨트롤 행 정의

 

        RowDefinition controlRowDefinition = new RowDefinition();

 

        controlRowDefinition.Height = new GridLength(100, GridUnitType.Star);

 

        controlGrid.RowDefinitions.Add(controlRowDefinition);

 

        #endregion

 

 

        #region 폰트 패밀리 열 정의

 

        ColumnDefinition fontFamilyColumnDefinition = new ColumnDefinition();

 

        fontFamilyColumnDefinition.Width = new GridLength(150, GridUnitType.Star);

 

        controlGrid.ColumnDefinitions.Add(fontFamilyColumnDefinition);

 

        #endregion

 

        #region 분리자 열 정의

 

        ColumnDefinition splitterColumnDefinition1 = new ColumnDefinition();

 

        splitterColumnDefinition1.Width = new GridLength(10, GridUnitType.Pixel);

 

        controlGrid.ColumnDefinitions.Add(splitterColumnDefinition1);

 

        #endregion

 

        #region 폰트 스타일 열 정의

 

        ColumnDefinition fontStyleColumnDefinition = new ColumnDefinition();

 

        fontStyleColumnDefinition.Width = new GridLength(100, GridUnitType.Star);

 

        controlGrid.ColumnDefinitions.Add(fontStyleColumnDefinition);

 

        #endregion

 

        #region 분리자 열 정의

 

        ColumnDefinition splitterColumnDefinition2 = new ColumnDefinition();

 

        splitterColumnDefinition2.Width = new GridLength(10, GridUnitType.Pixel);

 

        controlGrid.ColumnDefinitions.Add(splitterColumnDefinition2);

 

        #endregion

 

        #region 폰트 두께 열 정의

 

        ColumnDefinition fontWeightColumnDefinition = new ColumnDefinition();

 

        fontWeightColumnDefinition.Width = new GridLength(100, GridUnitType.Star);

 

        controlGrid.ColumnDefinitions.Add(fontWeightColumnDefinition);

 

        #endregion

 

        #region 분리자 열 정의

 

        ColumnDefinition splitterColumnDefinition3 = new ColumnDefinition();

 

        splitterColumnDefinition3.Width = new GridLength(10, GridUnitType.Pixel);

 

        controlGrid.ColumnDefinitions.Add(splitterColumnDefinition3);

 

        #endregion

 

        #region 폰트 확장 열 정의

 

        ColumnDefinition fontStretchColumnDefinition = new ColumnDefinition();

 

        fontStretchColumnDefinition.Width = new GridLength(100, GridUnitType.Star);

 

        controlGrid.ColumnDefinitions.Add(fontStretchColumnDefinition);

 

        #endregion

 

        #region 분리자 열 정의

 

        ColumnDefinition splitterColumnDefinition4 = new ColumnDefinition();

 

        splitterColumnDefinition4.Width = new GridLength(10, GridUnitType.Pixel);

 

        controlGrid.ColumnDefinitions.Add(splitterColumnDefinition4);

 

        #endregion

 

        #region 폰트 크기 열 정의

 

        ColumnDefinition fontSizeColumnDefinition = new ColumnDefinition();

 

        fontSizeColumnDefinition.Width = new GridLength(75, GridUnitType.Star);

 

        controlGrid.ColumnDefinitions.Add(fontSizeColumnDefinition);

 

        #endregion

 

 

        #region 폰트 패밀리 라벨

 

        Label fontFamilyLabel = new Label();

 

        fontFamilyLabel.Content = "폰트";

        fontFamilyLabel.Margin  = new Thickness(0);

 

        controlGrid.Children.Add(fontFamilyLabel);

 

        Grid.SetRow   (fontFamilyLabel, 0);

        Grid.SetColumn(fontFamilyLabel, 0);

 

        #endregion

 

        #region 폰트 패밀리

 

        this.fontFamilyTextListControl = new TextListControl();

 

        this.fontFamilyTextListControl.IsReadOnly = true;

        this.fontFamilyTextListControl.Margin     = new Thickness(0);

 

        controlGrid.Children.Add(this.fontFamilyTextListControl);

 

        Grid.SetRow   (this.fontFamilyTextListControl, 1);

        Grid.SetColumn(this.fontFamilyTextListControl, 0);

 

        #endregion

 

 

        #region 폰트 스타일 라벨

 

        Label fontStyleLabel = new Label();

 

        fontStyleLabel.Content = "형식";

        fontStyleLabel.Margin  = new Thickness(0);

 

        controlGrid.Children.Add(fontStyleLabel);

 

        Grid.SetRow   (fontStyleLabel, 0);

        Grid.SetColumn(fontStyleLabel, 2);

 

        #endregion

 

        #region 폰트 스타일

 

        this.fontStyleTextListControl = new TextListControl();

 

        this.fontStyleTextListControl.IsReadOnly = true;

        this.fontStyleTextListControl.Margin     = new Thickness(0);

 

        controlGrid.Children.Add(this.fontStyleTextListControl);

 

        Grid.SetRow   (this.fontStyleTextListControl, 1);

        Grid.SetColumn(this.fontStyleTextListControl, 2);

 

        #endregion

 

 

        #region 폰트 두께 라벨

 

        Label fontWeightLabel = new Label();

 

        fontWeightLabel.Content = "두께";

        fontWeightLabel.Margin  = new Thickness(0);

 

        controlGrid.Children.Add(fontWeightLabel);

 

        Grid.SetRow   (fontWeightLabel, 0);

        Grid.SetColumn(fontWeightLabel, 4);

 

        #endregion

 

        #region 폰트 두께

 

        this.fontWeightTextListControl = new TextListControl();

 

        this.fontWeightTextListControl.IsReadOnly = true;

        this.fontWeightTextListControl.Margin     = new Thickness(0);

 

        controlGrid.Children.Add(this.fontWeightTextListControl);

 

        Grid.SetRow   (this.fontWeightTextListControl, 1);

        Grid.SetColumn(this.fontWeightTextListControl, 4);

 

        #endregion

 

 

        #region 폰트 확장 라벨

 

        Label fontStretchLabel = new Label();

 

        fontStretchLabel.Content = "너비";

        fontStretchLabel.Margin  = new Thickness(0);

 

        controlGrid.Children.Add(fontStretchLabel);

 

        Grid.SetRow   (fontStretchLabel, 0);

        Grid.SetColumn(fontStretchLabel, 6);

 

        #endregion

 

        #region 폰트 확장

 

        this.fontStretchTextListControl = new TextListControl();

 

        this.fontStretchTextListControl.IsReadOnly = true;

        this.fontStretchTextListControl.Margin     = new Thickness(0);

 

        controlGrid.Children.Add(this.fontStretchTextListControl);

 

        Grid.SetRow   (this.fontStretchTextListControl, 1);

        Grid.SetColumn(this.fontStretchTextListControl, 6);

 

        #endregion

 

 

        #region 폰트 크기 라벨

 

        Label fontSizeLabel = new Label();

 

        fontSizeLabel.Content = "크기";

        fontSizeLabel.Margin  = new Thickness(0);

 

        controlGrid.Children.Add(fontSizeLabel);

 

        Grid.SetRow   (fontSizeLabel, 0);

        Grid.SetColumn(fontSizeLabel, 8);

 

        #endregion

 

        #region 폰트 크기

 

        this.fontSizeTextListControl = new TextListControl();

 

        this.fontSizeTextListControl.Margin = new Thickness(0);

 

        controlGrid.Children.Add(this.fontSizeTextListControl);

 

        Grid.SetRow   (this.fontSizeTextListControl, 1);

        Grid.SetColumn(this.fontSizeTextListControl, 8);

 

        #endregion

 

 

        Border displayBorder = new Border();

 

        displayBorder.BorderBrush     = Brushes.Blue;

        displayBorder.BorderThickness = new Thickness(1);

 

        layoutGrid.Children.Add(displayBorder);

 

        Grid.SetRow(displayBorder, 2);

 

 

        this.displayLabel = new Label();

 

        this.displayLabel.Content                    = "가나다라마 ABC abc 12345";

        this.displayLabel.HorizontalContentAlignment = HorizontalAlignment.Center;

        this.displayLabel.VerticalContentAlignment   = VerticalAlignment.Center;

 

 

        displayBorder.Child = this.displayLabel;

 

 

        Grid buttonGrid = new Grid();

 

        layoutGrid.Children.Add(buttonGrid);

 

        Grid.SetRow(buttonGrid, 4);

 

        for(int i = 0; i < 5; i++)

        {

            buttonGrid.ColumnDefinitions.Add(new ColumnDefinition());

        }

 

 

        Button okButton = new Button();

 

        okButton.Content             = "확인";

        okButton.IsDefault           = true;

        okButton.HorizontalAlignment = HorizontalAlignment.Center;

        okButton.MinWidth            = 100;

 

        okButton.Click += okButton_Click;

 

        buttonGrid.Children.Add(okButton);

 

        Grid.SetColumn(okButton, 1);

 

 

        Button cancelButton = new Button();

 

        cancelButton.Content             = "취소";

        cancelButton.IsCancel            = true;

        cancelButton.HorizontalAlignment = HorizontalAlignment.Center;

        cancelButton.MinWidth            = 100;

 

        buttonGrid.Children.Add(cancelButton);

 

        Grid.SetColumn(cancelButton, 3);

 

 

        foreach(FontFamily fontFamily in Fonts.SystemFontFamilies)

        {

            this.fontFamilyTextListControl.Add(fontFamily);

        }

 

        double[] fontSizeArray = new double[]

        {

            8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72

        };

 

        foreach(double fontSize in fontSizeArray)

        {

            this.fontSizeTextListControl.Add(fontSize);

        }

 

 

        this.fontFamilyTextListControl.SelectionChanged  += fontFamilyTextListControl_SelectionChanged;

        this.fontStyleTextListControl.SelectionChanged   += fontStyleTextListControl_SelectionChanged;

        this.fontWeightTextListControl.SelectionChanged  += fontWeightTextListControl_SelectionChanged;

        this.fontStretchTextListControl.SelectionChanged += fontStretchTextListControl_SelectionChanged;

        this.fontSizeTextListControl.TextChanged         += fontSizeTextListControl_TextChanged;

 

 

        Typeface = new Typeface(FontFamily, FontStyle, FontWeight, FontStretch);

 

        FaceSize = FontSize;

 

        this.fontFamilyTextListControl.Focus();

 

        this.isUpdateSuppressed = false;

 

        UpdateSample();

    }

 

    #endregion

 

    //////////////////////////////////////////////////////////////////////////////////////////////////// Method

    ////////////////////////////////////////////////////////////////////////////////////////// Private

    //////////////////////////////////////////////////////////////////////////////// Event

 

    #region 폰트 패밀리 선택 변경시 처리하기 - fontFamilyTextListControl_SelectionChanged(sender, e)

 

    /// <summary>

    /// 폰트 패밀리 선택 변경시 처리하기

    /// </summary>

    /// <param name="sender">이벤트 발생자</param>

    /// <param name="e">이벤트 인자</param>

    private void fontFamilyTextListControl_SelectionChanged(object sender, EventArgs e)

    {

        FontFamily   fontFamily          = this.fontFamilyTextListControl.SelectedItem  as FontFamily  ;

        FontStyle?   previousFontStyle   = this.fontStyleTextListControl.SelectedItem   as FontStyle?  ;

        FontWeight?  previousFontWeight  = this.fontWeightTextListControl.SelectedItem  as FontWeight? ;

        FontStretch? previousFontStretch = this.fontStretchTextListControl.SelectedItem as FontStretch?;

 

        this.isUpdateSuppressed = true;

 

        this.fontStyleTextListControl.Clear();

        this.fontWeightTextListControl.Clear();

        this.fontStretchTextListControl.Clear();

 

        foreach(FamilyTypeface familyTypeface in fontFamily.FamilyTypefaces)

        {

            if(!this.fontStyleTextListControl.Contains(familyTypeface.Style))

            {

                if(familyTypeface.Style == FontStyles.Normal)

                {

                    this.fontStyleTextListControl.Insert(0, familyTypeface.Style);

                }

                else

                {

                    this.fontStyleTextListControl.Add(familyTypeface.Style);

                }

            }

 

            if(!this.fontWeightTextListControl.Contains(familyTypeface.Weight))

            {

                if(familyTypeface.Weight == FontWeights.Normal)

                {

                    this.fontWeightTextListControl.Insert(0, familyTypeface.Weight);

                }

                else

                {

                    this.fontWeightTextListControl.Add(familyTypeface.Weight);

                }

            }

 

            if(!this.fontStretchTextListControl.Contains(familyTypeface.Stretch))

            {

                if(familyTypeface.Stretch == FontStretches.Normal)

                {

                    this.fontStretchTextListControl.Insert(0, familyTypeface.Stretch);

                }

                else

                {

                    this.fontStretchTextListControl.Add(familyTypeface.Stretch);

                }

            }

        }

 

        if(this.fontStyleTextListControl.Contains(previousFontStyle))

        {

            this.fontStyleTextListControl.SelectedItem  = previousFontStyle;

        }

        else

        {

            this.fontStyleTextListControl.SelectedIndex = 0;

        }

 

        if(this.fontWeightTextListControl.Contains(previousFontWeight))

        {

            this.fontWeightTextListControl.SelectedItem  = previousFontWeight;

        }

        else

        {

            this.fontWeightTextListControl.SelectedIndex = 0;

        }

 

        if(this.fontStretchTextListControl.Contains(previousFontStretch))

        {

            this.fontStretchTextListControl.SelectedItem  = previousFontStretch;

        }

        else

        {

            this.fontStretchTextListControl.SelectedIndex = 0;

        }

 

        this.isUpdateSuppressed = false;

 

        UpdateSample();

    }

 

    #endregion

 

    #region 폰트 형식 선택 변경시 처리하기 - fontStyleTextListControl_SelectionChanged(sender, e)

 

    /// <summary>

    /// 폰트 형식 선택 변경시 처리하기

    /// </summary>

    /// <param name="sender">이벤트 발생자</param>

    /// <param name="e">이벤트 인자</param>

    private void fontStyleTextListControl_SelectionChanged(object sender, EventArgs e)

    {

        UpdateSample();

    }

 

    #endregion

 

    #region 폰트 두께 선택 변경시 처리하기 - fontWeightTextListControl_SelectionChanged(sender, e)

 

    /// <summary>

    /// 폰트 두께 선택 변경시 처리하기

    /// </summary>

    /// <param name="sender">이벤트 발생자</param>

    /// <param name="e">이벤트 인자</param>

    private void fontWeightTextListControl_SelectionChanged(object sender, EventArgs e)

    {

        UpdateSample();

    }

 

    #endregion

 

    #region 폰트 너비 선택 변경시 처리하기 - fontStretchTextListControl_SelectionChanged(sender, e)

 

    /// <summary>

    /// 폰트 너비 선택 변경시 처리하기

    /// </summary>

    /// <param name="sender">이벤트 발생자</param>

    /// <param name="e">이벤트 인자</param>

    private void fontStretchTextListControl_SelectionChanged(object sender, EventArgs e)

    {

        UpdateSample();

    }

 

    #endregion

 

    #region 폰트 크기 텍스트 변경시 처리하기 - fontSizeTextListControl_TextChanged(sender, e)

 

    /// <summary>

    /// 폰트 크기 텍스트 변경시 처리하기

    /// </summary>

    /// <param name="sender">이벤트 발생자</param>

    /// <param name="e">이벤트 인자</param>

    private void fontSizeTextListControl_TextChanged(object sender, TextChangedEventArgs e)

    {

        UpdateSample();

    }

 

    #endregion

 

    #region OK 버튼 클릭시 처리하기 - okButton_Click(sender, e)

 

    /// <summary>

    /// OK 버튼 클릭시 처리하기

    /// </summary>

    /// <param name="sender">이벤트 발생자</param>

    /// <param name="e">이벤트 인자</param>

    private void okButton_Click(object sender, RoutedEventArgs e)

    {

        DialogResult = true;

    }

 

    #endregion

 

    //////////////////////////////////////////////////////////////////////////////// Function

 

    #region 샘플 갱신하기 - UpdateSample()

 

    /// <summary>

    /// 샘플 갱신하기

    /// </summary>

    private void UpdateSample()

    {

        if(this.isUpdateSuppressed)

        {

            return;

        }

 

        this.displayLabel.FontFamily  = (FontFamily )this.fontFamilyTextListControl.SelectedItem;

        this.displayLabel.FontStyle   = (FontStyle  )this.fontStyleTextListControl.SelectedItem;

        this.displayLabel.FontWeight  = (FontWeight )this.fontWeightTextListControl.SelectedItem;

        this.displayLabel.FontStretch = (FontStretch)this.fontStretchTextListControl.SelectedItem;

 

        double fontSize;

 

        if(!Double.TryParse(this.fontSizeTextListControl.Text, out fontSize))

        {

            fontSize = 8.25;

        }

 

        this.displayLabel.FontSize = fontSize / 0.75d;

    }

 

    #endregion

}

----------------------------------------------------------------------------------------------------

※ TextListControl : "ContentControl 클래스 : 텍스트 리스트 컨트롤 만들기" 참조

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요