This commit is contained in:
parent
ffd710139f
commit
ec3ae2b100
@ -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; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Similar to <code><see cref="DialogResult"/>
|
||||
/// == <see cref="DialogResult.Cancel"/></code>,
|
||||
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
//{
|
||||
// StepRTB trtb = new StepRTB();
|
||||
|
Loading…
x
Reference in New Issue
Block a user