11、列的宽度可以通过ListResizeColumns来设置,但是不能直接设置某列的宽度;如果ShowColumnHeaders = true,可以拖动改变列的宽度
- DataTable dt = new DataTable();
- dt.Columns.Add("col1");
- dt.Columns.Add("col2");
- dt.Columns.Add("col3");
- dt.Columns.Add("col4");
- dt.Rows.Add(1, 2, 3, 4);
- dt.Rows.Add(1, 2, 3, 4);
- dt.Rows.Add(1, 2, 3, 4444);
- FarPoint.Win.Spread.CellType.MultiColumnComboBoxCellType mcb = new FarPoint.Win.Spread.CellType.MultiColumnComboBoxCellType();
- mcb.DataSourceList = dt;
- mcb.DataColumn = 2;
- mcb.ColumnEdit = 2;
- mcb.ButtonAlign = FarPoint.Win.ButtonAlign.Left;
- mcb.ListResizeColumns = FarPoint.Win.Spread.CellType.ListResizeColumns.ByDataType;
- mcb.ListAlignment = FarPoint.Win.ListAlignment.Right;
- mcb.ListOffset = 5;
- mcb.MaxDrop = 5;
- mcb.ShowColumnHeaders = true;
- fpSpread1.ActiveSheet.Cells[0, 0].CellType = mcb;
复制代码
12、fpSpread1.ActiveSheet.Columns.Default.Width = 200; |