This commit is contained in:
John Jenko 2011-04-29 15:34:16 +00:00
parent ffd710139f
commit ec3ae2b100
3 changed files with 55 additions and 0 deletions

View File

@ -102,6 +102,22 @@ namespace Accentra.Controls
private bool bHiding = false; private bool bHiding = false;
private bool bCancel = true; // Determines whether to Cancel 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; }
}
/// <summary> /// <summary>
/// Similar to <code><see cref="DialogResult"/> /// Similar to <code><see cref="DialogResult"/>
/// == <see cref="DialogResult.Cancel"/></code>, /// == <see cref="DialogResult.Cancel"/></code>,
@ -146,6 +162,9 @@ namespace Accentra.Controls
if (SquareQX < 7) SquareQX = 7; if (SquareQX < 7) SquareQX = 7;
if (SquareQY < 5) SquareQY = 5; 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 // Second, expand the dimensions of this form according to the
// number of visible squares. // number of visible squares.
this.Width = (SquareX * (SquareQX)) + 5; this.Width = (SquareX * (SquareQX)) + 5;

View File

@ -1641,6 +1641,8 @@ namespace Volian.Controls.Library
TablePicker tpdlg = new TablePicker(); TablePicker tpdlg = new TablePicker();
tpdlg.Location = pt; tpdlg.Location = pt;
tpdlg.Left = left; tpdlg.Left = left;
tpdlg.MaxCols = 20;
tpdlg.MaxRows = 30;
DialogResult dr = tpdlg.ShowDialog(); DialogResult dr = tpdlg.ShowDialog();
while (tpdlg.Visible) while (tpdlg.Visible)
{ {
@ -1656,6 +1658,7 @@ namespace Volian.Controls.Library
VE_Font vefont = MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.Table.Font; VE_Font vefont = MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.Table.Font;
Font GridFont = new Font(vefont.Family, (float)vefont.Size); Font GridFont = new Font(vefont.Family, (float)vefont.Size);
grd.Font = GridFont; grd.Font = GridFont;
grd.FitTableToPageWidth((int)(MyItemInfo.MyDocStyle.Layout.PageWidth - MyItemInfo.MyDocStyle.Layout.LeftMargin));
} }
return grd; return grd;
} }

View File

@ -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;
}
/// <summary>
/// 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.
/// </summary>
/// <param name="pgWidthPoints"></param>
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) //private void AdjustCellHeightWidth(int r, int c)
//{ //{
// StepRTB trtb = new StepRTB(); // StepRTB trtb = new StepRTB();