2.2.4.17.38 GraphLayer::StyleHolders

Description

The Collection property of all StyleHolders in the layer.


Gets an arbitrary StyleHolder in layer by index.


Gets an arbitrary StyleHolder in layer by name.

Syntax

Collection<StyleHolder> StyleHolders


StyleHolder	StyleHolders(int index)


StyleHolder	StyleHolders(LPCSTR lpcszName)

Parameters

index
[input] 0-offset index of the StyleHolder in layer.


lpcszName
[input] the name of the style holder in layer.

Return

the index'th StyleHolder.


the StyleHolder.

Examples

EX1

//Output the name of style holders in the graph layer.
void    GraphLayer_StyleHolders_ex1()
{
    GraphPage gp;
    gp.Create("origin");
    GraphLayer        gl(gp.GetName(),0);
 
    if(gl)
    {            
        // Loop over all the style holders in the collection:    
        foreach (StyleHolder style in gl.StyleHolders)
        {
            // Display the name (the name of a style holder
            // starts with an underscore followed by a number
            // indicating the plot type):
            out_str(style.GetName());
        }
    }
}

EX2

//Gets the StyleHolder by index
void	GraphLayer_StyleHolders_ex2()
{
	GraphPage gp;
	gp.Create("origin");
	GraphLayer		gl(gp.GetName(),0);
	
	if(gl)
	{			
		StyleHolder		sh;
		
		// Get the first style holder:
		sh = gl.StyleHolders(0);
		
		// Display its name:
		out_str(sh.GetName());
	}
}

EX3

// For this example to run, a graph window must exist in the project.
// Make sure that you use the line-symbol plot template or graph, because
// the function tries to access the style holder with the name "_202" which
// corresponds to the line-symbol plot type.
void	GraphLayer_StyleHolders_ex3()
{
	// Create and attach a graph layer from current Graph:
	GraphLayer		gl = Project.ActiveLayer();
	
	if(gl)
	{			
		StyleHolder		sh;
		
		// Get the style holder "_202":
		sh = gl.StyleHolders("_202");
		
		// Display its name:
		out_str(sh.GetName());
	}
}

Remark

Header to Include

origin.h

See Also

Reference