public TableEx(int rowAmount, int colAmount) { tbPos.X = 0; tbPos.Y = 0; tbHeight = 0; tbWidth = 0; this.rowAmount = rowAmount; this.colAmount = colAmount; tableSizeType = TableSizeType.Fill; TableLine tableLine; for (int i = 0; i < rowAmount; i++) { tableLine = new TableLine(LineDir.HORIZONTAL); tableLine.lineComputeMode = LineComputeMode.AUTO; tableLine.maxComputedValue = -1; tableLine.minComputedValue = -1; rowLineList.Add(tableLine); } // for (int i = 0; i < colAmount; i++) { tableLine = new TableLine(LineDir.VERTICAL); tableLine.lineComputeMode = LineComputeMode.AUTO; tableLine.maxComputedValue = -1; tableLine.minComputedValue = -1; colLineList.Add(tableLine); } }
public void SetLineArea(int lineIdx, TableLine setLine) { List <TableLine> lineList = null; float tbLength; if (setLine.lineDir == LineDir.HORIZONTAL) { lineList = rowLineList; tbLength = tbHeight; } else { lineList = colLineList; tbLength = tbWidth; } TableLine adjustLine = lineList[lineIdx]; adjustLine.lineComputeMode = setLine.lineComputeMode; adjustLine.computeParam = setLine.computeParam; adjustLine.enableAutoAdjustParam = setLine.enableAutoAdjustParam; adjustLine.lineDir = setLine.lineDir; adjustLine.minComputedValue = setLine.minComputedValue; adjustLine.maxComputedValue = setLine.maxComputedValue; }
public void SetLineArea(int lineIdx, TableLine setLine) { List <TableLine> lineList = null; float tbLength; if (setLine.lineDir == LineDir.HORIZONTAL) { lineList = rowLineList; tbLength = tbHeight; } else { lineList = colLineList; tbLength = tbWidth; } if (lineList.Count == 1) { return; } TableLine adjustLine = lineList[lineIdx]; adjustLine.lineComputeMode = setLine.lineComputeMode; adjustLine.computeParam = setLine.computeParam; }
public void SetAutoTableLine(int idx, LineDir lineDir) { TableLine tableLine = new TableLine(lineDir); tableLine.lineComputeMode = LineComputeMode.AUTO; tableLine.maxComputedValue = -1; tableLine.minComputedValue = -1; SetTableLine(idx, tableLine); }
public void SetTableLine(int idx, TableLine tableLine) { List <TableLine> lineList; int amount; if (tableLine.lineDir == LineDir.HORIZONTAL) { lineList = rowLineList; amount = rowAmount; } else { lineList = colLineList; amount = colAmount; } if (idx < lineList.Count) { TableLine tl = new TableLine(tableLine.lineDir); tl.computeParam = tableLine.computeParam; tl.computedDistance = tableLine.computedDistance; tl.lineComputeMode = tableLine.lineComputeMode; tl.minComputedValue = tableLine.minComputedValue; tl.maxComputedValue = tableLine.maxComputedValue; lineList[idx] = tl; } else { int n = idx - lineList.Count; for (int i = 0; i < n; i++) { TableLine tl = new TableLine(tableLine.lineDir); tl.computeParam = tableLine.computeParam; tl.computedDistance = tableLine.computedDistance; tl.lineComputeMode = tableLine.lineComputeMode; tl.minComputedValue = tableLine.minComputedValue; tl.maxComputedValue = tableLine.maxComputedValue; lineList.Add(tl); amount++; } if (tableLine.lineDir == LineDir.HORIZONTAL) { rowAmount = amount; } else { colAmount = amount; } } }
void ModifyTableSize(LineDir lineDir, TableLine line, ref float usedLength, ref float tbLength) { if (tableSizeType == TableSizeType.Fill || (tableSizeType == TableSizeType.VerticalFill && lineDir == LineDir.HORIZONTAL) || (tableSizeType == TableSizeType.HorizontalFill && lineDir == LineDir.VERTICAL)) { return; } else if (usedLength > tbLength) { usedLength -= line.computeParam; line.computeParam = tbLength - usedLength; usedLength += line.computeParam; line.computedDistance = line.computeParam; } }
public void CreateNewCol( bool enableAutoAdjustParam = true, LineComputeMode lineComputeMode = LineComputeMode.AUTO, float computeParam = 0, float computedDistance = 0) { colAmount += 1; TableLine tableLine = new TableLine(LineDir.VERTICAL); tableLine.enableAutoAdjustParam = enableAutoAdjustParam; tableLine.lineComputeMode = lineComputeMode; tableLine.computeParam = computeParam; tableLine.computedDistance = computedDistance; tableLine.maxComputedValue = -1; tableLine.minComputedValue = -1; colLineList.Add(tableLine); }
public void CreateNewRow( bool enableAutoAdjustParam = true, LineComputeMode lineComputeMode = LineComputeMode.AUTO, float computeParam = 0, float computedDistance = 0) { rowAmount += 1; TableLine tableLine = new TableLine(LineDir.HORIZONTAL); tableLine.enableAutoAdjustParam = enableAutoAdjustParam; tableLine.lineComputeMode = lineComputeMode; tableLine.computeParam = computeParam; tableLine.computedDistance = computedDistance; tableLine.maxComputedValue = -1; tableLine.minComputedValue = -1; rowLineList.Add(tableLine); }
public TableEx(float x, float y, float tbWidth, float tbHeight, int rowAmount, int colAmount) { this.tbPos.X = x; this.tbPos.Y = y; this.tbHeight = tbHeight; this.tbWidth = tbWidth; this.rowAmount = rowAmount; this.colAmount = colAmount; // TableLine tableLine; float rowComputedDist = tbHeight / rowAmount; float rowPercent = 1f / rowAmount; for (int i = 0; i < rowAmount; i++) { tableLine = new TableLine(LineDir.HORIZONTAL); tableLine.lineComputeMode = LineComputeMode.PERCENTAGE; tableLine.computeParam = rowPercent; tableLine.computedDistance = rowComputedDist; tableLine.maxComputedValue = -1; tableLine.minComputedValue = -1; rowLineList.Add(tableLine); } // float colComputedDist = tbWidth / colAmount; float colPercent = 1f / colAmount; for (int i = 0; i < colAmount; i++) { tableLine = new TableLine(LineDir.VERTICAL); tableLine.lineComputeMode = LineComputeMode.PERCENTAGE; tableLine.computeParam = colPercent; tableLine.computedDistance = colComputedDist; tableLine.maxComputedValue = -1; tableLine.minComputedValue = -1; colLineList.Add(tableLine); } }
private void SetLineArea(int lineIdx, TableLine setLine, AdjustMode adjustMode) { List <TableLine> lineList = null; float tbLength; if (setLine.lineDir == LineDir.HORIZONTAL) { lineList = rowLineList; tbLength = tbHeight; } else { lineList = colLineList; tbLength = tbWidth; } if (lineList.Count == 1) { return; } TableLine adjustLine = lineList[lineIdx]; if (adjustLine.lineComputeMode == LineComputeMode.ABSOLUTE) { adjustLine.lineComputeMode = setLine.lineComputeMode; adjustLine.computeParam = setLine.computeParam; return; } TableLine upLine; TableLine nextLine; float richValue; if (lineIdx == lineList.Count - 1 && adjustMode == AdjustMode.DOWN_OR_RIGHT_ADJUST) { adjustMode = AdjustMode.UP_OR_LEFT_ADJUST; } else if (lineIdx == 0 && adjustMode == AdjustMode.UP_OR_LEFT_ADJUST) { adjustMode = AdjustMode.DOWN_OR_RIGHT_ADJUST; } switch (adjustMode) { case AdjustMode.UP_OR_LEFT_ADJUST: //上边线调整 richValue = adjustLine.computeParam - setLine.computeParam; adjustLine.computeParam = setLine.computeParam; upLine = lineList[lineIdx - 1]; if (upLine.lineComputeMode == LineComputeMode.PERCENTAGE) { upLine.computeParam += richValue; } break; case AdjustMode.DOWN_OR_RIGHT_ADJUST: //下边线调整 richValue = adjustLine.computeParam - setLine.computeParam; adjustLine.computeParam = setLine.computeParam; nextLine = lineList[lineIdx + 1]; if (nextLine.lineComputeMode == LineComputeMode.PERCENTAGE) { nextLine.computeParam += richValue; } break; } }
public void AdjustLineArea(int lineIdx, TableLine setLine, AdjustMode adjustMode) { SetLineArea(lineIdx, setLine, adjustMode); ComputeLinesArea(setLine.lineDir); }