C#.NET使最后一行冻结为真 [英] C#.NET making last row frozen true

查看:55
本文介绍了C#.NET使最后一行冻结为真的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我正在C#Windows应用程序中工作.

我有一个将数据表分配为数据源的网格.

我想将最后一行冻结并给定

Hi I am working in C# windows application.

I have a grid to which datatable is assigned as data source.

I want to make last row as frozen and given

dgvReport.Rows[dgvReport.Rows.Count - 1].Frozen = true;


但是在这种情况下,滚动条被禁用.并且此frozin在设置数据源的表单加载中不起作用,但仅当在另一个按钮单击中执行了相同的代码时才起作用.

任何人都有解决办法
在此先感谢


But the scroll bar is disabled in this case. and also this frozin not working in form load where I set the data source but work only if the same code is execute in an other button click.

Anyone have solution
Thanks in advance

推荐答案

dgvReport_DataBindingComplete事件中冻结了您的行.

frozen your row in dgvReport_DataBindingComplete event.

private void dgvReport_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) 
{                 
   dgvReport.Rows[dgvReport.Rows.Count - 1].Frozen = true;
}


这篇关于C#.NET使最后一行冻结为真的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆