H
Helmut Fischer
Hi,
I would like to set the FillColor of a Shape per c# and I am trying this
with the following function:
public void SetBackgroundColor(Visio.Shape shape)
{
ArrayList sourceStream = new ArrayList();
ArrayList formula = new ArrayList();
sourceStream.Add((short)Visio.VisSectionIndices.visSectionObject);
sourceStream.Add((short)Visio.VisRowIndices.visRowFill);
sourceStream.Add((short)Visio.VisCellIndices.visFillForegnd);
formula.Add("RGB(255,0,0)");
Array arrSourceStream = sourceStream.ToArray(typeof(short));
Array arrFormula = formula.ToArray();
shape.SetFormulas(ref arrSourceStream, ref arrFormula, 0);
}
Unfortunately I am getting a meaningfull comException that says "Exception
occurred". I have tested it with the "Prozess"-Shape in "C:\Program
Files\Microsoft Office\Office12\1031\BASFLO_M.VSS" (Yes, the german one),
but also with different other shapes, all with the same error. I have also
tried a wrong value ("GB(255,0,0)"), then the Exception says "Unknown
function name", so it seems as if the RGB-Function is recognized.
I have written several of those functions to set specific Shape properties
like width or position. All of them work correctly, only this one does not.
I have installed the Visio 2007 Service Pack, hoping that this could bring
the solution, but without success.
Anyone out there with an idea?
Thanks a lot in advance, Helmut
I would like to set the FillColor of a Shape per c# and I am trying this
with the following function:
public void SetBackgroundColor(Visio.Shape shape)
{
ArrayList sourceStream = new ArrayList();
ArrayList formula = new ArrayList();
sourceStream.Add((short)Visio.VisSectionIndices.visSectionObject);
sourceStream.Add((short)Visio.VisRowIndices.visRowFill);
sourceStream.Add((short)Visio.VisCellIndices.visFillForegnd);
formula.Add("RGB(255,0,0)");
Array arrSourceStream = sourceStream.ToArray(typeof(short));
Array arrFormula = formula.ToArray();
shape.SetFormulas(ref arrSourceStream, ref arrFormula, 0);
}
Unfortunately I am getting a meaningfull comException that says "Exception
occurred". I have tested it with the "Prozess"-Shape in "C:\Program
Files\Microsoft Office\Office12\1031\BASFLO_M.VSS" (Yes, the german one),
but also with different other shapes, all with the same error. I have also
tried a wrong value ("GB(255,0,0)"), then the Exception says "Unknown
function name", so it seems as if the RGB-Function is recognized.
I have written several of those functions to set specific Shape properties
like width or position. All of them work correctly, only this one does not.
I have installed the Visio 2007 Service Pack, hoping that this could bring
the solution, but without success.
Anyone out there with an idea?
Thanks a lot in advance, Helmut