1. 程式人生 > >devexpress gridview 儲存、載入佈局

devexpress gridview 儲存、載入佈局

一次在糾結devexpress gridview 列隱藏後顯示時順序亂了的問題,QQ群裡一個朋友提示的一些資訊,記錄下來。

1、隱藏列後visibleIndex的值為-1;

2、一種解決方案:

private void gcPlan_Load(object sender, EventArgs e)

        {
            if (File.Exists(Application.StartupPath + @"\" + this.Text + ".xml"))
            {
                gvList.RestoreLayoutFromXml(Application.StartupPath + @"\" + this.Text + ".xml"); //載入佈局
            }
        }


        private void gvList_Layout(object sender, EventArgs e)
        {
            gvList.SaveLayoutToXml(Application.StartupPath + @"\" + this.Text + ".xml");//儲存佈局

        }