This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user