xp, dephi 7.0
我用了一个shellcombobox在sample下
为什么是这样
桌面
  c:
  d:
  e:
  我的文档
  我的电脑
磁盘应该在我的电脑的分支下,为什么跑到桌面下了?

解决方案 »

  1.   

    确定你的shellcombobox控件的root属性是rfDesktop么?我想可能是你的系统的原因吧~~我这里用的好好的
      

  2.   

    是rfDesktop呀。
    刚刚想学Dephi,居然遇到这个不讲理的问题,顿时心情大减。
    到底不是MS的东西,我用了C#很长时间了,很少遇到这种莫名其妙的错误。
      

  3.   

    我用的DELPHI6,那现象不奇怪。。这是有意这样设计的。
      

  4.   

    我这是DELPHI6带的源码,可能同D7的不同。。
    反正它初始化ShellCombox就是这个地方。。procedure TCustomShellComboBox.Init;
    var
      MyComputer: PItemIDList;
      Index: Integer;
    begin
      //show desktop contents, expand My Computer if at desktop.
      //!!!otherwise expand the root.
      ItemsEx.BeginUpdate;
      try
        AddItems(0, FRootFolder);    if Root = SRFDesktop then
        begin
          SHGetSpecialFolderLocation(0, CSIDL_DRIVES, MyComputer);
          Index := IndexFromID(MyComputer);
          if Index <> -1 then
            AddItems(Index, Folders[Index]);
        end;
      finally
        ItemsEx.EndUpdate;
      end;    
    end;
    因为SHELLCOMBOBOX是放在SAMPLES页,不是VCL主干组件,你不妨自己稍作修改。