在C#Windows窗体应用程序中以编程方式继承表

拉吉卜特

在DataGridView中,事情很正常,但是我想学习如何继承一个表,并对从SQLite数据库中获取的每个数据项进行重构?

(System.Windows.Forms.Table)使用Visual Studio 2013设计器设计了一个表,这几乎是一个拖放式设计。

该表有两列,最左边一列显示从SQLite数据库获取的数据,它还有一个子表(System.Windows.Forms.Table)有两个行(表行),其中每一行(表行)都有一个textField,它们实际上显示给不同的数据库行(此是数据库行)值。

右侧有一些按钮可触发少量事件。
外观如下:http : //i.stack.imgur.com/Q8Lfd.png

在此处输入图片说明

现在我的问题是,在这种环境下,我如何继承此表设计并创建多个实例,foreach数据行来自其SQLite数据库文件?

演示:这是我想要实现的目标的快速演示。
假设名为“列表”的数据库表有四个项目,那么此应用程序将创建该表的四个实例(Windows表单表),将所有数据插入到表(Windows表单表)的适当字段中,然后在“ Form1“表单,看起来像这样[在photoshop上完成的;)]在此处输入图片说明

请通过给出您的想法和参考文献来指导我正确的方法

马丁·诺雷克(Martin Noreke)

It's been a while since I worked in WinForms, but the concept is similar in all of the DotNet UI methodologies based upon the question from GER on the original post.

If you define a UserControl that renders the data to look like a single instance of what you have in your photo-shopped item, you can then reuse that control several times.

In your main form, you can now do a loop to add this control as many times as you need programmatically (psuedo code follows at the end).

You will also need a TableLayoutPanel (https://msdn.microsoft.com/en-us/library/vstudio/system.windows.forms.tablelayoutpanel%28v=vs.100%29.aspx) or similar for your primary form to serve as the layoutPanel.

foreach(DataTable table in Tables)
{
    MyChildControl childControl = new MyChildControl();
    childControl.Confiure(table); // Sets the data for the control.
    layoutPanel.Controls.Add(childControl); // This call varies by UI method and what layoutPanel you are using
}

警告:我对WinForms不够记得,无法记住如何在控件上设置网格行/列设置。如果适合您,您就可以对此进行一些研究。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

C#Windows窗体应用程序关闭

来自分类Dev

如何使C#Windows窗体应用程序适合屏幕

来自分类Dev

覆盖C#Windows应用程序窗体中的透明图片框?

来自分类Dev

如何在C#Windows窗体应用程序中激活spellCheck?

来自分类Dev

如何在C#Windows窗体应用程序中动态创建网格

来自分类Dev

如何在C#Windows窗体应用程序中创建平滑的形状动画运动?

来自分类Dev

SQL命令在C#Windows窗体应用程序中不起作用

来自分类Dev

通过Windows窗体应用程序以编程方式部署Web应用程序

来自分类Dev

我如何获得素数(C#Windows窗体应用程序中的哥德巴赫猜想)

来自分类Dev

如何使用for循环在c#windows窗体应用程序中检查文本框是否为空,使用数组

来自分类Dev

在C ++ Windows窗体应用程序中打开新窗体

来自分类Dev

C#Windows窗体应用程序进度栏数据绑定

来自分类Dev

C#Windows窗体应用程序在错误后使进程运行

来自分类Dev

C#Windows窗体应用程序热键-KeyDown事件不起作用

来自分类Dev

从Datatable C#Windows窗体应用程序中选择前N行

来自分类Dev

C#Windows应用程序中的Google搜索

来自分类Dev

如何以编程方式从C#Windows Forms应用程序将openoffice writer odt文件发送到打印机

来自分类Dev

使用Visual Studio 2012创建的C#Windows窗体应用程序无法在Windows XP上运行

来自分类Dev

如何将C .DLL文件导入C#Windows窗体应用程序并调用其在标头中定义的函数?

来自分类Dev

如何部署使用SQL Server Express 2012和Crystal Report开发的C#Windows窗体应用程序

来自分类Dev

如何部署使用SQL Server Express 2012和Crystal Report开发的C#Windows窗体应用程序

来自分类Dev

为C#Windows应用程序准备安装程序

来自分类Dev

如何在C#Windows应用程序中将数据表导出到Excel

来自分类Dev

如何在C#Windows应用程序中为HID设备编写驱动程序

来自分类Dev

如何根据C#Windows Form应用程序中的项目在Listview列中添加Icon?

来自分类Dev

设置C#Windows Universal应用程序的窗口标题

来自分类Dev

从C#Windows应用程序调用URL

来自分类Dev

C#Windows应用程序SharePoint登录

来自分类Dev

使用C#Windows Form应用程序拖放Datagridview

Related 相关文章

  1. 1

    C#Windows窗体应用程序关闭

  2. 2

    如何使C#Windows窗体应用程序适合屏幕

  3. 3

    覆盖C#Windows应用程序窗体中的透明图片框?

  4. 4

    如何在C#Windows窗体应用程序中激活spellCheck?

  5. 5

    如何在C#Windows窗体应用程序中动态创建网格

  6. 6

    如何在C#Windows窗体应用程序中创建平滑的形状动画运动?

  7. 7

    SQL命令在C#Windows窗体应用程序中不起作用

  8. 8

    通过Windows窗体应用程序以编程方式部署Web应用程序

  9. 9

    我如何获得素数(C#Windows窗体应用程序中的哥德巴赫猜想)

  10. 10

    如何使用for循环在c#windows窗体应用程序中检查文本框是否为空,使用数组

  11. 11

    在C ++ Windows窗体应用程序中打开新窗体

  12. 12

    C#Windows窗体应用程序进度栏数据绑定

  13. 13

    C#Windows窗体应用程序在错误后使进程运行

  14. 14

    C#Windows窗体应用程序热键-KeyDown事件不起作用

  15. 15

    从Datatable C#Windows窗体应用程序中选择前N行

  16. 16

    C#Windows应用程序中的Google搜索

  17. 17

    如何以编程方式从C#Windows Forms应用程序将openoffice writer odt文件发送到打印机

  18. 18

    使用Visual Studio 2012创建的C#Windows窗体应用程序无法在Windows XP上运行

  19. 19

    如何将C .DLL文件导入C#Windows窗体应用程序并调用其在标头中定义的函数?

  20. 20

    如何部署使用SQL Server Express 2012和Crystal Report开发的C#Windows窗体应用程序

  21. 21

    如何部署使用SQL Server Express 2012和Crystal Report开发的C#Windows窗体应用程序

  22. 22

    为C#Windows应用程序准备安装程序

  23. 23

    如何在C#Windows应用程序中将数据表导出到Excel

  24. 24

    如何在C#Windows应用程序中为HID设备编写驱动程序

  25. 25

    如何根据C#Windows Form应用程序中的项目在Listview列中添加Icon?

  26. 26

    设置C#Windows Universal应用程序的窗口标题

  27. 27

    从C#Windows应用程序调用URL

  28. 28

    C#Windows应用程序SharePoint登录

  29. 29

    使用C#Windows Form应用程序拖放Datagridview

热门标签

归档