• DX:神奇的LayoutControl.BestFit()


    自动生成LayoutControl后,界面总是不对:

    在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();
        }
    }
  • 相关阅读:
    java实现万年历
    XCTF 逆向 re1-100
    iOS多线程开发之GCD
    Hexo Next统计文章访问量
    Name/Value 配對和物件
    Mac系统Git生成ssh公钥
    《大话数据结构》三
    C++指针和引用
    英语语法讲解第一课句子成分-表语
    String-mainipulation7
  • 原文地址:https://www.cnblogs.com/eastson/p/3865086.html
Copyright © 2020-2023  润新知