G
Gilgul
Hi!
I'm writing an C# .NET application with a Visio ActiveX component.
One of the features allows the user to create a new master, by filling out a
dialog.
At the end of the dialog, I duplicate an existing master, changing it's name
to the name supplied in the dialog, and it works. Changing the width of the
shape via the "Width" cell also works.However, trying to change the master's
fg color doesn't (although the changes occur in the ShapeSheet).
The code:
// Get a master from the stencil by its universal name.
Visio.Master masterPolicy = VisStencilPolicies.Masters.get_ItemU("Policy");
Visio.Master masterNewPolicyOrig = VisStencilPolicies.Drop(masterPolicy, 0,
0);
Visio.Master masterNewPolicy = masterNewPolicyOrig.Open();
// Set the name of the new policy
masterNewPolicyOrig.NameU = policyDlg.sName;
// Set the color of the new policy
Visio.Cell cellFillForegnd =
masterNewPolicy.Shapes[1].get_CellsU("FillForegnd");
string sColor = "RGB(" +
policyDlg.Color.R.ToString() + "," +
policyDlg.Color.G.ToString() + "," +
policyDlg.Color.B.ToString() + ")";
cellFillForegnd.Formula = sColor;
Visio.Cell cellFillPattern =
masterNewPolicy.Shapes[1].get_CellsU("FillPattern");
cellFillPattern.Formula = "1";
masterNewPolicy.Shapes[1].get_CellsU("Width").set_Result("mm", 100.1);
masterNewPolicy.IconUpdate = (short)Visio.VisMasterProperties.visAutomatic;
masterNewPolicy.Close();
What am I doing wrong? Any ideas?
Thanks,
Gil
I'm writing an C# .NET application with a Visio ActiveX component.
One of the features allows the user to create a new master, by filling out a
dialog.
At the end of the dialog, I duplicate an existing master, changing it's name
to the name supplied in the dialog, and it works. Changing the width of the
shape via the "Width" cell also works.However, trying to change the master's
fg color doesn't (although the changes occur in the ShapeSheet).
The code:
// Get a master from the stencil by its universal name.
Visio.Master masterPolicy = VisStencilPolicies.Masters.get_ItemU("Policy");
Visio.Master masterNewPolicyOrig = VisStencilPolicies.Drop(masterPolicy, 0,
0);
Visio.Master masterNewPolicy = masterNewPolicyOrig.Open();
// Set the name of the new policy
masterNewPolicyOrig.NameU = policyDlg.sName;
// Set the color of the new policy
Visio.Cell cellFillForegnd =
masterNewPolicy.Shapes[1].get_CellsU("FillForegnd");
string sColor = "RGB(" +
policyDlg.Color.R.ToString() + "," +
policyDlg.Color.G.ToString() + "," +
policyDlg.Color.B.ToString() + ")";
cellFillForegnd.Formula = sColor;
Visio.Cell cellFillPattern =
masterNewPolicy.Shapes[1].get_CellsU("FillPattern");
cellFillPattern.Formula = "1";
masterNewPolicy.Shapes[1].get_CellsU("Width").set_Result("mm", 100.1);
masterNewPolicy.IconUpdate = (short)Visio.VisMasterProperties.visAutomatic;
masterNewPolicy.Close();
What am I doing wrong? Any ideas?
Thanks,
Gil