diff --git a/PROMS/TablePicker/TablePicker.cs b/PROMS/TablePicker/TablePicker.cs index a0908cbb..92369edb 100644 --- a/PROMS/TablePicker/TablePicker.cs +++ b/PROMS/TablePicker/TablePicker.cs @@ -102,6 +102,22 @@ namespace Accentra.Controls private bool bHiding = false; private bool bCancel = true; // Determines whether to Cancel + // Added my Volian 4/27/11 + private int _MaxRows = -1; + + public int MaxRows + { + get { return _MaxRows; } + set { _MaxRows = value; } + } + private int _MaxCols = -1; + + public int MaxCols + { + get { return _MaxCols; } + set { _MaxCols = value; } + } + /// /// Similar to /// == , @@ -146,6 +162,9 @@ namespace Accentra.Controls if (SquareQX < 7) SquareQX = 7; if (SquareQY < 5) SquareQY = 5; + if (_MaxRows > 0 && SquareQY > _MaxRows) SquareQY = _MaxRows; + if (_MaxCols > 0 && SquareQX > _MaxCols) SquareQX = _MaxCols; + // Second, expand the dimensions of this form according to the // number of visible squares. this.Width = (SquareX * (SquareQX)) + 5; diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index f91823be..41cfc526 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -1641,6 +1641,8 @@ namespace Volian.Controls.Library TablePicker tpdlg = new TablePicker(); tpdlg.Location = pt; tpdlg.Left = left; + tpdlg.MaxCols = 20; + tpdlg.MaxRows = 30; DialogResult dr = tpdlg.ShowDialog(); while (tpdlg.Visible) { @@ -1656,6 +1658,7 @@ namespace Volian.Controls.Library VE_Font vefont = MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.Table.Font; Font GridFont = new Font(vefont.Family, (float)vefont.Size); grd.Font = GridFont; + grd.FitTableToPageWidth((int)(MyItemInfo.MyDocStyle.Layout.PageWidth - MyItemInfo.MyDocStyle.Layout.LeftMargin)); } return grd; } diff --git a/PROMS/Volian.Controls.Library/VlnFlexGrid.cs b/PROMS/Volian.Controls.Library/VlnFlexGrid.cs index fd172a77..9bfea34d 100644 --- a/PROMS/Volian.Controls.Library/VlnFlexGrid.cs +++ b/PROMS/Volian.Controls.Library/VlnFlexGrid.cs @@ -1533,6 +1533,39 @@ namespace Volian.Controls.Library } } } + + private int TotalColWidths() + { + int cwid = 0; + foreach (Column c in Cols) + { + cwid += ((c.Width > 0) ? c.Width : Cols.DefaultSize); + } + return cwid; + } + /// + /// This will adjust the column widths of the current table based upon the page width + /// Note: This is for use in creating a new table - not to process an existing table. + /// + /// + public void FitTableToPageWidth(int pgWidthPoints) + { + int grdWidth = TotalColWidths(); + int pgwidth = (int)((pgWidthPoints / 72) * this._DPI); + + if (grdWidth > pgwidth) + { + int difWid = grdWidth - pgwidth; + int colAdj = (difWid / Cols.Count) +(((difWid % Cols.Count) > 0) ? 1 : 0); + foreach (Column c in Cols) + { + int cwid = (c.Width > 0) ? c.Width : Cols.DefaultSize; + if ((cwid - colAdj) > 0) + c.Width = cwid - colAdj; + } + } + } + //private void AdjustCellHeightWidth(int r, int c) //{ // StepRTB trtb = new StepRTB();