Convert System.Color To Microsoft Word WdColor

前端 未结 3 742
半阙折子戏
半阙折子戏 2021-01-17 19:47

I\'m rather new to C# and find it almost unspeakable that there isn\'t a simple way for converting an RGB color or system.color to a WdColor!

VB is simple, C# - is i

3条回答
  •  旧时难觅i
    2021-01-17 20:05

    I thought people might like an extension method:

        public static void ColorRGB(this Wd.Font font, int red, int green, int blue)
        {
            font.Color = (Wd.WdColor)(red + 0x100 * green + 0x10000 * blue);
        }
    

提交回复
热议问题