如何分配System.Drawing.Color到Microsoft.Office.Interop.Excel.ColorFormat [英] How to assign System.Drawing.Color to Microsoft.Office.Interop.Excel.ColorFormat
本文介绍了如何分配System.Drawing.Color到Microsoft.Office.Interop.Excel.ColorFormat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
示例代码如下,
Chart.SerialsCollection(1).Point(1).Format.Fill.ForeColor = System.Drawing.Color.Red;
返回错误。不能隐式转换类型,一个是Struct,另一个是ColorFormat。
Return an error. Cannot implicitly convert type, one is a Struct, the other is ColorFormat.
ForeColor.RGB是 Int 类型,我只能获得3个int从Color.Red.R,Color.Red.G和Color.Red.B。如何分配我想要的颜色ForeColor属性?
ForeColor.RGB is Int type, I can only get 3 ints from Color.Red.R, Color.Red.G and Color.Red.B. How to assign the color I want to ForeColor property?
推荐答案
尝试 RGB 属性 ForeColor.RGB
例如
Chart.SerialsCollection(1).Point(1).Format.Fill.ForeColor.RGB = System.Drawing.Color.Red.ToArgb();
这篇关于如何分配System.Drawing.Color到Microsoft.Office.Interop.Excel.ColorFormat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文