如何将普通文本转换为粗体文本?

时间:2015-05-19 07:42:30

标签: dialog axapta dynamics-ax-2012 x++

我在Dialog

中有这段代码
//other code
dialog.addText(strFmt("Delete this field's value: %1?", MyTable.FieldTable));
//other code

我的输出看起来很像:

I have an output looklike

我知道strUpr功能:

dialog.addText(strFmt("Delete this field's value: %1?", strUpr(MyTable.FieldTable)));

是否存在仅将 FIELDValue 转换为粗体文字的方法或功能?

3 个答案:

答案 0 :(得分:5)

您可以在bold上将FormBuildStaticTextControl属性设置为7

可以通过DialogText方法返回的addText上的control方法获取控件。

  

返回的整数包含字体的权重,如下所示:

0 Use the default font weight. 
1 Thin. 
2 Extra-light. 
3 Light. 
4 Normal. 
5 Medium. 
6 Semibold. 
7 Bold. 
8 Extra-bold. 
9 Heavy. 

示例:

Dialog dialog = new Dialog();
DialogText dt = dialog.addText("Test");
FormBuildStaticTextControl txtCtl = dt.control();
txtCtl.bold(7);

dialog.run();

答案 1 :(得分:1)

使用addFieldValue的工作示例(类似于Matej的解决方案):

Dialog dialog = new Dialog("Dialog example");
DialogField f1 = dialog.addFieldValue(extendedTypeStr(String30), 'Value', "Delete this field's value?");
FormBuildStringControl c1 = f1.control();
c1.allowEdit(false);
c1.skip(true);
c1.bold(7);
c1.viewEditMode(ViewEditMode::View);
dialog.run();

答案 2 :(得分:0)

我怀疑Dialog类是否能够显示粗体文本,至少我没有看到过这样的文字,我也没有找到任何方法来在对话框中格式化文本。一种解决方案是创建看起来像对话框的自定义表单,但我认为它是多余的。

关于大写,您可以使用strUprlink)方法:

//other code
dialog.addText(strUpr(strFmt("Delete this field's value: %1?", MyTable.FieldTable)));
//other code
相关问题