当前位置: 首页>>代码示例>>C#>>正文


C# DataGridView.DisplayedRowCount方法代码示例

本文整理汇总了C#中System.Windows.Forms.DataGridView.DisplayedRowCount方法的典型用法代码示例。如果您正苦于以下问题:C# DataGridView.DisplayedRowCount方法的具体用法?C# DataGridView.DisplayedRowCount怎么用?C# DataGridView.DisplayedRowCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.DataGridView的用法示例。


在下文中一共展示了DataGridView.DisplayedRowCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: scrollGrid

        private void scrollGrid(DataGridView dataGridView, int index)
        {
            int halfWay = (dataGridView.DisplayedRowCount(false)/2);

            if ((index < 0) && (dataGridView.SelectedRows.Count > 0))
            {
                index = dataGridView.SelectedRows[0].Index;
            }

            if (dataGridView.FirstDisplayedScrollingRowIndex + halfWay > index ||
                (dataGridView.FirstDisplayedScrollingRowIndex + dataGridView.DisplayedRowCount(false)-halfWay) <= index)
            {
                int targetRow = index;
               
                targetRow = Math.Max(targetRow-halfWay, 0);
                try
                {
                    dataGridView.FirstDisplayedScrollingRowIndex = targetRow;
                }
                catch 
                { 
                    //soft fail
                }
            }
        }
开发者ID:shujaatak,项目名称:UAV_MissionPlanner,代码行数:25,代码来源:LogBrowse.cs

示例2: SetAktRowVisible

 public void SetAktRowVisible(DataGridView gridview, int sorindex)
 {
     int firstdisprowindex = gridview.FirstDisplayedScrollingRowIndex;
     if (firstdisprowindex == -1)
         firstdisprowindex = 0;
     if (sorindex != -1 && firstdisprowindex > sorindex)
         gridview.FirstDisplayedScrollingRowIndex = sorindex;
     else
     {
         int rowcount = gridview.DisplayedRowCount(false);
         int teljesrowcount = gridview.DisplayedRowCount(true);
         int lastvisible = rowcount + firstdisprowindex;
         int teljeslastvisible = teljesrowcount + firstdisprowindex;
         if (lastvisible < sorindex && firstdisprowindex < sorindex)
             gridview.FirstDisplayedScrollingRowIndex = sorindex;
         else
         {
             if (lastvisible == sorindex)
                 gridview.FirstDisplayedScrollingRowIndex++;
             else if (teljeslastvisible == sorindex)
                 gridview.FirstDisplayedScrollingRowIndex = gridview.FirstDisplayedScrollingRowIndex + 2;
         }
     }
 }
开发者ID:AndrasD,项目名称:VezIR,代码行数:24,代码来源:FakUserInterface.cs

示例3: HandleGridScrolling

        private void HandleGridScrolling(bool Up, DataGridView Grid)
        {
            // Makes sure the selected row is visible
            int VisibleRows = Grid.DisplayedRowCount(false);
            int FirstVisibleRow = Grid.FirstDisplayedCell.RowIndex;
            int LastVisibleRow = (FirstVisibleRow + VisibleRows) - 1;
            int SelectedRow = Grid.CurrentCell.RowIndex;

            if (VisibleRows >= Grid.RowCount)
            {
                return;
            }

            if (Up)
            {
                if (FirstVisibleRow == 0)
                {
                    return;
                }
                if (SelectedRow < FirstVisibleRow + 2)
                {
                    if (SelectedRow > 2)
                    {
                        Grid.FirstDisplayedScrollingRowIndex = SelectedRow - 2;
                    }
                    else
                    {
                        Grid.FirstDisplayedScrollingRowIndex = 0;
                    }
                }
            }
            else
            {
                if (LastVisibleRow == Grid.RowCount)
                {
                    return;
                }
                if (SelectedRow > LastVisibleRow - 3)
                {
                    if (SelectedRow < Grid.RowCount - 3)
                    {
                        Grid.FirstDisplayedScrollingRowIndex = SelectedRow - VisibleRows + 3;
                    }
                    else
                    {
                        Grid.FirstDisplayedScrollingRowIndex =
                            Grid.RowCount - VisibleRows;
                    }
                }
            }
        }
开发者ID:mrandt,项目名称:LitePlacer-DEV,代码行数:51,代码来源:MainForm.cs


注:本文中的System.Windows.Forms.DataGridView.DisplayedRowCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。