treeview的节点显示中文名称,每个对应不同的网址,点击就跳到各个网站,怎么做??

解决方案 »

  1.   

    onclick中用shellexec(。)参数自己查。
      

  2.   

    可我想 点击后的网站在程序中的webBrower里打开。
      

  3.   

    你好好的看看TTreeNode的 AddObject、AddChildObject、AddChildObjectFirst 等方法吧!对你很有帮助的,Delphi也给了段示例代码的。
    AddObject, Count, Data Example
    The following code defines a record type of TMyRec and a record pointer type of PMyRec.type
    PMyRec = ^TMyRec;
    TMyRec = record
      FName: string;
      LName: string;
    end;Assuming these types are used, the following code adds a node to TreeView1 as the last sibling of a specified node. A TMyRec record is associated with the added item. The FName and LName fields are obtained from edit boxes Edit1 and Edit2. The Index parameter is obtained from edit box Edit3. The item is added only if the Index is a valid value.procedure TForm1.Button1Click(Sender: TObject);var
      MyRecPtr: PMyRec;
      TreeViewIndex: LongInt;
    begin
      New(MyRecPtr);
      MyRecPtr^.FName := Edit1.Text;
      MyRecPtr^.LName := Edit2.Text;
      TreeViewIndex := StrToInt(Edit3.Text);
      with TreeView1 do
      begin
        if Items.Count = 0 then
          Items.AddObject(nil, 'Item' + IntToStr(TreeViewIndex), MyRecPtr)
        else if (TreeViewIndex < Items.Count) and (TreeViewIndex >= 0) then      Items.AddObject(Items[TreeViewIndex], 'Item' + IntToStr(TreeViewIndex), MyRecPtr);
      end;
    end;After an item containing a TMyRec record has been added, the following code retrieves the FName and LName values associated with the item and displays the values in a label.procedure TForm1.Button2Click(Sender: TObject);begin
      Label1.Caption := PMyRec(TreeView1.Selected.Data)^.FName + ' ' +
                      PMyRec(TreeView1.Selected.Data)^.LName;
    end;
      

  4.   

    不是很明白呀,那个老大能说明白点呀,在vb里很容易做到的事情,delphi这么麻烦呀
      

  5.   

    onclick中获取节点的地址,然后webbrower.Navigete('地址').delphi和vb用法差不多的。
      

  6.   

    节点里绑定 WEB地址, 点击后就打开,
      

  7.   

    能发段代码吗,学习学习。
    节点显示网站名称,点击则到该网站上比如  节点 为“网易”,点击后,webbrower里显示http://www.163.com的内容
      

  8.   

    在TreeVIew的node里面有一个data,是一个指针类型的数据,如果你对指针比较熟悉的话,建议使用一个TStringList保存URL地址(http://www.163.com)然后将Tstringlist的指针存到相应节点的data字段里面去,这时候每当点击了这个节点都可以通过data的值找到URL,然后就可以在网页中打开了。
    如果你对指针不是太熟悉的话,你可以做一个小小的数据库,保存网站名称和URL的对应关系,然后在单击时间事件中,你可以通过.text的值到数据库中找到相应的URL,然后...
    应该可以了吧!
      

  9.   

    type
    PMyRec = ^TMyRec;
    TMyRec = record
      strURL: string;
    end;procedure TForm1.Button1Click(Sender: TObject);
    var
        MyRecPtr: PMyRec;
        TreeNode:TTreeNode;
    begin
        TreeNode:=TreeView1.Items.AddChild(nil,'网址列表');
        New(MyRecPtr);
        MyRecPtr^.strURL := 'http://www.163.com';
        TreeView1.Items.AddChildObject(TreeNode,'网易',MyRecPtr);
    end;procedure TForm1.TreeView1Click(Sender: TObject);
    begin
        if TreeView1.Selected<>nil then
        begin
            if TreeView1.Selected.Data<>nil then
            begin
                Label1.Caption:='网址为:'+PMyRec(TreeView1.Selected.Data)^.strURL;
            end;
        end;
    end;
      

  10.   

    使用data属性,指向一个网址地址即可
      

  11.   

    gzmhero(hihihi)他的这个方法不错