在WinCE中以颜色绘制datagrid行 [英] Paint datagrid row in color in WinCE

查看:92
本文介绍了在WinCE中以颜色绘制datagrid行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何用红色表示字段"age" = 30的值的数据网格中的所有行?

how can I paint all rows in a datagrid with the value of field "age" = 30 in red?

我在WinCE中工作.

I work in WinCE.

感谢您的帮助!

推荐答案

尝试类似的方法.我设置

try something like. I set

Datagrid1.Datasource = Datatable1.DefaultView

其中Datatable1是一个数据表,其中包含一个名为年龄"的列

where Datatable1 is a Datatable that contains a column named "Age"

对不起,在VB中

私人Sub paintColors()

Private Sub paintColors()

    Dim vI As Int64 
    DataGrid1.SelectionBackColor = Color.OrangeRed
    Dim vI As Int64 = 0
    For vI = 0 To Datatable1.DefaultView.Count - 1

        If Datatable1.DefaultView.Item(vI)("Age") = 30 Then
            DataGrid1.Select(vI)
        Else
            DataGrid1.UnSelect(vI)
        End If

    Next

结束子

这篇关于在WinCE中以颜色绘制datagrid行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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