如何在C#Windows应用程序的Datagrid中自动滚动单元格内容? [英] How Auto scroll a cell content in Datagrid in C# Windows application ?

查看:45
本文介绍了如何在C#Windows应用程序的Datagrid中自动滚动单元格内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在C#Windows应用程序中自动滚动Datagrid中的单元格内容?

How Auto scroll a cell content in Datagrid in C# Windows application ?

推荐答案

我假设您正在要求自动滚动数据网格中的单元格内容,就像选取框标记采用纯HTML格式.这可以通过修改网格的ItemDataBound事件中的单元格内容来实现(考虑到您正在使用ASP.Net本机DataGrid控件)

I assume you are asking to auto scroll a cell content in data grid, just like a marquee tag does in plain HTML. This can be achieved by modifying cell content in grid''s ItemDataBound event (considering you are using ASP.Net native DataGrid control)

private void grdYourGrid_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
  if(e.Item.ItemType != ListItemType.Header && e.Item.ItemType != ListItemType.Footer)
  {
     //Assuming you want to autoscroll content of Cell[0]
     e.Cells[0].Text = "<MARQUEE>" + e.Cells[0].Text + "</MARQUEE>"   
  }
}


这篇关于如何在C#Windows应用程序的Datagrid中自动滚动单元格内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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