是否可以创建一个看起来像这样的DataGridView ... [英] Is it possible to create a DataGridView which looks like this...

查看:63
本文介绍了是否可以创建一个看起来像这样的DataGridView ...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

点击此处 [ ^ ]是通过使用某些第三方组件(如C1)开发的。正如您所看到的,这里有三种行...

类型1. L0000000000000000420 - 这种行是从数据库中获取的。 (只读)

类型2.输入金额 - 这种行是供用户输入的金额。 (这个也可能在某些列中包含下拉列表)(仅在选中时可编辑)

类型3.白色行 - 这只是一个空白的只读行,以获得更好的外观和感觉。



我想知道是否有可能在不使用任何第三方组件的情况下创建类似的DataGridView?

我的想法是......将数据库中的行提取到DataTable然后循环它...我想在每个已提取的行之后在DataTable中添加两个额外的空行。



我还会添加一个列值,例如,





A - (这是表示类型1)

B - (这表示类型2)

C - (这表示类型3)

A

B

C ..等等



我会的话检查循环中的行类型,然后将该行的属性设置为只读/可编辑颜色属性。



但我不确定这是否真的可行。我不知道如何才能为tpe 2柱添加组合框。因为如果我添加一个ComboBox列,它将显示在所有三行中。这可能吗?如果是的话,你能给我一些想法吗?谢谢。

This CLICK HERE[^] have been developed by using some third party component such as C1. As you can see there are are three kinds of rows here...
Type 1. L0000000000000000420 - this kind of row is fetched from database. (Read Only)
Type 2. Enter Amount - this kind of row is for the user to input amount. (this one might also contain drop downlist in some columns) (Editable only when Checked)
Type 3. WHITE ROW- this is just a blank Read Only row for better look and feel.

I want to know is it possible to create similar if not exactly the same kind of DataGridView without using any third party component?
My idea is .. to fetch the rows from database into a DataTable and then loop it ... I am thinking of adding two extra blank rows in the DataTable after each row that has been fetched.

I will also add a column which will have a value such as ,


A - (this is to indicate type 1)
B - (this is to indicate type 2)
C - (this is to indicate type 3)
A
B
C .. so on

I will then check the type of row in a loop and then set property of that row to read only/ editable , color properties accordingly.

But I am not sure if this is practically possible. I am not not sure how am i gonna add combobox for only tpe 2 column. Because if I add a ComboBox column it will be displayed in all three rows. Is this possible? If yes, can you give me some idea how? Thank You.

推荐答案

这是可能的,但需要一本小书来解释你必须做的所有事情才能实现。



您可能希望使用电子表格控件。有点像这个 [ ^ ]。
It's possible, but it would take a small book to explain everything you had to do to pull it off.

You may want to use a spreadsheet control instead. Something like this[^].


这篇关于是否可以创建一个看起来像这样的DataGridView ...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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