Skip to content

Commit c444146

Browse files
authored
Merge pull request #142 from SyncfusionExamples/261707-Legend-XlsIO
261707 - Add code snippet for setting background color of the legend
2 parents 4155bd2 + c94dff4 commit c444146

File tree

1 file changed

+4
-1
lines changed
  • Create and Edit Charts/Legend/.NET/Legend/Legend

1 file changed

+4
-1
lines changed

Create and Edit Charts/Legend/.NET/Legend/Legend/Program.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,17 @@ public static void Main(string[] args)
3535
//Set the color
3636
chart.Legend.TextArea.Color = ExcelKnownColors.Pink;
3737

38+
//Set the background color
39+
chart.Legend.FrameFormat.Fill.ForeColorIndex = ExcelKnownColors.Yellow;
40+
3841
//Set the font
3942
chart.Legend.TextArea.Bold = true;
4043
chart.Legend.TextArea.FontName = "Times New Roman";
4144
chart.Legend.TextArea.Size = 10;
4245
chart.Legend.TextArea.Strikethrough = false;
4346

4447
//Remove the legend
45-
chart.Legend.LegendEntries[0].IsDeleted = true;
48+
chart.Legend.LegendEntries[0].Delete();
4649

4750
//Set Legend without overlapping the chart
4851
chart.Legend.IncludeInLayout = true;

0 commit comments

Comments
 (0)