Class vdAttribDef
- Namespace
- VectorDraw.Professional.vdFigures
- Assembly
- VectorDraw.Professional.dll
Represents an attribute definition used inside block definitions.
The vdAttribDef stores the default textual metadata and behavior for attributes
that are created when a block is inserted (for example: tag identifier, default value,
insertion prompt and visibility/locking flags).
When a block reference containing attributes is inserted into a document, the corresponding vdAttrib objects are automatically created based on the definitions provided by the vdAttribDef instances associated with the block.
This allows for consistent attribute behavior and default values across all instances of the block reference.
See CreateDefaultAttributes()
public sealed class vdAttribDef : vdText, IDisposable, IVDSerialise, IBaseObject
- Inheritance
-
vdAttribDef
- Implements
- Inherited Members
Examples
Creating a block with attributes and inserting it twice in the document and set different values for the attributes in each insert
var block = doc.Blocks.Add("Block wtith attributes");
block.Entities.AddItem(new vdRect(doc, new gPoint(0, 0, 0), 6,3,0));
block.Entities.AddItem(new vdAttribDef(doc)
{
InsertionPoint = new gPoint(3, 1.5, 0),
HorJustify = VdConstHorJust.VdTextHorCenter,
VerJustify = VdConstVerJust.VdTextVerCen,
TagString = "TAG1",
ValueString = "Value1"
}
);
var ins1 = new vdInsert(doc, block, new gPoint(0, 0, 0), 0, 1, 1, 1);
ins1.CreateDefaultAttributes();
ins1.SetAttribValue("TAG1", "Value 1");
doc.Model.Entities.AddItem(ins1);
var ins2 = new vdInsert(doc, block, new gPoint(7, 0, 0), 0, 1, 1, 1);
ins2.CreateDefaultAttributes();
ins2.SetAttribValue("TAG1", "Value 2");
doc.Model.Entities.AddItem(ins2);
doc.ZoomExtents();
doc.Redraw(false);
Remarks
This sealed class derives from vdText . It centralizes default values (such as TagString, ValueString and PromptString) and behavioral flags (InVisibleMode, IsConstant and IsLockedPosition). When properties are modified, document-level events (OnBeforeModifyObject and OnAfterModifyObject) are raised to allow host applications to intercept, validate or cancel changes.
Constructors
- vdAttribDef()
Initializes a new instance of the vdAttribDef object.
- vdAttribDef(vdDocument)
Initializes a new instance of the vdAttribDef object and registers it to the passed Document.
Properties
- InVisibleMode
Get/Set if the attributes will be visible or not.
- IsConstant
Get/Set a value indicating if the Attribute Definition is constant.
- IsLockedPosition
Get/Set a value indicating if the Attribute Definition of the object has Locked Position.
- PromptString
Get/Set the prompt string.
- TagString
Get/Set the string which identifies each occurrence of the attribute.
- TextString
Gets the Value string of the vdAttribDef object.
- ValueString
Get/Set the default value string of the vdAttribDef object.This value will get by default vdAttrib objects when inserted.
Methods
- DeSerialize(DeSerializer, string, object)
This Function is called foreach field name of the vdAttribDef object when opening in vdml format.
- GetCompareHash()
Returns a unique 32 bit integer value according to the object type and its properties values
- InitializeProperties()
Resets the properties of the vdAttribDef object to the Default values.
- MatchProperties(vdPrimary, vdDocument)
Matches all the common properties from an object and sets them to this object.
- Serialize(Serializer)
This Function is called when saving the vdAttribDef object to vdml format.
- ToString()
Gets a System.String that represents the type of the vdAttribDef Object.