打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
FarPoint Forums - Re: Virtual Mode
 


  • Hello,

    Yes it is possible, but should not be needed. It was needed in the COM version, since there was an open connection to the database. Making a smaller query to the database could speed up the fetch.

    In .NET, the Spread is bound to a local DataSet/DataTable. Setting the DataSource to this connection would populate the Spread instantaneous. The creation of the DataSet/DataTable can still take some time, but this is not something virtualmode on the Spread can speed up.

    To implement your own virtualmode in the Spread, you would need to handle the filling of the Spread control. You can use the TopChange and/of LeftChange events to do this. Here is an example of how to do this.
    [code]
    string[,] a = new string[100000,20];
    FarPoint.Win.Spread.Model.CellRange virtualport;

    private void Form1_Load(object sender, System.EventArgs e)
    {
    int i,j;
    string s;
    fpSpread1.Sheets[0].RowCount = 100000;
    fpSpread1.Sheets[0].ColumnCount = 20;
    for (i=0;i<100000;i++)
    for (j=0;j<20;j++)
    {
    s = "Row:" + i.ToString() + ", Col:" + j.ToString();
    a[i,j] = s;
    }
    virtualport = new FarPoint.Win.Spread.Model.CellRange(0,0,1000,10);
    FarPoint.Win.Spread.Model.CellRange cr = virtualport;
    FillSpread(cr);
    }
    private void button1_Click(object sender, System.EventArgs e)
    {
    fpSpread1.Sheets[0].SetArray(0,0,a);
    }
    private void button2_Click(object sender, System.EventArgs e)
    {
    }
    private void FillSpread(FarPoint.Win.Spread.Model.CellRange cr)
    {
    int i,j;
    for(i=cr.Row;i<cr.Row+cr.RowCount;i++)
    for(j=cr.Column;j<cr.Column+cr.ColumnCount;j++)
    fpSpread1.Sheets[0].SetValue(i,j,a[i,j]);
    }

    private void fpSpread1_TopChange(object sender, FarPoint.Win.Spread.TopChangeEventArgs e)
    {
    if (!((virtualport.Contains(fpSpread1.GetViewportBottomRow(0),fpSpread1.GetViewportRightColumn(0),1,1))))
    {
    virtualport = new FarPoint.Win.Spread.Model.CellRange(fpSpread1.GetViewportTopRow(0), fpSpread1.GetViewportLeftColumn(0), 1000,10);
    if (virtualport.IntersectRow(fpSpread1.Sheets[0].RowCount))
    virtualport = new FarPoint.Win.Spread.Model.CellRange(fpSpread1.Sheets[0].RowCount-1000, virtualport.Column, 1000,10);
    FillSpread(virtualport);
    }
    }

    private void fpSpread1_LeftChange(object sender, FarPoint.Win.Spread.LeftChangeEventArgs e)
    {
    if (!((virtualport.Contains(fpSpread1.GetViewportBottomRow(0),fpSpread1.GetViewportRightColumn(0),1,1))))
    {
    virtualport = new FarPoint.Win.Spread.Model.CellRange(fpSpread1.GetViewportTopRow(0), fpSpread1.GetViewportLeftColumn(0), 1000,10);
    if (virtualport.IntersectColumn(fpSpread1.Sheets[0].ColumnCount))
    virtualport = new FarPoint.Win.Spread.Model.CellRange(virtualport.Row, fpSpread1.Sheets[0].ColumnCount - 10, 1000,10);
    FillSpread(virtualport);
    }
    }
    }
    [/code]
    Scott S.
    FarPoint Technologies, Inc.
View Complete Thread 

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Spread的常用事件
利用FarPoint Spread表格控件,构造Winform的Excel表格界面输入
Spread Studio 8 新特性:表格(Table)功能
Spread for Windows Forms快速入门(2)
Spread for ASP.NET跨平台表格控件如何进行分组
FpSpread控件的总结VB插件
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服