Smrf.NodeXL.Visualization.Wpf.NodeXLWithAxesControl.SetFont C# (CSharp) Method

SetFont() public method

public SetFont ( System.Windows.Media.Typeface typeface, Double labelEmSize ) : void
typeface System.Windows.Media.Typeface
labelEmSize Double
return void
    SetFont
    (
        Typeface typeface,
        Double labelEmSize
    )
    {
        Debug.Assert(typeface != null);
        Debug.Assert(labelEmSize > 0);
        AssertValid();

        m_oXAxis.SetFont(typeface, labelEmSize);
        m_oYAxis.SetFont(typeface, labelEmSize);

        if (this.ShowAxes)
        {
            // The Axis objects size themselves based on their font, so the
            // Grid needs to resize its rows and columns.  For some reason,
            // InvalidateArrange() won't do this, so force a resize by
            // temporarily resizing one of the Grid's rows.

            RowDefinition oSecondRowDefinition = this.RowDefinitions[1];

            oSecondRowDefinition.Height = new GridLength(1);
            oSecondRowDefinition.Height = GridLength.Auto;
        }
    }

Usage Example

    TransferToNodeXLWithAxesControl
    (
        NodeXLWithAxesControl nodeXLWithAxesControl
    )
    {
        Debug.Assert(nodeXLWithAxesControl != null);
        AssertValid();

        Font oAxisFont = this.AxisFont;

        nodeXLWithAxesControl.SetFont(
            WpfGraphicsUtil.FontToTypeface(oAxisFont),

            WpfGraphicsUtil.SystemDrawingFontSizeToWpfFontSize(
                oAxisFont.Size) );

        TransferToNodeXLControl(nodeXLWithAxesControl.NodeXLControl);
    }