WPF 知识点

来源:互联网 发布:深圳种植牙 知乎 编辑:程序博客网 时间:2024/05/31 11:03

XAML代码中设置字体

<wfii:Chart.Series>
                    <wfii:Series IsXValueIndexed="True" ChartType="Pie" MarkerColor="Silver" IsValueShownAsLabel="True" Font="">


代码中动态改变chart上的文字,实际即datapoint的font属性

 private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            float fontSzie = (float)e.NewSize.Width / 155;
            chartTopTenThreats.Series[0].Font = new System.Drawing.Font("Tahoma", fontSzie, System.Drawing.FontStyle.Regular);
            chartMostAlerts.Series[0].Font = new System.Drawing.Font("Tahoma", fontSzie, System.Drawing.FontStyle.Regular);
            chartComPie.Series[0].Font = new System.Drawing.Font("Tahoma", fontSzie, System.Drawing.FontStyle.Regular);
            BindTopTenThreats();
            BindTopTenMostAlerts();
            BindComPie();
        }

原创粉丝点击