自动生成LayoutControl后,界面总是不对:
DX:神奇的LayoutControl.BestFit()
在LayoutControl中找到一个BestFit()方法,调用后神奇的结果出现了,这不正是我想要的吗?
DX:神奇的LayoutControl.BestFit()
测试代码:

public partial class TEST2 : Form
{
    public TEST2()
    {
        InitializeComponent();
    }

    private void TEST2_Load(object sender, EventArgs e)
    {
        layoutControl1.Root.Clear();

        LayoutControlItem billDateItem = new LayoutControlItem();
        billDateItem.Control = new TextEdit();
        billDateItem.Text = "日期";
        billDateItem.AppearanceItemCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;
        layoutControl1.Root.AddItem(billDateItem);

        LayoutControlItem billCodeItem = new LayoutControlItem();
        billCodeItem.Control = new TextEdit();
        billCodeItem.Text = "单号";
        billCodeItem.AppearanceItemCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;
        layoutControl1.Root.AddItem(billCodeItem, billDateItem, InsertType.Right);

        LayoutControlItem billStateItem = new LayoutControlItem();
        billStateItem.Control = new TextEdit();
        billStateItem.Text = "状态";
        billStateItem.AppearanceItemCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;
        layoutControl1.Root.AddItem(billStateItem, billDateItem, InsertType.Right);

        LayoutControlItem iotypeItem = new LayoutControlItem();
        iotypeItem.Control = new TextEdit();
        iotypeItem.Text = "出入库类型";
        iotypeItem.AppearanceItemCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;
        layoutControl1.Root.AddItem(iotypeItem);

        LayoutControlItem workshopItem = new LayoutControlItem();
        workshopItem.Control = new TextEdit();
        workshopItem.Text = "生产车间";
        workshopItem.AppearanceItemCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;
        layoutControl1.Root.AddItem(workshopItem, iotypeItem, InsertType.Right);

        LayoutControlItem warehouseItem = new LayoutControlItem();
        warehouseItem.Control = new TextEdit();
        warehouseItem.Text = "仓库";
        warehouseItem.AppearanceItemCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;
        layoutControl1.Root.AddItem(warehouseItem, iotypeItem, InsertType.Right);

        layoutControl1.BestFit();
    }
}

相关文章:

  • 2021-05-19
  • 2022-03-07
  • 2021-12-29
  • 2021-07-20
  • 2022-03-08
  • 2021-10-24
  • 2021-06-08
  • 2021-10-11
猜你喜欢
  • 2021-10-17
  • 2021-12-11
  • 2021-04-20
  • 2021-08-07
  • 2021-06-13
  • 2021-04-11
  • 2021-12-03
相关资源
相似解决方案