visio c# get RGB-Color from a layer -


i try current color of layer in visio document rgb. problem colors, not set "rgb(1,2,3)" in formula. there colors set, based on current scheme. there colors "255" (layer color not chosen) or "19" (the used color depends on active scheme, eg. dark-gray).

i need way transform "19" rgb-scheme, depending on current scheme , variant.

heiko

visio has first 24 colors fixed. others come in form of rgb(r, g, b) formula. list of fixed colors can obtained form document.colors. in all, start following:

using system.drawing; using system.text.regularexpressions; using visio = microsoft.office.interop.visio;  static color getlayercolor(visio.layer layer) {     var str = layer         .cellsc[(short)visio.viscellindices.vislayercolor]         .resultstru[""];      // case 1: fixed color     int colornum;     if (int.tryparse(str, out colornum))     {         var visiocolor = layer.document.colors[colornum];          return color.fromargb(             visiocolor.red,              visiocolor.green,              visiocolor.blue);     }      // case 2: rgb formula     var m = regex.match(str, @"rgb\((\d+),\s*(\d+),\s*(\d+)\)").groups;      return color.fromargb(         int.parse(m[1].value),          int.parse(m[2].value),          int.parse(m[3].value)         ); } 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -