hMailServer.Administrator.ucListView.LoadWidths C# (CSharp) Method

LoadWidths() public method

Loads the width of the columns from the registry.
public LoadWidths ( string viewName ) : void
viewName string
return void
        public void LoadWidths(string viewName)
        {
            var currentUserKey = Registry.CurrentUser;
             var administratorKey = currentUserKey.CreateSubKey(ListViewSaveLocation);

             for (int i = 0; i < Columns.Count; i++)
             {
            var columnHeader = Columns[i];
            string columnName = viewName + "_" + columnHeader.Text;
            object value = administratorKey.GetValue(columnName, null);

            if (value is int)
               columnHeader.Width = Convert.ToInt32(value);
             }

             administratorKey.Close();
             currentUserKey.Close();
        }