/// <summary> /// set visible column /// </summary> /// <param name = "visible"> </param> internal void setVisible(bool visible) { if (visible == Visible) { return; } bool applyPlacement = false; bool layoutSuspended = false; if (visible == false) { TableColumn.Dispose(); TableColumn = null; //If there is no scrollbar (i.e. there is blank area) after hiding the column, apply the placement. if (_tableManager.FillWidth) { applyPlacement = !_tableControl.isHscrollShown(); } } else if (visible) { if (_tableManager.FillWidth) { //If there is scrollbar even before showing the new column, do not apply the placement. applyPlacement = !_tableControl.isHscrollShown(); if (applyPlacement) { _tableManager._tableControl.SuspendLayout(); layoutSuspended = true; } } List <ILogicalColumn> columns = _tableManager.getColumns(); int guiColumnIdx = 0; // find new Gui index int orgGuiIndex = columns.IndexOf(this); for (int i = 0; i < orgGuiIndex; i++) { if (((LgColumn)columns[i]).GuiColumnIdx >= 0) { guiColumnIdx++; } } TableColumn = new TableColumn(); _tableControl.Columns.Insert(guiColumnIdx, TableColumn); TableColumn.Tag = new TagData(); ColumnHandler.getInstance().addHandler(TableColumn); var td = (TagData)TableColumn.Tag; td.ColumnManager = this; // set column properties TableColumn.Text = Text; TableColumn.FgColor = FgColor; TableColumn.BgColor = BgColor; TableColumn.Font = Font; TableColumn.ContentAlignment = ContentAlignment; TableColumn.FontOrientation = FontOrientation; TableColumn.AllowFilter = AllowFilter; TableColumn.RightBorder = RightBorder; TableColumn.TopBorder = TopBorder; TableColumn.Width = Width; } _logicalColumnHelper.Visible = visible; base.Visible = visible; if (applyPlacement) { _tableManager.ExecuteFillTablePlacement(); if (layoutSuspended) { _tableManager._tableControl.ResumeLayout(); } } _tableManager.updateEditorsOnColumnVisibility(MgColumnIdx, visible); }