📄 tlmbase.cs
字号:
}
}
if (iRow >= aTlmRow.iCount) {
return false;
}
// Set vertical position of committed rows and close all rows except the last one
for (; ; iRow++) {
TlmRow row = aTlmRow[iRow];
row.rPosTop = rY;
rY = row.rCalculateBottomPos(false);
if (!Double.IsNaN(row.rPreferredHeight)) { // set preferred row height
Double rRowHeight = rY - row.rPosTop;
if (row.rPreferredHeight > rRowHeight) {
rY = row.rPosTop + row.rPreferredHeight;
}
}
row.rPosBottom = rY;
if (rY > container_Cur.rHeight) { // new container required
if (breakMode == BreakMode.Row) {
}
if (tlmRow_Committed == null) { // new container required
tlmRow_Committed = row;
Boolean bRetVal = false;
foreach (TlmColumn col in al_TlmColumn) {
TlmCell cell = tlmRow_Committed.aTlmCell[col];
col.iRepObjCommitted = 0;
for (Int32 iRepObj = 0; iRepObj < cell.iRepObjCount; iRepObj++) {
RepObj repObj = cell.repObj_Get(iRepObj);
if (tlmRow_Committed.rPosTop + repObj.rY + repObj.rHeight > container_Cur.rHeight) { // new container required
bRetVal = true;
break;
}
col.iRepObjCommitted = iRepObj + 1;
}
}
return bRetVal;
}
return true;
}
if (iRow >= aTlmRow.iCount - 1) { // last row
_rCurY = rY;
tlmRow_Committed = aTlmRow[iRow];
return false;
}
row.Close();
}
}
//------------------------------------------------------------------------------------------27.12.2003
/// <summary>Commits the current contents.</summary>
/// <remarks>All rows will be closed except the last.</remarks>
public void Commit() {
while (bCommit()) {
WriteCommittedReportObjects(false);
CreateNewContainer();
}
}
//------------------------------------------------------------------------------------------27.12.2003
/// <summary>Writes all objects to the report.</summary>
private void WriteAll() {
Commit();
WriteCommittedReportObjects(true);
}
#endregion
//----------------------------------------------------------------------------------------------------x
#region Container
//----------------------------------------------------------------------------------------------------x
/// <summary>Default height of the table (points, 1/72 inch)</summary>
public Double rContainerHeight = 72 * 1000;
/// <summary>Default height of the table (mm)</summary>
public Double rContainerHeightMM {
get { return RT.rMMFromPoint(rContainerHeight); }
set { rContainerHeight = RT.rPointFromMM(value); }
}
private Container _container_Cur;
/// <summary>Current container</summary>
public Container container_Cur {
get { return _container_Cur; }
}
//------------------------------------------------------------------------------------------06.01.2004
/// <summary>Table height mode</summary>
public enum TableHeight {
/// <summary>Adjust height of last container</summary>
AdjustLast,
/// <summary>Adjust height of each container</summary>
Adjust,
/// <summary>No adjustment</summary>
Static
}
/// <summary>Table height mode</summary>
public TableHeight tableHeight = TableHeight.Adjust;
/// <summary>Table height mode (VB version)</summary>
public TableHeight _tableHeight {
get { return tableHeight; }
set { tableHeight = value; }
}
//----------------------------------------------------------------------------------------------------x
/// <summary>Provides data for the NewContainer event</summary>
public class NewContainerEventArgs : EventArgs {
/// <summary>Table layout manager</summary>
public readonly TlmBase tlm;
/// <summary>New container</summary>
public readonly Container container;
/// <summary>Creates a data object for the NewContainer event.</summary>
/// <param name="tlmBase">Table layout manager</param>
/// <param name="container">New container: this container must be added to a page or a container.</param>
internal NewContainerEventArgs(TlmBase tlmBase, Container container) {
this.tlm = tlmBase;
this.container = container;
}
}
/// <summary>Represents the method that will handle the NewContainer event.</summary>
public delegate void NewContainerEventHandler(Object oSender, NewContainerEventArgs ea);
/// <summary>Occurs when a new container must be created.</summary>
public event NewContainerEventHandler eNewContainer;
//----------------------------------------------------------------------------------------------------x
/// <summary>Raises the NewContainer event.</summary>
/// <param name="ea">Event argument</param>
internal protected virtual void OnNewContainer(NewContainerEventArgs ea) {
if (eNewContainer != null) {
eNewContainer(this, ea);
}
}
//----------------------------------------------------------------------------------------------------x
/// <summary>Creates a new container.</summary>
private void CreateNewContainer() {
if (_container_Cur == null) {
_container_Cur = new StaticContainer(rWidth, rContainerHeight);
NewContainerEventArgs ea = new NewContainerEventArgs(this, _container_Cur);
OnNewContainer(ea);
}
}
//----------------------------------------------------------------------------------------------------x
/// <summary>This method will create a new container that will be added to the parent container at the specified position.</summary>
/// <param name="container_Parent">Parent container</param>
/// <param name="rX">X-coordinate of the new container (points, 1/72 inch)</param>
/// <param name="rY">Y-coordinate of the new container (points, 1/72 inch)</param>
/// <exception cref="ReportException">The layout manager status is not 'Init'</exception>
public Container container_Create(Container container_Parent, Double rX, Double rY) {
if (status != Status.Init && status != Status.Closed) {
throw new ReportException("The layout manager must be in initialization mode or it must be closed; cannot create a new container.");
}
if (_container_Cur != null) {
throw new ReportException("The container has been defined already.");
}
CreateNewContainer();
if (container_Parent != null) {
container_Parent.Add(rX, rY, _container_Cur);
}
return _container_Cur;
}
//----------------------------------------------------------------------------------------------------x
/// <summary>This method will creates a new container that will be added to the parent container at the specified position (metric version).</summary>
/// <param name="container_Parent">Parent container</param>
/// <param name="rX_MM">X coordinate of the new container (mm)</param>
/// <param name="rY_MM">Y coordinate of the new container (mm)</param>
public Container container_CreateMM(Container container_Parent, Double rX_MM, Double rY_MM) {
return container_Create(container_Parent, RT.rPointFromMM(rX_MM), RT.rPointFromMM(rY_MM));
}
#endregion
//------------------------------------------------------------------------------------------06.01.2004
#region CellDef / ColumnDef / RowDef
//----------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------06.01.2004
/// <summary>Definition of the default values of a cell of this table.</summary>
public class CellDef : TlmCellDef {
//------------------------------------------------------------------------------------------06.01.2004
/// <summary>Creates a definition structure for the default values of a cell of this table.</summary>
internal CellDef() {
rAlignH = RepObj.rAlignLeft;
rAlignV = RepObj.rAlignTop;
rAngle = 0;
textMode = TextMode.EllipsisCharacter;
rLineFeed = Double.NaN;
rMarginLeft = 0;
rMarginRight = 0;
rMarginTop = 0;
rMarginBottom = 0;
rIndentLeftMM = 1;
rIndentRightMM = 1;
rIndentTopMM = 1;
rIndentBottomMM = 1;
bp_Back = null;
pp_LineLeft = null;
pp_LineRight = null;
pp_LineTop = null;
pp_LineBottom = null;
iOrderLineLeft = 0;
iOrderLineRight = 0;
iOrderLineTop = 0;
iOrderLineBottom = 0;
}
}
//------------------------------------------------------------------------------------------06.01.2004
/// <summary>Definition of the default properties of a column of this table.</summary>
public class ColumnDef : TlmColumnDef {
//------------------------------------------------------------------------------------------06.01.2004
/// <summary>Creates a definition structure for the default values of a column of this table.</summary>
internal ColumnDef() {
}
}
//------------------------------------------------------------------------------------------06.01.2004
/// <summary>Definition of the default properties of a row of this table.</summary>
public class RowDef : TlmRowDef {
//------------------------------------------------------------------------------------------06.01.2004
/// <summary>Creates a definition structure for the default values of a row of this table.</summary>
internal RowDef() {
}
}
#endregion
//------------------------------------------------------------------------------------------06.01.2004
#region CellCreateType
//----------------------------------------------------------------------------------------------------x
/// <summary>Cell creation type</summary>
public enum CellCreateType {
/// <summary>A new cell will be created for this row</summary>
New,
/// <summary>The cell will be merged with the previous cell of the column</summary>
MergedV,
/// <summary>The cell will be merged with the left cell of the row</summary>
MergedH,
/// <summary>The column will have no cell in this row</summary>
Empty
}
#endregion
//------------------------------------------------------------------------------------------06.01.2004
#region TextMode
//----------------------------------------------------------------------------------------------------x
/// <summary>Text mode</summary>
public enum TextMode {
/// <summary>Single line text mode, text is trimmed to the nearest character and an ellipsis is inserted at the end of the line.</summary>
EllipsisCharacter,
/// <summary>Multiline text mode</summary>
MultiLine,
/// <summary>Fallback: text mode of the fallback cell definition</summary>
FallBack
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -