GridControl详解(五)设置行备注和行号

备注显示设置


设置备注字段


显示结果:


可以写入按键事件F3,用以开关备注显示

    private void Form4_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F3)
            {
                gridView1.OptionsView.ShowPreview = !gridView1.OptionsView.ShowPreview;
            }
        }

行号显示要用到的事件:

代码:

private void gridView1_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
{
    if (e.Info.IsRowIndicator)
    {
        e.Info.DisplayText = "Row " + e.RowHandle.ToString();               
    }
}
gridView1.IndicatorWidth = 70;

显示结果