With the anchor property, you can change zero points for positioning items. This property is nested in <anchor> node of item XML description:
<cg-item id='text-000'> <text type='text' font='Arial' font-size='48' color='White' word-break='no'>Sample Text</text> <cg-props scale='text-scale' align='top-left' edges-smooth='0' pos-x='0' pos-y='0' show='yes' move-type='accel-both' alpha='255' bg-color='Black(0)' pixel-ar='0.' play-mode='loop' interlace='auto' width='514' height='80' pause='no'> <indent left='0' right='0' top='0' bottom='0' use-for-bg='no'/> <group-indent left='0' right='0' top='0' bottom='0'/> </cg-props> <anchor item='auto' screen='top'/> </cg-item>
Anchor node contains 2 attributes: item and screen.
To specify a position of an item on screen (where screen zero points for the item) you should set screen attribute. To set relative anchoring for your CG item (where internal zero points) you should set item attribute.
Here is an illustration of different screen anchors:
To illustrate relative item anchors the item with screen='center' is used:
You can specify item anchors with the SetItemAnchorPos method. This method contains the following parameters:
- _bsItemID - identifier of item for which anchors are set
- _eItemRelAnchor - item relative anchor. This parameter specifies 'item' attribute.
- _eScreenRelAnchor - screen relative anchor. This parameter specifies 'screen' attribute.
Both anchor parameters in this method are values of the eCG_Align enumeration.
string myItemID = "myTextItem"; eCG_Align itemAnchor = eCG_Align.eCGA_Center; eCG_Align screenAnchor = eCG_Align.eCGA_BottomLeft; myCharGen.SetItemAnchorPos(myItemID, itemAnchor, screenAnchor);