添加两个事件,计算宽度
void gridView1_CustomDrawRowPreview(object sender, Views.Base.RowObjectCustomDrawEventArgs e)
{e.Appearance.DrawString(e.Cache, gridView1.GetRowPreviewDisplayText(e.RowHandle), e.Bounds, StringFormat.GenericTypographic);
e.Handled = true;
}
void gridView1_MeasurePreviewHeight(object sender, Views.Grid.RowHeightEventArgs e)
{
SizeF size = gridView1.Appearance.Preview.CalcTextSize(CreateGraphics(), StringFormat.GenericTypographic,
gridView1.GetRowPreviewDisplayText(e.RowHandle), gridControl1.Width - 6);
e.RowHeight = (int)size.Height;
}
或者用layoutView形式解决此问题。