gpt4 book ai didi

c# - Microsoft 图表控件无法设置背景透明

转载 作者:行者123 更新时间:2023-12-04 06:10:36 25 4
gpt4 key购买 nike

我有一个微软饼图控件。我将背景设置为透明,但它保持白色。如您所见,我已经设置了 BorderSkin 的 BackColor 和 PageColor 属性。我还设置了 ChartArea 的 BackColor。这是一些代码。

Chart chart = new Chart
{
Width = 190,
Height = 159,
RenderType = RenderType.BinaryStreaming,
AntiAliasing = AntiAliasingStyles.Graphics,
TextAntiAliasingQuality = TextAntiAliasingQuality.Normal
};

// turn on transparency
chart.BorderSkin.BackColor = Color.Transparent;
chart.BorderSkin.PageColor = Color.Transparent;
chart.BorderSkin.SkinStyle = BorderSkinStyle.Emboss;

chart.ChartAreas.Add("");

chart.ChartAreas[0].AxisX.Interval = 1; // setting this to 1 forces all items to show
chart.ChartAreas[0].AxisX.LabelStyle.Enabled = true;
chart.ChartAreas[0].AxisX.TitleFont = xLabelFont;
chart.ChartAreas[0].AxisX.MajorGrid.Enabled = false;

chart.ChartAreas[0].AxisY.TitleFont = yLabelFont;
chart.ChartAreas[0].AxisY.LabelStyle.IsStaggered = false; // staggers axis label
chart.ChartAreas[0].AxisY.TextOrientation = TextOrientation.Horizontal;
chart.ChartAreas[0].AxisY.MajorGrid.Enabled = false;
chart.ChartAreas[0].AlignmentOrientation = AreaAlignmentOrientations.All;

chart.ChartAreas[0].BackColor = Color.Transparent;
chart.Series.Add("");
chart.Series[0].ChartType = SeriesChartType.Pie;
//chart.Series[0]["PieLabelStyle"] = "Disabled"; // disable labels
chart.Series[0].IsValueShownAsLabel = true; // *** super important to be able to manually set labels show point labels for value ***

chart.ChartAreas[0].Area3DStyle.Enable3D = true;

最佳答案

我没有看到这一行:

chart.BackColor = Color.Transparent;

关于c# - Microsoft 图表控件无法设置背景透明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7827868/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com