DotNetBar 使用筆記

1.刪除表格的某一行數據,必須是VirtualMode  = false 的時候才生效,否則就只是灰色ide

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

 

SuperGrid 刪除某一行數據,在VirtualMode = true 模式下沒法正常刪除,必須調用PurgeDeletedRows 方法; =false 下一切正常code

//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();orm

 

 

 

2.DataGridView 數據加載     https://www.codeproject.com/Articles/23937/Paging-Data-with-DataGridView-in-VirtualModeblog

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
相關文章
相關標籤/搜索