如何根据使用MFC树控件的某些关系表来表示树

编程入门 行业动态 更新时间:2024-10-26 15:25:31
本文介绍了如何根据使用MFC树控件的某些关系表来表示树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想使用从数据库(MySQL)获得的一些关系表。这些表有关系数据;例如:表权限包括数据DepartmentID结构,表部门也包括它。 树如下:(00代表树的根节点ID,0102 0304是00的子节点。它们属于同一类。就像这样,0101是01的子节点;010101是0101的子节点; 01010101是010101的子节点......) 00CompanyName 01Department1_Name 0101Department1_Sub1_Name 010101Department1_Sub1_Sub1_Name 01010101Department1_Sub1_Sub1_Sub1_Name 02Department2_Name 0201 Department2_Sub1_Name 020101Department2_Sub1_Sub1_Name 020102Department2_Sub1_Sub2_Name 03Department3_Name 0301Department3_Sub1_Name 0302Department3_Sub2_Name 04Department4_Name 我有什么试过: 首先,从数据库(MySQL)保存表。目前我使用地图和矢量格式来保存数据。 其次,根据这些表中的关系数据表示节点关系(目前我使用while和find方式来表示但是性能和速度太差了因为有大量的数据) 第三,我根据这些节点使用MFC树控件来表示关系树(现在我使用的是从所有节点然后将节点插入树中。当然慢慢加速)

I want to use some relational tables obtained from the database(MySQL).These tables has relational data ; For example: Table Permission includes data "DepartmentID" structure and Table Department also includes it. The tree like followings:("00" stands for the root node ID of the tree,"01" "02" "03" "04" are the child node of "00" .They belongs to the same class .Like this ,"0101" is the child node of "01" ;"010101" is the child node of "0101" ; "01010101" is the child node of "010101" ......) "00" CompanyName "01" Department1_Name "0101" Department1_Sub1_Name "010101" Department1_Sub1_Sub1_Name "01010101" Department1_Sub1_Sub1_Sub1_Name "02" Department2_Name "0201" Department2_Sub1_Name "020101" Department2_Sub1_Sub1_Name "020102" Department2_Sub1_Sub2_Name "03" Department3_Name "0301" Department3_Sub1_Name "0302" Department3_Sub2_Name "04" Department4_Name What I have tried: Firstly,saving the tables from the database(MySQL).Currently I use the map and vector format to save the data. Secondly,representing the node relationship according to the relational data in these tables(currently I use the "while" and "find" ways to represent BUT the performance and speed is too bad because of the much amount of data) Thirdly,I use the MFC Tree Control to represent a relation-tree according to these nodes (Now I use the retrival ways from all of the nodes and then insert node into the tree .Of course slowly speed)

推荐答案

性能往往与数据量成反比关系。因此,如果要从数据库中提取所有数据并从中构建树控件,那么性能可能会很慢。您应该首先提取顶级节点,然后在TreeControl中显示这些节点。然后,当用户单击某个节点进行展开时,您将获取相关数据并再次显示这些项目。 Performance tends to be in inverse relation to the amount of data. So if you are extracting all the data from the database and building the tree control from that, then performance is likely to be slow. You should only extract the top level nodes at first, and display those in the TreeControl. Then when the user clicks a node to expand it, you fetch the relevant data and again display just those items.

更多推荐

如何根据使用MFC树控件的某些关系表来表示树

本文发布于:2023-10-19 15:03:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1507878.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控件   关系   MFC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!