【问题标题】:syncfusion GridControl column width not set properlysyncfusion GridControl 列宽设置不正确
【发布时间】:2015-05-27 07:08:11
【问题描述】:

我在我的应用程序中使用了 synfusion GridControl。用户可以选择一个文本文件,文件中的数据将显示在网格中。每次填充网格时,都会使用代码设置列宽。

_gridPDD.ColWidths.SetSize(i, columnWidth);

其中 columnWidth 将根据列中显示的数据类型保存一些固定值。

现在下面的测试用例不同了-

用户通过拖动列的边缘来更改网格中列的宽度。当在应用程序中打开一个新文件并填充网格时,列不显示为默认宽度(宽度使用上面的代码行设置)而是设置为上一节中列的宽度(宽度用户执行拖动后的列)。

对此有任何帮助...syncfusion GridControl 中是否有任何属性会导致这种行为?如何避免这种行为?

【问题讨论】:

    标签: winforms gridcontrol syncfusion


    【解决方案1】:

    感谢您对 Syncfusion 产品的关注。

    您的问题是修改了大小(用户执行拖动后的列宽)。为了解决这个问题,请使用 ResizeColsBehaviour 限制调整大小选项。您可能正在调整大小(通过拖动列)以查看数据。为此,您可以使用 AllowPropotionalColumnSizing。这允许您根据数据大小按比例调整列的大小。

    代码片段:

    //to restrict the resizing option using drag
    this.grid.Model.Options.ResizeColsBehavior = GridResizeCellsBehavior.None;
    
    //to resize the columnpropotionatelt according to the column data
    this.grid.AllowProportionalColumnSizing = true;
    

    参考http://www.syncfusion.com/kb/695/how-to-prevent-column-resizing-for-child-tables-in-gridgroupingcontrol

    http://www.syncfusion.com/kb/4853/how-to-optimize-the-resizetofit-method-for-large-number-of-records

    如果您的要求与此不同,请告诉我们。

    感谢和问候, 阿尔索莱。

    【讨论】:

      猜你喜欢
      • 2019-10-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-28
      • 2020-03-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多