gpt4 book ai didi

c# - 列和行越多,画线越慢

转载 作者:太空宇宙 更新时间:2023-11-03 12:03:21 24 4
gpt4 key购买 nike

作为参数接收并绘制一条线到该大小。

列和行越多,画线越慢。有什么办法可以改善吗?

 private void Linestyle(DevExpress.Spreadsheet.Range rg1)
{
rg1.Borders.InsideHorizontalBorders.LineStyle = DevExpress.Spreadsheet.BorderLineStyle.Dotted;
rg1.Borders.InsideVerticalBorders.LineStyle = DevExpress.Spreadsheet.BorderLineStyle.Dotted;
rg1.Borders.TopBorder.LineStyle = DevExpress.Spreadsheet.BorderLineStyle.Thick;
rg1.Borders.LeftBorder.LineStyle = DevExpress.Spreadsheet.BorderLineStyle.Thick;
rg1.Borders.RightBorder.LineStyle = DevExpress.Spreadsheet.BorderLineStyle.Thick;
rg1.Borders.BottomBorder.LineStyle = DevExpress.Spreadsheet.BorderLineStyle.Thick;
rg1.Borders.InsideVerticalBorders.Color = Color.DarkOrange;
rg1.Borders.InsideHorizontalBorders.Color = Color.DarkOrange;
rg1.Borders.TopBorder.Color = Color.DarkOrange;
rg1.Borders.LeftBorder.Color = Color.DarkOrange;
rg1.Borders.RightBorder.Color = Color.DarkOrange;
rg1.Borders.BottomBorder.Color = Color.DarkOrange;
}

最佳答案

在设置边框之前使用 BeginUpdate(),在设置边框之后使用 EndUpdate()。像这样:

private void Linestyle(DevExpress.Spreadsheet.Range rg1)
{
rg1.BeginUpdate();
rg1.Borders.InsideHorizontalBorders.LineStyle = DevExpress.Spreadsheet.BorderLineStyle.Dotted;
rg1.Borders.InsideVerticalBorders.LineStyle = DevExpress.Spreadsheet.BorderLineStyle.Dotted;
rg1.Borders.TopBorder.LineStyle = DevExpress.Spreadsheet.BorderLineStyle.Thick;
rg1.Borders.LeftBorder.LineStyle = DevExpress.Spreadsheet.BorderLineStyle.Thick;
rg1.Borders.RightBorder.LineStyle = DevExpress.Spreadsheet.BorderLineStyle.Thick;
rg1.Borders.BottomBorder.LineStyle = DevExpress.Spreadsheet.BorderLineStyle.Thick;
rg1.Borders.InsideVerticalBorders.Color = Color.DarkOrange;
rg1.Borders.InsideHorizontalBorders.Color = Color.DarkOrange;
rg1.Borders.TopBorder.Color = Color.DarkOrange;
rg1.Borders.LeftBorder.Color = Color.DarkOrange;
rg1.Borders.RightBorder.Color = Color.DarkOrange;
rg1.Borders.BottomBorder.Color = Color.DarkOrange;
rg1.EndUpdate();
}

10x10 范围内的性能:

Without Begin/EndUpdate: ~5430ms
With Begin/EndUpdate: ~17ms

关于c# - <DevExpress.Spreadsheet>列和行越多,画线越慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56126101/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com