DotNetBar 使用笔记

1.删除表格的某一行数据,必须是VirtualMode  = false 的时候才生效,不然就只是灰色

SuperDBG_Right.PrimaryGrid.SetDeletedRows(SuperDBG_Right.PrimaryGrid.ActiveRow.RowIndex, 1, true, false);

 

SuperGrid 删除某一行数据,在VirtualMode = true 模式下无法正常删除,必须调用PurgeDeletedRows 方法; =false 下一切正常

//VirtualMode = true 模式下无法正常删除,开始只标记某一行颜色    SuperDBG_Main.PrimaryGrid.ActiveRow.CellStyles.Default.TextColor =  Color.Red; 后来问过才知道有这个方法
SuperDBG_Main.PrimaryGrid.SetDeletedRows(SuperDBG_Main.PrimaryGrid.ActiveRow.Index,1,true,false);
SuperDBG_Main.PrimaryGrid.PurgeDeletedRows();

 

 

 

2.DataGridView 数据加载     https://www.codeproject.com/Articles/23937/Paging-Data-with-DataGridView-in-VirtualMode

Paging Data with DataGridView in VirtualMode  

public partial class Form1 : Form
{
    const int PAGE_SIZE = 5000;

    NameListCache _cache = null;

    public Form1()
    {
        InitializeComponent();

        _cache = new NameListCache( PAGE_SIZE );

        dataGridView1.CellValueNeeded +=
            new DataGridViewCellValueEventHandler( dataGridView1_CellValueNeeded );

        dataGridView1.VirtualMode = true;

        dataGridView1.RowCount = (int)_cache.TotalCount;
    }

    private void dataGridView1_CellValueNeeded
        ( object sender, DataGridViewCellValueEventArgs e )
    {
        _cache.LoadPage( e.RowIndex );

        int rowIndex = e.RowIndex % _cache.PageSize;

        e.Value = _cache.CachedData[rowIndex][e.ColumnIndex];
    }
} 
View Code

 

 

 

 

 

 

 

posted @ 2017-11-24 23:59  maanshancss  阅读(408)  评论(0编辑  收藏  举报