Group: Forum Members
Last Active: 13 Years Ago
Posts: 7,
Visits: 1
|
Hi, I am using the Visio Shape Importer and have successfully imported some shapes from a VSX file. I can see that the imported shapes have the FillStyle (shape.Style.FillStyle) properly set to NGradientFillStyle. I have attempted to change the BeginColor of the gradient fill, but the shapes are not changing color. The setting of the Location, Text, and ShadowStyle properties of the shape are working.
Here is my code:
lib.RemoveAllChildren(); NVisioImporter visioImporter = new NVisioImporter(lib); visioImporter.Import(string.Format("{0}\\{1}", Application.StartupPath, "tasks.vsx"));
float left = 10; int numNodes = lib.ChildrenCount(new Nevron.Filters.NInstanceOfTypeFilter(typeof(NMaster))); for ( int idx = 0; idx < numNodes; idx++ ) { NMaster master = (NMaster)lib.GetChildAt(idx); Nevron.Dom.NNodeList node = master.CreateInstance(doc, new NPointF(0,0)); NShape shape = node[0] as NShape; shape.Style.ShadowStyle = new NShadowStyle(ShadowType.GaussianBlur, Color.Gray, new NPointL(3.0f, 3.0f)); NGradientFillStyle fillStyle = shape.Style.FillStyle as NGradientFillStyle; shape.Style.FillStyle = new NGradientFillStyle(fillStyle.Style, fillStyle.Variant, Color.FromArgb(255, 120, 148, 64), fillStyle.EndColor); shape.Location = new NPointF(left, 10); left += 10 + shape.Width; shape.Text = string.Format("{0}", master.Name); }
|
Group: Forum Members
Last Active: Last Week
Posts: 3,054,
Visits: 4,009
|
Hi, depending on the value of the PreserveShapeHierarchy property the Visio Shape Importer imports the Visio shapes as composite shapes (is PreserveShapeHierarchy=false) or as groups (if it is true). In the case of composite shapes the shapes that the visio master is made of are imported as custom path in the Primitives collection of the composite shape. Each one of this custom paths has its own local fill style and that's why when you set the fill style of the composite shape it has no effect. So you should either set the fill style of all custom paths to the one you want or set their fill styles to null and set the fill style of the composite shape (the custom paths will inherit it).
Best Regards, Nevron Support Team
|