/// <summary> /// Handler for all show/hide column buttons. /// </summary> /// <param name="sender">Identifies the button that was clicked.</param> /// <param name="e">Stuff.</param> private void ColumnVisibilityButtonClick(object sender, EventArgs e) { int index = -1; for (int i = 0; i < mColButtons.Length; i++) { if (sender == mColButtons[i]) { index = i; break; } } Debug.Assert(index != -1); string widthStr = mSettings.GetString(AppSettings.CDLV_COL_WIDTHS, null); Debug.Assert(!string.IsNullOrEmpty(widthStr)); ProjectView.CodeListColumnWidths widths = ProjectView.CodeListColumnWidths.Deserialize(widthStr); if (widths.Width[index] == 0) { // Expand to default width. The default width changes when the font // changes, so it's best to just reacquire the default width set as needed. ProjectView.CodeListColumnWidths defaultWidths = mProjectView.GetDefaultCodeListColumnWidths(); widths.Width[index] = defaultWidths.Width[index]; } else { widths.Width[index] = 0; } widthStr = widths.Serialize(); mSettings.SetString(AppSettings.CDLV_COL_WIDTHS, widthStr); SetShowHideButton(index, widths.Width[index]); SetDirty(true); }