当前位置: 首页>>代码示例>>C#>>正文


C# Sheet.SetScale方法代码示例

本文整理汇总了C#中Sheet.SetScale方法的典型用法代码示例。如果您正苦于以下问题:C# Sheet.SetScale方法的具体用法?C# Sheet.SetScale怎么用?C# Sheet.SetScale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sheet的用法示例。


在下文中一共展示了Sheet.SetScale方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AutoScaleSheet


//.........这里部分代码省略.........
                        list.Add(sizeForDim);
                    }
                }
                if (maxY.Adding + maxY.Main > yAdding + y)
                {
                    yAdding = maxY.Adding;
                    y = maxY.Main;
                    listY = list;
                }
            }

            #endregion

            #region Нахождение максимального x

            foreach (var yPo in yPos)
            {
                var maxX = new Max();
                var list = new List<SizeForDim>();
                foreach (var sizeForDim in sizeForDimL)
                {
                    var pos = (double[])sizeForDim.View.Position;
                    if (pos[1] == yPo)
                    {
                        maxX.Adding = maxX.Adding + sizeForDim.XLeft + sizeForDim.XRight;
                        maxX.Main = maxX.Main + sizeForDim.X;
                        list.Add(sizeForDim);
                    }
                }
                if (maxX.Adding + maxX.Main > xAdding + x)
                {
                    xAdding = maxX.Adding;
                    x = maxX.Main;
                    listX = list;
                }
            }

            #endregion

            double kX = (0.272 - xAdding) / x;
            double kY = ((side ? 0.145 : 0.165) - yAdding) / y;
            double j = (kX < kY ? kX : kY);
            var p = new double[3];
            listX.Sort((a, b) => a.View.Position[0].CompareTo(b.View.Position[0]));
            var arrX = listX.ToArray();
            double leftSide = 0.02;
            for (int k = 0; k < listX.Count; k++)
            {
                double delta = arrX[k].View.Position[0] - (arrX[k].Bound[2] + arrX[k].Bound[0]) / 2;
                if (delta != 0)
                    delta = delta * j;
                double add = 0;
                for (int d = k + 1; d < listX.Count; d++)
                {
                    add = add + (kX * arrX[d].XLeft) + (kX * arrX[d].X) + arrX[d].XRight;
                }
                p[0] = leftSide + arrX[k].XLeft + (kX * arrX[k].X) / 2 + delta;
                leftSide = 0.292 - add;
                p[1] = arrX[k].View.Position[1];
                p[2] = 0;
                object oPos = p;
                arrX[k].View.Position = oPos;
                if (arrX[k].View != baseView && !dictAlign.ContainsKey(arrX[k].View))
                    dictAlign.Add(arrX[k].View, (int)swAlignViewTypes_e.swAlignViewHorizontalCenter);
            }

            listY.Sort((a, b) => a.View.Position[1].CompareTo(b.View.Position[1]));
            var arrY = listY.ToArray();
            double downSide = side ? 0.06 : 0.025;
            for (int k = 0; k < listY.Count; k++)
            {
                double delta = arrY[k].View.Position[1] - (arrY[k].Bound[1] + arrY[k].Bound[3]) / 2;
                if (delta != 0)
                    delta = delta * j;
                double add = 0;
                for (int d = k + 1; d < listY.Count; d++)
                {
                    add = add + (kY * arrY[d].YDown) + (kY * arrY[d].Y) + arrY[d].YUp;
                }
                p[0] = arrY[k].View.Position[0];
                p[1] = downSide + arrY[k].YDown + (kY * arrY[k].Y) / 2 + delta;
                p[2] = 0;
                object oPos = p;
                arrY[k].View.Position = oPos;
                downSide = (side ? 0.205 : 0.17) - add;
                if (arrY[k].View != baseView && !dictAlign.ContainsKey(arrY[k].View))
                    dictAlign.Add(arrY[k].View, (int)swAlignViewTypes_e.swAlignViewVerticalCenter);
            }
            if (baseView != null)
            {
                swSheet.SetScale(1, (scale / j), false, false);
                foreach (var sizeForDim in sizeForDimL)
                {
                    if (sizeForDim.View != baseView && dictAlign.ContainsKey(sizeForDim.View))
                        sizeForDim.View.AlignWithView(dictAlign[sizeForDim.View], baseView);
                }
            }
            else
                swSheet.SetScale(1, (scale / (j * 0.95)), false, false);
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:101,代码来源:DimensionDraft.cs


注:本文中的Sheet.SetScale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。