当前位置:首页 » 业界相关

500分送上解决问题的一个人,其余入者100分

 Advertisement:

热门软件下载:


问题如下,对我来说,因为涉及到树视图控件和文件的合并操作,有些为难  
  但可能对你比较简单。因此请帮帮我:  
  1。动态添加文件到树视图的相应类别中,并同时存储文件。  
  2。双击树视图中的文件时打开文件。  
  3。程序关闭时序列化树视图的内容,程序启动时读入。  
  我用的是mdi界面,类似vc的界面。其它部分都已完成,但这个问题没有解决  
  请给出具体的实现或例程,不胜感激;  
  如果分不够您吱声,另开帖送上。万望帮忙,胜造七级浮屠。  
   
  系统限制分数吗?那我就想法捐给你吧。

推荐阅读

  • 各大品牌笔记本最新报价(04.11) [详细内容]
  • FCI面向PCI EXPRESS 信号处理推775孔插座 [详细内容]
  • 需求停滞 DRAM与NAND FLASH市况面临考验 [详细内容]
  • WindowsCE.net 4.1仿真环境入门 [详细内容]
  • 3100,6100i比比谁的速度快 [详细内容]
  • 05年全球半导体厂排名中芯国际第三IBM第五 [详细内容]
  • 明基二季度赢利24.1亿台币 比一季度增长11.4% [详细内容]
  • 网友回答:
    网友:newkey007

    我这有树序列化的代码  
      要的话,发短信,留下   email

    网友:xiaoshao_0_0

    up

    网友:edrftgyh

    我以前做过这样list控件的序列化,说到底也就是基于一个递归循环来存储list中的内容!

    网友:cxjlw

    请问一下,你所指的文件是什么类型的文件?

    网友:cxjlw

    序列化的实现如下:  
          to   serialize   the   tree   view   control   override   the   serialize()   function.   the   serialize()   function   is   a   virtual   function   defined   in   cobject.    
          in   the   code   below   we   save   the   outline   to   a   text   file   and   can   read   it   back   from   a   text   file.   when   saving   the   outline   to   the   archive,   tabs   are   used   to   indent   the   item   text.   again,   when   reading   back,   tabs   are   used   to   determine   the   level   that   the   newly   read   item   should   be   placed   at.    
           
       
      void   ctreectrlx::serialize(carchive&   ar)    
      {  
      if   (ar.isstoring())  
      {  
      //   storing   code  
      htreeitem   hti   =   getrootitem();  
      while(   hti   )  
      {  
      int   indent   =   getindentlevel(   hti   );  
      while(   indent--   )  
      ar.writestring(   "\t"   );  
      ar.writestring(   getitemtext(   hti   )   +   "\r\n");  
      hti   =   getnextitem(   hti   );  
      }  
       
      }  
      else  
      {  
      //   loading   code  
      cstring   sline;  
      if(   !ar.readstring(   sline   )   )  
      return;  
       
      htreeitem   hti   =   null;  
      int   indent,   baseindent   =   0;  
      while(   sline[baseindent]   ==   \t   )  
      baseindent++;  
      do  
      {  
      if(   sline.getlength()   ==   0   )  
      continue;  
      for(   indent   =   0;   sline[indent]   ==   \t;   indent++   )  
      ; //   we   dont   need   a   body  
      sline   =   sline.right(   sline.getlength()   -   indent   );  
      indent   -=   baseindent;  
       
      htreeitem   parent;  
      int   previndent   =   getindentlevel(   hti   );  
      if(   indent   ==     previndent)  
      parent   =   getparentitem(   hti   );  
      else   if(   indent   >   previndent   )  
      parent   =   hti;  
      else  
      {  
      int   nlevelsup   =   previndent   -   indent;  
      parent   =   getparentitem(   hti   );  
      while(   nlevelsup--   )  
      parent   =   getparentitem(   parent   );  
      }  
      hti   =   insertitem(   sline,   parent   ?   parent   :   tvi_root,   tvi_last   );  
      }while(   ar.readstring(   sline   )   );  
       
      }  
      }  
       
       
       
      int   ctreectrlx::getindentlevel(   htreeitem   hitem   )  
      {  
      int   iindent   =   0;  
       
      while(   (hitem   =   getparentitem(   hitem   ))   !=   null   )  
      iindent++;  
      return   iindent;  
      }  
       
       
      //   getnextitem -   get   next   item   as   if   outline   was   completely   expanded  
      //   returns -   the   item   immediately   below   the   reference   item  
      //   hitem -   the   reference   item  
      htreeitem   ctreectrlx::getnextitem(   htreeitem   hitem   )  
      {  
      htreeitem hti;  
       
      if(   itemhaschildren(   hitem   )   )  
      return   getchilditem(   hitem   ); //   return   first   child  
      else{  
      //   return   next   sibling   item  
      //   go   up   the   tree   to   find   a   parents   sibling   if   needed.  
      while(   (hti   =   getnextsiblingitem(   hitem   ))   ==   null   ){  
      if(   (hitem   =   getparentitem(   hitem   )   )   ==   null   )  
      return   null;  
      }  
      }  
      return   hti;  
      }  
       
     

    网友:feiniaoliang

    up

    网友:lshadow

    不太懂,但是想拿点分

    网友:ksyou

    up,蹭分来了

    网友:hnliuling

    to   newkey007(无限天空):  
        感谢支持。我的email:   rjb@fsdltd.com

    网友:awnucel

    gz

    网友:loopyifly

    ...  
       
      up

    网友:lshadow

    感觉不是那么难吧?

    网友:wizard_zj

    gz

    网友:pwtj

    rt

    网友:wwqna

    up

    网友:mcf2008

    不太懂,但是想拿点分  
     

    网友:lashengcrh

    up

    网友:lygfqy

    up  
     

    网友:hjhj001

    俺只是想来跟着学点东西。

    网友:lanzhengpeng2

    网友:sagasonme

    我做过一个简易的活动目录,  
      其中很大一部分是关于树结构的序列化的,  
      想要的话可以给我发email:sagasonme@sina.com

    网友:zjblue

    学习中!

    网友:wowuyinglingluan

    对不起,我劝你不要采取上边的路线。  
      数据和界面的分离才是良好的模式。  
      树仅仅是用来显示和出发消息的渠道。  
      树上显示的一切应在一个数据容器类中存储。  
      序列化仅仅是对应数据容器类的序列化,跟树没关。  
      这样,你就不需要一颗特殊的树了。  
      如果么保留树的当前显示状态,下次运行时采用一样的状态,  
      仅仅需要在数据容器类中针对各个项  
      添加一个记录是否展开和显示的变量即可。  
       
     

    网友:tryber

    高!!!  
      数据和界面的分离...  
      数据容器类的序列化...

    网友:bianhh

    高人,我是来领分的,谢l

    网友:wacky

    我做过类似的界面与存储过程,不过是存在数据库中,可以动态的读入写进多层树结构,是用的深度和广度

    网友:felics

    up一下

    网友:zyleon

    upupupupupupupupupup

    网友:lbilj

    学习

    网友:lipeng518888

    up

    网友:ffllyy

    你的题目好有吸引力,学习。  
      说得真够专业,看完才知道是要用树视图显示存储的文件,并动态更新。但我还是不太会,学习.

    网友:canjian

    up  
      不太懂,学习

    网友:yydyqy

    up   &   study

    网友:etboy327

    upupup

    网友:shaolunyuan

    up

    网友:xiang1358

    学习学习

    网友:syl08341

    up

    网友:aoosang

    学习接分中

    网友:7231725

    学习接分中

    网友:wowuyinglingluan

    数据结构实际上就是个多杈树,  
      一般对于使用stl   来说,这种多杈树可以利用list来构建,下面随手写一个小类,  
      仅仅说明问题,并不完善,可以参考它进行你的工作  
       
      #include   <list>  
      using   namespace   std;  
       
      template<class   t>  
      struct   multitree  
      {  
              t   m_data;  
      void   addchild(t   data)  
      {  
      multitree<t>   *   p=new   multitree<t>;  
      p->m_data=data;  
      m_child.push_back(p);  
      }  
              list<multitree*   >   m_child;  
      };

    网友:atpxn126

    网友:firetoucher

    水平所限,只能up:(

    网友:superzrb

    up

    网友:awwjian

    学习

    网友:studyall

    xue   xi

    网友:csdn_lee

    up

    网友:ern

    gz

    网友:smartlife

    up

    网友:giv3n

    目前对我太难了..帮你up

    网友:softsongs

    up

    网友:joachern

    up

    网友:fengxvhui

    数据和界面的分离才是良好的模式。  
      树仅仅是用来显示和出发消息的渠道。  
      树上显示的一切应在一个数据容器类中存储。  
      序列化仅仅是对应数据容器类的序列化,跟树没关。  
      这样,你就不需要一颗特殊的树了。  
      如果么保留树的当前显示状态,下次运行时采用一样的状态,  
      仅仅需要在数据容器类中针对各个项  
      添加一个记录是否展开和显示的变量即可。  
       
      能否详细解释一下,谢谢!

    网友:zhanglingfei

    关注ing!

    网友:sheetrayl

    up

    .  

    相关评论

    Login