Since all templates derive from the NTemplate base class they share the following set of common features:
- Attributes - NTemplate adds support for attributes (hence implements the INAttributeContainer and INAttributeObserver interface).
- Measurement Unit - the template measurements are measured in the template measurement unit. That is why NTemplate implements the INMeasurementUnit, INResolution and INMeasurements interfaces.
- Visual Configuration - in order to be visually configured with the wizard, templates must create user controls. They appear as tabs in the wizard tab control after the ever existing Select Template Tab. When a template is selected in the wizard, the wizard will call the template CreateUserControls method, which is responsible to return an array of the template user controls. The template user controls must be derived from the NTemplateUserControl base class.
- TemplateChanged Event - the TemplateChanged event of the NTemplate class must always be fired when a property of the template has changed, since the wizard subscribes for this event in order to regenerate the template preview.
You can instanciate any template in a document of your choice by calling its Create method.
C# |
Copy Code
|
---|---|
// create the template NGenericTreeTemplate treeTemplate = new NGenericTreeTemplate(); // modify its measurement unit to be the same as the document measurement unit treeTemplate.MeasurementUnit = document.MeasurementUnit; // modify the template properties ... // create it in the document treeTemplate.Create(document); |
Visual Basic |
Copy Code
|
---|---|
' create the template Dim treeTemplate As New NGenericTreeTemplate ' modify its measurement unit to be the same as the document measurement unit treeTemplate.MeasurementUnit = document.MeasurementUnit ' modify the template properties ... ' create it in the document treeTemplate.Create(document) |