Visio 2010 Programmatically change Shape fill color using C#

Discussion in 'Visio' started by Ilan Bar, Aug 13, 2015.

  1. Ilan Bar

    Ilan Bar

    Joined:
    Jul 8, 2015
    Messages:
    2
    Likes Received:
    0
    From my C# code, I am trying alter a shape's background to highlight it in response to a given criteria. I researched all visio forums and came up with the following methods:

    first method:

    shape.CellsSRC[(short)VisSectionIndices.visSectionObject,(short)VisRowIndices.visRowFill,(short)VisCellIndices.visFillForegnd].FormulaU="RGB(255,0,0)";
    second method:

    ArrayList sourceStream =newArrayList();ArrayList formula =newArrayList();

    sourceStream.Add((short)VisSectionIndices.visSectionObject);
    sourceStream.Add((short)VisRowIndices.visRowFill);
    sourceStream.Add((short)VisCellIndices.visFillForegnd);

    formula.Add("RGB(255,0,0)");

    Array arrSourceStream = sourceStream.ToArray(typeof(short));Array arrFormula = formula.ToArray();

    shape.SetFormulas(ref arrSourceStream,ref arrFormula,(short)VisGetSetArgs.visSetUniversalSyntax);

    None of the methods resulted in change in the shape's color. Additional information:
    1) trying to change shape's line color or pattern by changing the VisCellIndices enum gives the same result - no change
    2) I am able to add custom cell properties to the shape
    3) I am able to alter shape's text using the "Text" property

    I am completely stuck!! any ideas?
    Regards, Ilan
     
    Ilan Bar, Aug 13, 2015
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. marco_aas
    Replies:
    0
    Views:
    3,380
    marco_aas
    Jul 17, 2011
  2. adeel
    Replies:
    0
    Views:
    1,211
    adeel
    Nov 4, 2011
  3. Pam Hunter

    Visio 2010 new page

    Pam Hunter, Jul 20, 2012, in forum: Visio
    Replies:
    0
    Views:
    701
    Pam Hunter
    Jul 20, 2012
  4. patwran

    visio 10 shape area calculation

    patwran, Nov 7, 2012, in forum: Visio
    Replies:
    0
    Views:
    872
    patwran
    Nov 7, 2012
  5. Porfirio
    Replies:
    0
    Views:
    1,588
    Porfirio
    Jun 8, 2013
  6. ale71mosca
    Replies:
    0
    Views:
    312
    ale71mosca
    Apr 1, 2014
  7. Ilan Bar
    Replies:
    0
    Views:
    232
    Ilan Bar
    Jul 8, 2015
  8. leica
    Replies:
    1
    Views:
    416
    slhn2010
    Feb 25, 2016
Loading...