VB.NET着色datagridview单元格的技巧 [英] VB.NET Tips for coloring datagridview cells

查看:71
本文介绍了VB.NET着色datagridview单元格的技巧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我希望有人能指出我的正确方向。

我创建了自己的自定义数据网格视图基本属性和事件,这工作正常。

我也创建了一个带有splitcontainer的基础形式(datagridview的上面板,tabcontrol的下面板),我把我的datagridview放在baseform中。

在表单load(baseform)中,datagridview是由元数据创建的,我的tabcontainer也是由来自相同元数据的factorie构建的,到目前为止一直很好。

我的子表单继承自我的基本表单,所以我可以制作非常快速漂亮的表单。



这是我的问题,每个子表单都有自己的数据库表。 />
我必须从每个子表单扩展当前的datagridview cellformatting事件。

这是例如在屏幕1中销售价格为0,单元格必须为红色,但是屏幕2我不想要这个功能。



如何实现这个目标?



提前致谢

Hi All,

I hope that somebody can point me in the wright direction.
I have created my own custom datagridview with base properties and events, this is working fine.
Also I've created a baseform with a splitcontainer (upper panel for datagridview, lower panel for tabcontrol) and i've put my datagridview in the baseform.
In the form load (baseform) the datagridview is created by metadata and my tabcontainer is also build by a factorie wich comes from the same metadata, so far so good.
My child forms are inherited from my baseform so i can make really quick nice looking forms.

Here comes my problem, every child form has its own database table.
I have to extend the current datagridview cellformatting event from every child form.
This is beacuse for example in screen 1 de sales price is 0 the cell have to color red, but in screen 2 I don't want this functionality.

How to achieve this?

Thanks in advance

推荐答案

如果需要,您可以单独为每个单元格着色:

You can color each cell individually, if you want:
DataGridViewCell someCell = //..
someCell.Style.BackColor = // some color





-SA


我'在我的基础形式中创建了一个受保护的可覆盖子
I've created in my baseform a Protected Overridable Sub


这篇关于VB.NET着色datagridview单元格的技巧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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