在 vb .net 中,如何将 System.Color(或)Color.FromArgb(....) 类型转换为 Microsoft.Office.Interop.Word.WdColor?
最佳答案
见 the C# answer here.
您需要将其转换为十六进制样式的 RGB:
引用科尔卡梅伦对该答案的评论:
Sum the Red, Green, and Blue values of the named color, multiplying the Green & Blue values by hexadecimal modifiers so that the value is effectively 0xBBGGRR (base doesn't really matter, an integer's an integer), then cast that to the WdColor enumeration type.
示例(从 Cole Cameron 的 C# 示例转换而来):
Dim c As Color = Colors.Blue
Dim wdc = DirectCast(c.R + &H100 * c.G + &H10000 * c.B, Microsoft.Office.Interop.Word.WdColor)
关于.net - 如何将 System.Color 转换为 Microsoft Word WdColor?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36238200/