本文整理汇总了C#中Row.Foreach方法的典型用法代码示例。如果您正苦于以下问题:C# Row.Foreach方法的具体用法?C# Row.Foreach怎么用?C# Row.Foreach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Row
的用法示例。
在下文中一共展示了Row.Foreach方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DecreaseColumnsWidth
void DecreaseColumnsWidth(Row row, int startIndex, ref double value) {
double allWidth = 0d;
double allMinWidth = 0d;
row.Foreach(startIndex, (rowCell) => {
allWidth += rowCell.ActualWidth;
allMinWidth += rowCell.ColumnMinWidth;
});
if(allWidth - value < allMinWidth) value = allWidth - allMinWidth;
row.Foreach(startIndex, (rowCell) => {
rowCell.NewWidth = rowCell.ActualWidth;
});
if(value == 0d) return;
double one = 0d; row.Foreach(startIndex, (rowCell) => {
if(rowCell.NewWidth > rowCell.ColumnMinWidth) one += rowCell.ColumnWidth.Value;
});
if(one == 0d) return;
double one2 = 0d;
double diff = value;
double diff2 = 0d;
int i = 0;
while(true) {
i++;
row.Foreach(startIndex, (rowCell) => {
double coef = rowCell.ColumnWidth.Value / one;
double cDiff = diff * coef;
rowCell.NewWidth = rowCell.NewWidth - cDiff;
if(rowCell.NewWidth <= rowCell.ColumnMinWidth) {
rowCell.NewWidth = rowCell.ColumnMinWidth;
diff2 += rowCell.ColumnMinWidth - rowCell.NewWidth;
one2 += rowCell.ColumnWidth.Value;
}
return;
});
if(diff2 == 0d || one2 == 0d) break;
diff = diff2;
one -= one2;
diff2 = 0d;
one2 = 0d;
}
}
示例2: IncreaseColumnsWidth
void IncreaseColumnsWidth(Row row, int startIndex, double diff) {
double one = 0d; row.Foreach(startIndex, (rowCell) => { one += rowCell.ColumnWidth.Value; });
row.Foreach(startIndex, (rowCell) => {
double coef = rowCell.ColumnWidth.Value / one;
double cDiff = diff * coef;
rowCell.NewWidth = rowCell.ActualWidth + cDiff;
});
}