【问题标题】:How to set Dialog text position from code?如何从代码设置对话框文本位置?
【发布时间】:2015-05-21 14:54:49
【问题描述】:

大家好,
我有一个简单的Dialog 在单击按钮后启动,我发布我的代码:

Dialog dialog;

super();

dialog = new Dialog("Dialog example");

dialog.addText(strFmt("Text to show"));
dialog.addText(strfmt("SecondText to show"));

dialog.run();

我将显示一个Dialog 窗口,如下所示:

可以从代码中设置位置的文本:要显示的文本? 例如,如果我想居中放置第二个文本我应该怎么做?

我尝试在代码中添加空格:

dialog.addText(strfmt("       Text to show"));

但是没有任何改变,我认为这不是好方法。 我在网上看到了任何建议,但或者我用得不好或不适合我:Example-suggestions。 有一种方法可以做我想做的事吗?

感谢您的帮助,

享受吧!

【问题讨论】:

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


    【解决方案1】:

    您可以使用表单控件使文本居中:

    Dialog dialog = new Dialog("Dialog example");
    DialogText t1 = dialog.addText(strFmt("Text to show"));
    DialogText t2 = dialog.addText(strfmt("SecondText to show"));
    FormStaticTextControl c1 = t1.control();
    c1.widthMode(FormWidth::ColumnWidth);
    c1.alignment(FormAlignment::Center);
    dialog.run();
    

    第一个控件现在居中(对周围的组)。 您必须给它ColumnWidth,否则控件将具有最小尺寸并且居中将不起作用。

    【讨论】:

      猜你喜欢
      • 2011-10-22
      • 2011-06-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-17
      • 2020-08-03
      • 1970-01-01
      • 2023-04-06
      相关资源
      最近更新 更多