本文整理汇总了C#中IVwEnv.OpenTableRow方法的典型用法代码示例。如果您正苦于以下问题:C# IVwEnv.OpenTableRow方法的具体用法?C# IVwEnv.OpenTableRow怎么用?C# IVwEnv.OpenTableRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVwEnv
的用法示例。
在下文中一共展示了IVwEnv.OpenTableRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch (frag)
{
case kfragRule:
m_rule = m_cache.ServiceLocator.GetInstance<IPhMetathesisRuleRepository>().GetObject(hvo);
if (m_rule.Disabled)
{
vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, "Disabled Text");
}
int maxNumLines = GetMaxNumLines();
VwLength tableLen;
tableLen.nVal = 10000;
tableLen.unit = VwUnit.kunPercent100;
vwenv.OpenTable(5, tableLen, 0, VwAlignment.kvaCenter, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 4000, false);
VwLength ctxtLen;
ctxtLen.nVal = 1;
ctxtLen.unit = VwUnit.kunRelative;
int resultx, inputx, dmpy;
vwenv.get_StringWidth(m_resultStr, m_colHeaderProps, out resultx, out dmpy);
vwenv.get_StringWidth(m_inputStr, m_colHeaderProps, out inputx, out dmpy);
VwLength headerLen;
headerLen.nVal = Math.Max(resultx, inputx) + 8000;
headerLen.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(1, headerLen);
vwenv.MakeColumns(4, ctxtLen);
vwenv.OpenTableBody();
vwenv.OpenTableRow();
vwenv.OpenTableCell(1, 1);
vwenv.CloseTableCell();
// left context header cell
vwenv.Props = m_colHeaderProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.OpenTableCell(1, 1);
vwenv.AddString(m_leftEnvStr);
vwenv.CloseTableCell();
// switch header cell
vwenv.Props = m_colHeaderProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 2000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 2000);
vwenv.OpenTableCell(1, 2);
vwenv.AddString(m_switchStr);
vwenv.CloseTableCell();
// right context header cell
vwenv.Props = m_colHeaderProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.OpenTableCell(1, 1);
vwenv.AddString(m_rightEnvStr);
vwenv.CloseTableCell();
vwenv.CloseTableRow();
vwenv.OpenTableRow();
// input header cell
vwenv.Props = m_rowHeaderProps;
vwenv.OpenTableCell(1, 1);
vwenv.AddString(m_inputStr);
vwenv.CloseTableCell();
// input left context cell
vwenv.Props = m_inputCtxtProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.OpenTableCell(1, 1);
vwenv.OpenParagraph();
if (m_rule.LeftEnvIndex == -1)
{
OpenSingleLinePile(vwenv, maxNumLines, false);
vwenv.Props = m_bracketProps;
vwenv.AddProp(ktagLeftEnv, this, kfragEmpty);
CloseSingleLinePile(vwenv, false);
}
else
{
for (int i = 0; i < m_rule.LeftEnvLimit; i++)
vwenv.AddObj(m_rule.StrucDescOS[i].Hvo, this, kfragContext);
}
vwenv.CloseParagraph();
vwenv.CloseTableCell();
// input left switch cell
vwenv.Props = m_inputCtxtProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 2000);
//.........这里部分代码省略.........
示例2: Display
/// ------------------------------------------------------------------------------------
/// <summary>
/// This is the main interesting method of displaying objects and fragments of them.
/// A Scripture is displayed by displaying its Books;
/// and a Book is displayed by displaying its Title and Sections;
/// and a Section is diplayed by displaying its Heading and Content;
/// which are displayed by using the standard view constructor for StText.
/// </summary>
/// <param name="vwenv"></param>
/// <param name="hvo"></param>
/// <param name="frag"></param>
/// ------------------------------------------------------------------------------------
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
CheckDisposed();
switch(frag)
{
case (int)FootnoteFrags.kfrScripture:
case (int)ScrFrags.kfrScripture:
{
vwenv.NoteDependency(new[] { hvo }, new[] { ScrBookTags.kflidFootnotes }, 1);
// This fragment should only be used on full refresh - clear the user prompt
// flags so they will be shown again.
ClearUserPromptUpdates();
// We add this lazy - we will expand some of it immediately, but the non-
// visible parts will remain lazy!
vwenv.NoteDependency(new[]{m_cache.LanguageProject.TranslatedScriptureOA.Hvo},
new[]{ScriptureTags.kflidScriptureBooks}, 1);
vwenv.AddLazyVecItems(BooksTag, this,
frag == (int)ScrFrags.kfrScripture ? (int)ScrFrags.kfrBook : (int)FootnoteFrags.kfrBook);
// Add a 48 point gap at the bottom of the view
if (!PrintLayout && (frag != (int)FootnoteFrags.kfrScripture))
vwenv.AddSimpleRect((int)ColorUtil.ConvertColorToBGR(BackColor), -1, 48000, 0);
break;
}
case (int)ScrFrags.kfrBook:
{
vwenv.OpenDiv();
vwenv.AddObjProp(ScrBookTags.kflidTitle, this, (int)StTextFrags.kfrText);
vwenv.AddLazyVecItems(ScrBookTags.kflidSections, this, (int)ScrFrags.kfrSection);
// Add a 48 point gap at the bottom of the view
if (!PrintLayout && m_fShowTailingSpace)
vwenv.AddSimpleRect((int)ColorUtil.ConvertColorToBGR(BackColor), -1, 48000, 0);
if (!PrintLayout)
InsertBookSeparator(hvo, vwenv);
vwenv.CloseDiv();
break;
}
case (int)ScrFrags.kfrSection:
{
vwenv.OpenDiv();
vwenv.AddObjProp(ScrSectionTags.kflidHeading, this, (int)StTextFrags.kfrText);
vwenv.AddObjProp(ScrSectionTags.kflidContent, this, (int)StTextFrags.kfrText);
vwenv.CloseDiv();
break;
}
case (int)StTextFrags.kfrPara:
if (PrintLayout || !m_fDisplayInTable)
{
// We are displaying Scripture or a print layout view
base.Display(vwenv, hvo, frag);
}
else
{
// We are displaying a back translation or Scripture in draftview in a table
// Open a table to display the BT para in column 1, and the icon in column 2.
VwLength vlTable; // we use this to specify that the table takes 100% of the width.
vlTable.nVal = 10000;
vlTable.unit = VwUnit.kunPercent100;
VwLength vlColumn; // and this one to specify 90% for the text
vlColumn.nVal = DisplayTranslation ? 9000 : 10000;
vlColumn.unit = VwUnit.kunPercent100;
int nColumns = DisplayTranslation ? 2 : 1;
vwenv.OpenTable(nColumns, // One or two columns.
vlTable, // Table uses 100% of available width.
0, // Border thickness.
VwAlignment.kvaLeft, // Default alignment.
VwFramePosition.kvfpVoid, // No border.
//VwFramePosition.kvfpBox,
//VwRule.kvrlAll, // rule lines between cells
VwRule.kvrlNone,
0, //No space between cells.
0, //No padding inside cells.
false);
// Specify column widths. The first argument is the number of columns,
// not a column index.
vwenv.MakeColumns(nColumns, vlColumn);
vwenv.OpenTableBody();
vwenv.OpenTableRow();
//.........这里部分代码省略.........
示例3: OpenTableRow
/// ------------------------------------------------------------------------------------
/// <summary>
/// Opens the table row.
/// </summary>
/// <param name="vwenv">The view environment.</param>
/// <param name="ann">The annotation being displayed.</param>
/// ------------------------------------------------------------------------------------
private void OpenTableRow(IVwEnv vwenv, IScrScriptureNote ann)
{
vwenv.OpenTableRow();
if (ann.Hvo != SelectedNoteHvo)
{
// Display cell used for padding (to indent unselected annotations by the width
// of the frame used to highlight the selected annotation).
vwenv.OpenTableCell(1, 1);
vwenv.AddString(m_tssEmpty);
vwenv.CloseTableCell();
}
}
示例4: DisplayResponse
/// ------------------------------------------------------------------------------------
/// <summary>
/// Display a response to an annotation.
/// </summary>
/// <param name="vwenv"></param>
/// <param name="text">StJournalText containing the response</param>
/// <param name="expanded">whether response should be expanded</param>
/// ------------------------------------------------------------------------------------
private void DisplayResponse(IVwEnv vwenv, IStJournalText text, bool expanded)
{
#region Response text
// Display response text
vwenv.OpenTableRow();
// Display empty first, second, and third cells
vwenv.OpenTableCell(1, 3);
vwenv.CloseTableCell();
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop,
(int)FwTextPropVar.ktpvMilliPoint, 500);
vwenv.OpenTableCell(1, 2);
vwenv.AddObjVecItems((int)StTextTags.kflidParagraphs, this, (int)StTextFrags.kfrPara);
vwenv.CloseTableCell();
vwenv.CloseTableRow();
#endregion
#region Author and creation date
// Author and creation date
vwenv.OpenTableRow();
// Display empty first, second, and third cells
vwenv.OpenTableCell(1, 3);
vwenv.CloseTableCell();
// Display author in the third cell
vwenv.OpenTableCell(1, 1);
SetDisabledColorForNote(vwenv);
vwenv.OpenConcPara(0, 0, 0, 0);
vwenv.AddString(m_authorLabel);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
// Display creation date in the fourth cell
vwenv.OpenTableCell(1, 1);
vwenv.OpenConcPara(0, 0, 0, 0);
vwenv.AddString(m_createdLabel);
vwenv.AddString(m_tsStrFactory.MakeString(text.DateCreated.ToShortDateString(),
m_cache.DefaultUserWs));
vwenv.CloseParagraph();
vwenv.CloseTableCell();
vwenv.CloseTableRow();
#endregion
}
示例5: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
CheckDisposed();
switch (frag)
{
case kfragRHS:
m_rhs = new PhSegRuleRHS(m_cache, hvo);
IPhRegularRule rule = new PhRegularRule(m_cache, m_rhs.OwnerHVO);
int arrowWidth, slashWidth, underscoreWidth, charHeight;
vwenv.get_StringWidth(m_arrow, m_charProps, out arrowWidth, out charHeight);
int maxCharHeight = charHeight;
vwenv.get_StringWidth(m_slash, m_charProps, out slashWidth, out charHeight);
maxCharHeight = Math.Max(charHeight, maxCharHeight);
vwenv.get_StringWidth(m_underscore, m_charProps, out underscoreWidth, out charHeight);
maxCharHeight = Math.Max(charHeight, maxCharHeight);
int dmpx, spaceHeight;
vwenv.get_StringWidth(m_zwSpace, m_bracketProps, out dmpx, out spaceHeight);
int maxNumLines = MaxNumLines;
int maxCtxtHeight = maxNumLines * spaceHeight;
int maxHeight = Math.Max(maxCharHeight, maxCtxtHeight);
int charOffset = maxHeight;
int ctxtPadding = maxHeight - maxCtxtHeight;
VwLength tableLen;
tableLen.nVal = 10000;
tableLen.unit = VwUnit.kunPercent100;
vwenv.OpenTable(7, tableLen, 0, VwAlignment.kvaCenter, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 0, false);
VwLength ctxtLen;
ctxtLen.nVal = 1;
ctxtLen.unit = VwUnit.kunRelative;
VwLength charLen;
charLen.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(1, ctxtLen);
charLen.nVal = arrowWidth + 4000;
vwenv.MakeColumns(1, charLen);
vwenv.MakeColumns(1, ctxtLen);
charLen.nVal = slashWidth + 4000;
vwenv.MakeColumns(1, charLen);
vwenv.MakeColumns(1, ctxtLen);
charLen.nVal = underscoreWidth + 4000;
vwenv.MakeColumns(1, charLen);
vwenv.MakeColumns(1, ctxtLen);
vwenv.OpenTableBody();
vwenv.OpenTableRow();
// LHS cell
vwenv.Props = m_ctxtProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
vwenv.OpenTableCell(1, 1);
vwenv.OpenParagraph();
vwenv.AddObjProp(m_cache.GetFlid(hvo, null, "OwningRule"), this, kfragRule);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
// arrow cell
vwenv.Props = m_charProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
vwenv.OpenTableCell(1, 1);
vwenv.AddString(m_arrow);
vwenv.CloseTableCell();
// RHS cell
vwenv.Props = m_ctxtProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
vwenv.OpenTableCell(1, 1);
vwenv.OpenParagraph();
if (m_cache.GetVectorSize(hvo, (int)PhSegRuleRHS.PhSegRuleRHSTags.kflidStrucChange) > 0)
{
vwenv.AddObjVecItems((int)PhSegRuleRHS.PhSegRuleRHSTags.kflidStrucChange, this, kfragContext);
}
else
{
OpenContextPile(vwenv, false);
vwenv.Props = m_bracketProps;
vwenv.AddProp((int)PhSegRuleRHS.PhSegRuleRHSTags.kflidStrucChange, this, kfragEmpty);
CloseContextPile(vwenv, false);
}
vwenv.CloseParagraph();
vwenv.CloseTableCell();
// slash cell
vwenv.Props = m_charProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
vwenv.OpenTableCell(1, 1);
vwenv.AddString(m_slash);
vwenv.CloseTableCell();
// left context cell
//.........这里部分代码省略.........
示例6: Display
/// ------------------------------------------------------------------------------------
/// <summary>
/// Display the header or footer as a table containing three cells (left-, center-, and
/// right-aligned), each with a TS String taken from the given PubHeader
/// </summary>
/// <param name="vwenv"></param>
/// <param name="hvo">id of a PubHeader object</param>
/// <param name="frag">Constant (ignored)</param>
/// ------------------------------------------------------------------------------------
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
CheckDisposed();
// If there is only data in the outside columns, then make a two column
// table. If there is only data in the center column then make a 1 column
// table. Otherwise make it three columns.
int columnCount = 3;
if (m_autoAdjustColumns)
{
if (!DataInOutsideColumns(hvo))
columnCount = 1;
else if (!DataInCenterColumn(hvo))
columnCount = 2;
}
VwLength width;
width.unit = VwUnit.kunPercent100;
width.nVal = 10000;
vwenv.OpenTable(columnCount, width, 0, VwAlignment.kvaLeft,
VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 0, false);
switch(columnCount)
{
case 1: width.nVal = 10000; break;
case 2: width.nVal = 5000; break;
case 3: width.nVal = 3333; break;
}
vwenv.MakeColumns(columnCount, width);
vwenv.OpenTableBody();
vwenv.OpenTableRow();
// Left Column
if (columnCount > 1)
AddColumn(vwenv, FwTextAlign.ktalLeft, LeftElementFlid);
// Center Column
if (columnCount != 2)
AddColumn(vwenv, FwTextAlign.ktalCenter, PubHeader.PubHeaderTags.kflidCenteredText);
// Right Column
if (columnCount > 1)
AddColumn(vwenv, FwTextAlign.ktalRight, RightElementFlid);
vwenv.CloseTableRow();
vwenv.CloseTableBody();
vwenv.CloseTable();
}
示例7: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch (frag)
{
case kfragPattern:
VwLength tableLen;
tableLen.nVal = 10000;
tableLen.unit = VwUnit.kunPercent100;
vwenv.OpenTable(1, tableLen, 0, VwAlignment.kvaCenter, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 0, false);
VwLength patternLen;
patternLen.nVal = 1;
patternLen.unit = VwUnit.kunRelative;
vwenv.MakeColumns(1, patternLen);
vwenv.OpenTableBody();
vwenv.OpenTableRow();
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderColor, (int)FwTextPropVar.ktpvDefault, (int)ColorUtil.ConvertColorToBGR(Color.Gray));
vwenv.set_IntProperty((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, (int)FwTextAlign.ktalCenter);
vwenv.set_IntProperty((int)FwTextPropType.ktptPadBottom, (int)FwTextPropVar.ktpvMilliPoint, 2000);
vwenv.OpenTableCell(1, 1);
vwenv.OpenParagraph();
if (((ComplexConcPatternSda) vwenv.DataAccess).Root.IsLeaf)
{
OpenSingleLinePile(vwenv, GetMaxNumLines(vwenv), false);
vwenv.Props = m_bracketProps;
vwenv.AddProp(ComplexConcPatternSda.ktagChildren, this, kfragEmpty);
CloseSingleLinePile(vwenv, false);
}
else
{
vwenv.AddObjVecItems(ComplexConcPatternSda.ktagChildren, this, kfragNode);
}
vwenv.CloseParagraph();
vwenv.CloseTableCell();
vwenv.CloseTableRow();
vwenv.CloseTableBody();
vwenv.CloseTable();
break;
case kfragNode:
ComplexConcPatternNode node = ((ComplexConcPatternSda) vwenv.DataAccess).Nodes[hvo];
int maxNumLines = GetMaxNumLines(vwenv);
if (node is ComplexConcOrNode)
{
OpenSingleLinePile(vwenv, maxNumLines);
vwenv.AddProp(ktagInnerNonBoundary, this, kfragOR);
CloseSingleLinePile(vwenv, false);
}
else if (node is ComplexConcWordBdryNode)
{
OpenSingleLinePile(vwenv, maxNumLines);
vwenv.AddProp(ktagInnerNonBoundary, this, kfragHash);
CloseSingleLinePile(vwenv);
}
else if (node is ComplexConcGroupNode)
{
int numLines = GetNumLines(node);
bool hasMinMax = node.Maximum != 1 || node.Minimum != 1;
if (numLines == 1)
{
OpenSingleLinePile(vwenv, maxNumLines, false);
// use normal parentheses for a single line group
vwenv.AddProp(ktagLeftBoundary, this, kfragLeftParen);
vwenv.AddObjVecItems(ComplexConcPatternSda.ktagChildren, this, kfragNode);
vwenv.AddProp(hasMinMax ? ktagInnerNonBoundary : ktagRightBoundary, this, kfragRightParen);
if (hasMinMax)
DisplayMinMax(numLines, vwenv);
CloseSingleLinePile(vwenv, false);
}
else
{
vwenv.Props = m_bracketProps;
vwenv.set_IntProperty((int) FwTextPropType.ktptMarginLeading, (int) FwTextPropVar.ktpvMilliPoint, PileMargin);
vwenv.OpenInnerPile();
AddExtraLines(maxNumLines - numLines, ktagLeftNonBoundary, vwenv);
vwenv.AddProp(ktagLeftNonBoundary, this, kfragLeftParenUpHook);
for (int i = 1; i < numLines - 1; i++)
vwenv.AddProp(ktagLeftNonBoundary, this, kfragLeftParenExt);
vwenv.AddProp(ktagLeftBoundary, this, kfragLeftParenLowHook);
vwenv.CloseInnerPile();
vwenv.AddObjVecItems(ComplexConcPatternSda.ktagChildren, this, kfragNode);
vwenv.Props = m_bracketProps;
vwenv.set_IntProperty((int) FwTextPropType.ktptMarginTrailing, (int) FwTextPropVar.ktpvMilliPoint, PileMargin);
vwenv.OpenInnerPile();
AddExtraLines(maxNumLines - numLines, hasMinMax ? ktagInnerNonBoundary : ktagRightNonBoundary, vwenv);
vwenv.AddProp(hasMinMax ? ktagInnerNonBoundary : ktagRightNonBoundary, this, kfragRightParenUpHook);
for (int i = 1; i < numLines - 1; i++)
vwenv.AddProp(hasMinMax ? ktagInnerNonBoundary : ktagRightNonBoundary, this, kfragRightParenExt);
vwenv.AddProp(hasMinMax ? ktagInnerNonBoundary : ktagRightBoundary, this, kfragRightParenLowHook);
vwenv.CloseInnerPile();
if (hasMinMax)
DisplayMinMax(numLines, vwenv);
}
}
//.........这里部分代码省略.........
示例8: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
// Ignore 0 hvo's. RootObject may have not been set. FWNX-613.
if (hvo == 0)
return;
switch(frag)
{
case kfragRoot:
if (m_dxLabWidth == 0)
{
int dmpx1, dmpy; //, dmpx2;
vwenv.get_StringWidth(m_tssTitle, m_ttpBold, out dmpx1, out dmpy);
//vwenv.get_StringWidth(m_tssComments, m_ttpBold, out dmpx2, out dmpy);
//m_dxLabWidth = Math.Max(dmpx1, dmpx2) + 13000; // add 3 pt spacing to box, 10 to margin.
m_dxLabWidth = dmpx1 + 13000; // add 3 pt spacing to box, 10 to margin.
m_dxWsLabWidth = 0;
foreach (ITsString tssLabel in m_WsLabels)
{
vwenv.get_StringWidth(tssLabel, m_ttpWsLabel, out dmpx1, out dmpy);
m_dxWsLabWidth = Math.Max(m_dxWsLabWidth, dmpx1);
}
m_dxWsLabWidth += 18000; // 3 pts white space each side, 11 margin, 1 border, plus 1 for safety.
}
VwLength vlTable;
vlTable.nVal = 10000;
vlTable.unit = VwUnit.kunPercent100;
VwLength vlColLabels; // 5-pt space plus max label width.
vlColLabels.nVal = m_dxLabWidth;
vlColLabels.unit = VwUnit.kunPoint1000;
VwLength vlColWsLabels; // 5-pt space plus max ws label width.
vlColWsLabels.nVal = m_dxWsLabWidth;
vlColWsLabels.unit = VwUnit.kunPoint1000;
// The Main column is relative and uses the rest of the space.
VwLength vlColMain;
vlColMain.nVal = 1;
vlColMain.unit = VwUnit.kunRelative;
// The Padding column allows for the the trailing margin and border.
VwLength vlColPadding;
vlColPadding.nVal = 10000;
vlColPadding.unit = VwUnit.kunPoint1000;
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginTop,
(int) FwTextPropVar.ktpvMilliPoint, 5000);
vwenv.OpenTable(4, // Four columns.
vlTable, // Table uses 100% of available width.
0, // Border thickness.
VwAlignment.kvaLeft, // Default alignment.
VwFramePosition.kvfpVoid, // No border.
VwRule.kvrlNone, // No rules between cells.
0, // No forced space between cells.
0, // no padding inside cells.
false);
vwenv.MakeColumns(1, vlColLabels);
vwenv.MakeColumns(1, vlColWsLabels);
vwenv.MakeColumns(1, vlColMain);
vwenv.MakeColumns(1, vlColPadding);
vwenv.OpenTableBody();
for (int i = 0; i < m_writingSystems.Length; i++)
{
vwenv.OpenTableRow();
// First cell has 'Title' label in bold.
vwenv.Props = m_ttpBold;
vwenv.OpenTableCell(1,1);
vwenv.set_IntProperty((int)FwTextPropType.ktptMarginLeading,
(int) FwTextPropVar.ktpvMilliPoint, 10000);
if (i == 0) // only on the first row
{
// We want this fixed at 10 point, since it's considered a UI component, not data.
// See LT-4816
vwenv.set_IntProperty((int)FwTextPropType.ktptFontSize,
(int)FwTextPropVar.ktpvMilliPoint, 10000);
vwenv.AddString(m_tssTitle);
}
vwenv.CloseTableCell();
// Second cell has ws labels.
vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor,
(int) FwTextPropVar.ktpvDefault, m_editBackColor);
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading,
(int)FwTextPropVar.ktpvMilliPoint, 1000);
if (i == 0)
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop,
(int)FwTextPropVar.ktpvMilliPoint, 1000);
if (i == m_writingSystems.Length - 1)
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom,
(int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.OpenTableCell(1,1);
vwenv.Props = m_ttpDataCellProps;
vwenv.Props = m_ttpWsLabel;
vwenv.AddString(m_WsLabels[i]);
//.........这里部分代码省略.........
示例9: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
var tsf = m_cache.TsStrFactory;
var userWs = m_cache.DefaultUserWs;
switch (frag)
{
case kfragRule:
m_rule = m_cache.ServiceLocator.GetInstance<IMoAffixProcessRepository>().GetObject(hvo);
VwLength tableLen;
tableLen.nVal = 10000;
tableLen.unit = VwUnit.kunPercent100;
vwenv.OpenTable(3, tableLen, 0, VwAlignment.kvaLeft, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 0, false);
VwLength inputLen;
inputLen.nVal = 0;
inputLen.unit = VwUnit.kunPoint1000;
int indexWidth = GetStrWidth(m_indexStr, m_headerProps, vwenv);
int inputWidth = GetStrWidth(m_inputStr, m_headerProps, vwenv);
VwLength headerLen;
headerLen.nVal = Math.Max(indexWidth, inputWidth) + 8000;
headerLen.unit = VwUnit.kunPoint1000;
inputLen.nVal += headerLen.nVal;
VwLength leftEmptyLen;
leftEmptyLen.nVal = 8000 + (PILE_MARGIN * 2) + 2000;
leftEmptyLen.unit = VwUnit.kunPoint1000;
inputLen.nVal += leftEmptyLen.nVal;
var ctxtLens = new VwLength[m_rule.InputOS.Count];
vwenv.NoteDependency(new[] {m_rule.Hvo}, new[] {MoAffixProcessTags.kflidInput}, 1 );
for (int i = 0; i < m_rule.InputOS.Count; i++)
{
int idxWidth = GetStrWidth(tsf.MakeString(Convert.ToString(i + 1), userWs), m_indexProps, vwenv);
int ctxtWidth = GetWidth(m_rule.InputOS[i], vwenv);
ctxtLens[i].nVal = Math.Max(idxWidth, ctxtWidth) + 8000 + 1000;
ctxtLens[i].unit = VwUnit.kunPoint1000;
inputLen.nVal += ctxtLens[i].nVal;
}
VwLength rightEmptyLen;
rightEmptyLen.nVal = 8000 + (PILE_MARGIN * 2) + 1000;
rightEmptyLen.unit = VwUnit.kunPoint1000;
inputLen.nVal += rightEmptyLen.nVal;
vwenv.MakeColumns(1, inputLen);
VwLength arrowLen;
arrowLen.nVal = GetStrWidth(m_doubleArrow, m_arrowProps, vwenv) + 8000;
arrowLen.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(1, arrowLen);
VwLength outputLen;
outputLen.nVal = 1;
outputLen.unit = VwUnit.kunRelative;
vwenv.MakeColumns(1, outputLen);
vwenv.OpenTableBody();
vwenv.OpenTableRow();
// input table cell
vwenv.OpenTableCell(1, 1);
vwenv.OpenTable(m_rule.InputOS.Count + 3, tableLen, 0, VwAlignment.kvaCenter, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 4000, false);
vwenv.MakeColumns(1, headerLen);
vwenv.MakeColumns(1, leftEmptyLen);
foreach (VwLength ctxtLen in ctxtLens)
vwenv.MakeColumns(1, ctxtLen);
vwenv.MakeColumns(1, rightEmptyLen);
vwenv.OpenTableBody();
vwenv.OpenTableRow();
// input header cell
vwenv.Props = m_headerProps;
vwenv.OpenTableCell(1, 1);
vwenv.AddString(m_inputStr);
vwenv.CloseTableCell();
// input left empty cell
vwenv.Props = m_ctxtProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, 1000);
vwenv.OpenTableCell(1, 1);
vwenv.OpenParagraph();
OpenContextPile(vwenv, false);
vwenv.Props = m_bracketProps;
vwenv.AddProp(ktagLeftEmpty, this, kfragEmpty);
CloseContextPile(vwenv, false);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
// input context cells
vwenv.AddObjVec(MoAffixProcessTags.kflidInput, this, kfragInput);
// input right empty cell
vwenv.Props = m_ctxtProps;
vwenv.OpenTableCell(1, 1);
vwenv.OpenParagraph();
OpenContextPile(vwenv, false);
vwenv.Props = m_bracketProps;
//.........这里部分代码省略.........
示例10: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
TriggerDisplay(vwenv);
// We use a table to display
// encodings in column one and the strings in column two.
// The table uses 100% of the available width.
VwLength vlTable;
vlTable.nVal = 10000;
vlTable.unit = VwUnit.kunPercent100;
// The width of the writing system column is determined from the width of the
// longest one which will be displayed.
m_mDxmpLabelWidth = 0;
for (int i = 0; i < m_rgws.Count; ++i)
{
int dxs; // Width of displayed string.
int dys; // Height of displayed string (not used here).
// Set qtss to a string representing the writing system.
vwenv.get_StringWidth(NameOfWs(i), m_ttpLabel, out dxs, out dys);
m_mDxmpLabelWidth = Math.Max(m_mDxmpLabelWidth, dxs);
}
VwLength vlColWs; // 5-pt space plus max label width.
vlColWs.nVal = m_mDxmpLabelWidth + 5000;
vlColWs.unit = VwUnit.kunPoint1000;
// Enhance JohnT: possibly allow for right-to-left UI by reversing columns?
// The Main column is relative and uses the rest of the space.
VwLength vlColMain;
vlColMain.nVal = 1;
vlColMain.unit = VwUnit.kunRelative;
vwenv.OpenTable(2, // Two columns.
vlTable, // Table uses 100% of available width.
0, // Border thickness.
VwAlignment.kvaLeft, // Default alignment.
VwFramePosition.kvfpVoid, // No border.
VwRule.kvrlNone, // No rules between cells.
0, // No forced space between cells.
0, // No padding inside cells.
false);
// Specify column widths. The first argument is the number of columns,
// not a column index. The writing system column only occurs at all if its
// width is non-zero.
vwenv.MakeColumns(1, vlColWs);
vwenv.MakeColumns(1, vlColMain);
vwenv.OpenTableBody();
var visibleWss = new Set<ILgWritingSystem>();
// if we passed in a view and have WritingSystemsToDisplay
// then we'll load that list in order to filter our larger m_rgws list.
AddViewWritingSystems(visibleWss);
for (int i = 0; i < m_rgws.Count; ++i)
{
if (SkipEmptyWritingSystem(visibleWss, i, hvo))
continue;
vwenv.OpenTableRow();
// First cell has writing system abbreviation displayed using m_ttpLabel.
vwenv.Props = m_ttpLabel;
vwenv.OpenTableCell(1,1);
vwenv.AddString(NameOfWs(i));
vwenv.CloseTableCell();
// Second cell has the string contents for the alternative.
// DN version has some property setting, including trailing margin and
// RTL.
if (m_rgws[i].RightToLeftScript)
{
vwenv.set_IntProperty((int)FwTextPropType.ktptRightToLeft,
(int)FwTextPropVar.ktpvEnum,
(int)FwTextToggleVal.kttvForceOn);
vwenv.set_IntProperty((int)FwTextPropType.ktptAlign,
(int)FwTextPropVar.ktpvEnum,
(int)FwTextAlign.ktalTrailing);
}
if (!m_editable)
{
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum,
(int)TptEditable.ktptNotEditable);
}
vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, 2000);
vwenv.OpenTableCell(1,1);
var wsdef = m_rgws[i] as WritingSystemDefinition;
if (wsdef != null && wsdef.IsVoice)
{
// We embed it in a conc paragraph to ensure it never takes more than a line.
// It will typically be covered up by a sound control.
// Also set foreground color to match the window, so nothing shows even if the sound doesn't overlap it perfectly.
// (transparent does not seem to work as a foreground color)
vwenv.set_IntProperty((int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault,
(int)ColorUtil.ConvertColorToBGR(Color.FromKnownColor(KnownColor.Window)));
// Must not spell-check a conc para, leads to layout failures when the paragraph tries to cast the source to
// a conc text source, if it is overridden by a spelling text source.
vwenv.set_IntProperty((int)FwTextPropType.ktptSpellCheck, (int)FwTextPropVar.ktpvEnum, (int)SpellingModes.ksmDoNotCheck);
vwenv.OpenConcPara(0, 1, VwConcParaOpts.kcpoDefault, 0);
vwenv.AddStringAltMember(m_flid, m_rgws[i].Handle, this);
vwenv.CloseParagraph();
//.........这里部分代码省略.........
示例11: Display
public override void Display(IVwEnv vwenv, int hvo, int frag)
{
switch (frag)
{
case kfragRHS:
m_rhs = m_cache.ServiceLocator.GetInstance<IPhSegRuleRHSRepository>().GetObject(hvo);
var rule = m_rhs.OwningRule;
if (rule.Disabled)
{
vwenv.set_StringProperty((int)FwTextPropType.ktptNamedStyle, "Disabled Text");
}
int arrowWidth, slashWidth, underscoreWidth, charHeight;
vwenv.get_StringWidth(m_arrow, m_charProps, out arrowWidth, out charHeight);
int maxCharHeight = charHeight;
vwenv.get_StringWidth(m_slash, m_charProps, out slashWidth, out charHeight);
maxCharHeight = Math.Max(charHeight, maxCharHeight);
vwenv.get_StringWidth(m_underscore, m_charProps, out underscoreWidth, out charHeight);
maxCharHeight = Math.Max(charHeight, maxCharHeight);
int dmpx, spaceHeight;
vwenv.get_StringWidth(m_zwSpace, m_bracketProps, out dmpx, out spaceHeight);
int maxNumLines = GetMaxNumLines();
int maxCtxtHeight = maxNumLines * spaceHeight;
int maxHeight = Math.Max(maxCharHeight, maxCtxtHeight);
int charOffset = maxHeight;
int ctxtPadding = maxHeight - maxCtxtHeight;
VwLength tableLen;
tableLen.nVal = 10000;
tableLen.unit = VwUnit.kunPercent100;
vwenv.OpenTable(7, tableLen, 0, VwAlignment.kvaCenter, VwFramePosition.kvfpVoid, VwRule.kvrlNone, 0, 0, false);
VwLength ctxtLen;
ctxtLen.nVal = 1;
ctxtLen.unit = VwUnit.kunRelative;
VwLength charLen;
charLen.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(1, ctxtLen);
charLen.nVal = arrowWidth + 4000;
vwenv.MakeColumns(1, charLen);
vwenv.MakeColumns(1, ctxtLen);
charLen.nVal = slashWidth + 4000;
vwenv.MakeColumns(1, charLen);
vwenv.MakeColumns(1, ctxtLen);
charLen.nVal = underscoreWidth + 4000;
vwenv.MakeColumns(1, charLen);
vwenv.MakeColumns(1, ctxtLen);
vwenv.OpenTableBody();
vwenv.OpenTableRow();
// LHS cell
vwenv.Props = m_ctxtProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
vwenv.OpenTableCell(1, 1);
vwenv.OpenParagraph();
vwenv.AddObjProp(m_cache.MetaDataCacheAccessor.GetFieldId2(PhSegRuleRHSTags.kClassId, "OwningRule", false), this, kfragRule);
vwenv.CloseParagraph();
vwenv.CloseTableCell();
// arrow cell
vwenv.Props = m_charProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
vwenv.OpenTableCell(1, 1);
vwenv.AddString(m_arrow);
vwenv.CloseTableCell();
// RHS cell
vwenv.Props = m_ctxtProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, ctxtPadding);
vwenv.OpenTableCell(1, 1);
vwenv.OpenParagraph();
if (m_rhs.StrucChangeOS.Count > 0)
{
vwenv.AddObjVecItems(PhSegRuleRHSTags.kflidStrucChange, this, kfragContext);
}
else
{
vwenv.NoteDependency(new[] {hvo}, new[] {PhSegRuleRHSTags.kflidStrucChange}, 1);
OpenSingleLinePile(vwenv, maxNumLines, false);
vwenv.Props = m_bracketProps;
vwenv.AddProp(PhSegRuleRHSTags.kflidStrucChange, this, kfragEmpty);
CloseSingleLinePile(vwenv, false);
}
vwenv.CloseParagraph();
vwenv.CloseTableCell();
// slash cell
vwenv.Props = m_charProps;
vwenv.set_IntProperty((int)FwTextPropType.ktptOffset, (int)FwTextPropVar.ktpvMilliPoint, -charOffset);
vwenv.OpenTableCell(1, 1);
//.........这里部分代码省略.........
示例12: MakeTableAndRowWithStdWidths
//.........这里部分代码省略.........
/// </summary>
/// <param name="vwenv"></param>
/// <param name="hvo"></param>
/// <param name="fHeader">true if it is a header; hvo is a chart instead of a row.</param>
private void MakeTableAndRowWithStdWidths(IVwEnv vwenv, int hvo, bool fHeader)
{
VwLength tableWidth = new VwLength();
if (m_colWidths == null)
{
tableWidth.nVal = 10000; // 100%
tableWidth.unit = VwUnit.kunPercent100;
}
else
{
tableWidth.nVal = 0;
foreach (VwLength w in m_colWidths)
tableWidth.nVal += w.nVal;
tableWidth.unit = VwUnit.kunPoint1000;
}
if (!fHeader)
SetRowStyle(vwenv, hvo);
VwFramePosition fpos = VwFramePosition.kvfpVsides;
if (fHeader)
{
fpos = (VwFramePosition)((int)fpos | (int)VwFramePosition.kvfpAbove);
}
else
{
int hvoOuter, tagOuter, ihvoRow;
vwenv.GetOuterObject(0, out hvoOuter, out tagOuter, out ihvoRow);
if (ihvoRow == 0)
{
fpos = (VwFramePosition)((int)fpos | (int)VwFramePosition.kvfpAbove);
}
if (ihvoRow == vwenv.DataAccess.get_VecSize(hvoOuter, tagOuter) - 1
|| ConstituentChartLogic.GetFeature(vwenv.DataAccess, hvo, "endPara"))
{
fpos = (VwFramePosition)((int)fpos | (int)VwFramePosition.kvfpBelow);
}
}
// We seem to typically inherit a white background as a side effect of setting our stylesheet,
// but borders on table rows don't show through if backcolor is set to white, because the
// cells entirely cover the row (LT-9068). So force the back color to be transparent, and allow
// the row border to show through the cell.
vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor,
(int)FwTextPropVar.ktpvDefault,
(int)FwTextColor.kclrTransparent);
vwenv.OpenTable(m_chart.AllColumns.Length + ConstituentChartLogic.NumberOfExtraColumns,
tableWidth,
1500, // borderWidth
VwAlignment.kvaLeft, // Todo: handle RTL
fpos,
VwRule.kvrlNone,
0, // cell spacing
2000, // cell padding
true); // selections limited to one cell.
if (m_colWidths == null)
{
VwLength numColWidth = new VwLength();
numColWidth.nVal = NumColWidth;
numColWidth.unit = VwUnit.kunPoint1000;
vwenv.MakeColumns(1, numColWidth);
VwLength colWidth = new VwLength();
colWidth.nVal = 1;
colWidth.unit = VwUnit.kunRelative;
int followingCols = ConstituentChartLogic.NumberOfExtraColumns -
ConstituentChartLogic.IndexOfFirstTemplateColumn;
vwenv.MakeColumns(m_chart.AllColumns.Length + followingCols, colWidth);
}
else
{
foreach (VwLength colWidth in m_colWidths)
{
vwenv.MakeColumns(1, colWidth);
}
}
// Set row bottom border color and size of table body rows
if (!fHeader)
{
if (ConstituentChartLogic.GetFeature(vwenv.DataAccess, hvo, "endSent"))
{
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderColor,
(int)FwTextPropVar.ktpvDefault,
(int)ColorUtil.ConvertColorToBGR(Color.Black));
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom,
(int)FwTextPropVar.ktpvMilliPoint, 1000);
}
else
{
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderColor,
(int)FwTextPropVar.ktpvDefault,
(int)ColorUtil.ConvertColorToBGR(Color.LightGray));
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom,
(int)FwTextPropVar.ktpvMilliPoint, 500);
}
}
vwenv.OpenTableRow();
}
示例13: MakeTableAndRowWithStdWidths
//.........这里部分代码省略.........
/// <param name="hvo"></param>
/// <param name="fHeader">true if it is a header; hvo is a chart instead of a row.</param>
private void MakeTableAndRowWithStdWidths(IVwEnv vwenv, int hvo, bool fHeader)
{
IConstChartRow row = null;
if (!fHeader)
row = m_rowRepo.GetObject(hvo);
var tableWidth = new VwLength();
if (m_colWidths == null)
{
tableWidth.nVal = 10000; // 100%
tableWidth.unit = VwUnit.kunPercent100;
}
else
{
tableWidth.nVal = 0;
foreach (var w in m_colWidths)
tableWidth.nVal += w.nVal;
tableWidth.unit = VwUnit.kunPoint1000;
}
if (!fHeader)
SetRowStyle(vwenv, row);
var fpos = VwFramePosition.kvfpVsides;
if (fHeader)
{
fpos = (VwFramePosition)((int)fpos | (int)VwFramePosition.kvfpAbove);
}
else
{
int hvoOuter, tagOuter, ihvoRow;
vwenv.GetOuterObject(0, out hvoOuter, out tagOuter, out ihvoRow);
if (ihvoRow == 0)
{
fpos = (VwFramePosition)((int)fpos | (int)VwFramePosition.kvfpAbove);
}
if (ihvoRow == vwenv.DataAccess.get_VecSize(hvoOuter, tagOuter) - 1
|| row.EndParagraph)
{
fpos = (VwFramePosition)((int)fpos | (int)VwFramePosition.kvfpBelow);
}
}
// We seem to typically inherit a white background as a side effect of setting our stylesheet,
// but borders on table rows don't show through if backcolor is set to white, because the
// cells entirely cover the row (LT-9068). So force the back color to be transparent, and allow
// the row border to show through the cell.
var fRtL = m_chart.IsRightToLeft;
vwenv.set_IntProperty((int)FwTextPropType.ktptBackColor,
(int)FwTextPropVar.ktpvDefault,
(int)FwTextColor.kclrTransparent);
vwenv.OpenTable(m_chart.AllColumns.Length + ConstituentChartLogic.NumberOfExtraColumns,
tableWidth,
1500, // borderWidth
fRtL ? VwAlignment.kvaRight : VwAlignment.kvaLeft, // Handle RTL
fpos,
VwRule.kvrlNone,
0, // cell spacing
2000, // cell padding
true); // selections limited to one cell.
if (m_colWidths == null)
{
if (fRtL)
{
MakeColumnsOtherThanRowNum(vwenv);
MakeRowNumColumn(vwenv);
}
else
{
MakeRowNumColumn(vwenv);
MakeColumnsOtherThanRowNum(vwenv);
}
}
else
{
foreach (var colWidth in m_colWidths)
vwenv.MakeColumns(1, colWidth);
}
// Set row bottom border color and size of table body rows
if (!fHeader)
{
if (row.EndSentence)
{
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderColor,
(int)FwTextPropVar.ktpvDefault,
(int)ColorUtil.ConvertColorToBGR(Color.Black));
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom,
(int)FwTextPropVar.ktpvMilliPoint, 1000);
}
else
{
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderColor,
(int)FwTextPropVar.ktpvDefault,
(int)ColorUtil.ConvertColorToBGR(Color.LightGray));
vwenv.set_IntProperty((int)FwTextPropType.ktptBorderBottom,
(int)FwTextPropVar.ktpvMilliPoint, 500);
}
}
vwenv.OpenTableRow();
}
示例14: DisplayWithWritingSystemLabel
private void DisplayWithWritingSystemLabel(IVwEnv vwenv, int ws)
{
ITsString tssLabel = NameOfWs(ws);
// We use a table to display
// encodings in column one and the strings in column two.
// The table uses 100% of the available width.
VwLength vlTable;
vlTable.nVal = 10000;
vlTable.unit = VwUnit.kunPercent100;
int dxs; // Width of displayed string.
int dys; // Height of displayed string (not used here).
vwenv.get_StringWidth(tssLabel, null, out dxs, out dys);
VwLength vlColWs; // 5-pt space plus max label width.
vlColWs.nVal = dxs + 5000;
vlColWs.unit = VwUnit.kunPoint1000;
// The Main column is relative and uses the rest of the space.
VwLength vlColMain;
vlColMain.nVal = 1;
vlColMain.unit = VwUnit.kunRelative;
// Enhance JohnT: possibly allow for right-to-left UI by reversing columns?
vwenv.OpenTable(2, // Two columns.
vlTable, // Table uses 100% of available width.
0, // Border thickness.
VwAlignment.kvaLeft, // Default alignment.
VwFramePosition.kvfpVoid, // No border.
VwRule.kvrlNone, // No rules between cells.
0, // No forced space between cells.
0, // No padding inside cells.
false);
// Specify column widths. The first argument is the number of columns,
// not a column index. The writing system column only occurs at all if its
// width is non-zero.
vwenv.MakeColumns(1, vlColWs);
vwenv.MakeColumns(1, vlColMain);
vwenv.OpenTableBody();
vwenv.OpenTableRow();
// First cell has writing system abbreviation displayed using m_ttpLabel.
//vwenv.Props = m_ttpLabel;
vwenv.OpenTableCell(1, 1);
vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum,
(int)TptEditable.ktptNotEditable);
vwenv.AddString(tssLabel);
vwenv.CloseTableCell();
// Second cell has the string contents for the alternative.
// DN version has some property setting, including trailing margin and RTL.
if (m_fRtlScript)
{
vwenv.set_IntProperty((int) FwTextPropType.ktptRightToLeft,
(int) FwTextPropVar.ktpvEnum,
(int) FwTextToggleVal.kttvForceOn);
vwenv.set_IntProperty((int) FwTextPropType.ktptAlign,
(int) FwTextPropVar.ktpvEnum,
(int) FwTextAlign.ktalTrailing);
}
//if (!m_editable)
//{
// vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum,
// (int)TptEditable.ktptNotEditable);
//}
vwenv.set_IntProperty((int) FwTextPropType.ktptPadTop, (int) FwTextPropVar.ktpvMilliPoint, 2000);
vwenv.OpenTableCell(1, 1);
vwenv.AddStringProp(m_flid, this);
vwenv.CloseTableCell();
vwenv.CloseTableRow();
vwenv.CloseTableBody();
vwenv.CloseTable();
}
示例15: AddDoublePara
internal void AddDoublePara(IVwEnv vwenv, int hvo)
{
// We use a table to display the source WS in column 1, and the dest ws in column 2.
FwViews.VwLength vlTable; // we use this to specify that the table takes 100% of the width.
vlTable.nVal = 10000;
vlTable.unit = FwViews.VwUnit.kunPercent100;
FwViews.VwLength vlColumn; // and this one to specify half the width for each column
vlColumn.nVal = 5000;
vlColumn.unit = FwViews.VwUnit.kunPercent100;
// Enhance JohnT: possibly allow for right-to-left UI by reversing columns?
vwenv.OpenTable(2, // Two columns.
ref vlTable, // Table uses 100% of available width.
0, // Border thickness.
FwViews.VwAlignment.kvaLeft, // Default alignment.
FwViews.VwFramePosition.kvfpVoid, // No border.
FwViews.VwRule.kvrlNone, // No rules between cells.
3000, // Three points of space between cells.
3000); // Three points padding inside cells.
// Specify column widths. The first argument is the number of columns,
// not a column index.
vwenv.MakeColumns(2, vlColumn);
vwenv.OpenTableBody();
vwenv.OpenTableRow();
// Source cell, not editable
vwenv.OpenTableCell(1,1);
vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptEditable, (int)FwKernelLib.FwTextPropVar.ktpvEnum,
(int)FwKernelLib.TptEditable.ktptNotEditable);
vwenv.AddStringAltMember(ktagParaContents, m_wsSrc, this);
vwenv.CloseTableCell();
// Dest cell, editable, therefore with white background.
vwenv.set_IntProperty((int)FwKernelLib.FwTextPropType.ktptBackColor, (int)FwKernelLib.FwTextPropVar.ktpvDefault,
m_colorEditable);
vwenv.OpenTableCell(1,1);
vwenv.AddStringAltMember(ktagParaContents, m_wsDst, this);
vwenv.CloseTableCell();
vwenv.CloseTableRow();
vwenv.CloseTableBody();
vwenv.CloseTable();
}