procedure TFmXX.BtnFindClick(Sender: TObject); var i : integer; begin inherited; for i := 0 to BTvCity.Items.Count -1 do begin {如果和文本框匹配} if BTvCity.Items[i].Text = EdtNodeText.Text then begin {有父类的时候通过关闭展开父类让Tv自动定位} if BTvCity.Items[i].Parent <> nil then begin BTvCity.Items[i].Parent.Expanded := False; BTvCity.Items[i].Parent.Expanded := True; end else begin {通过关闭展开父类让Tv自动定位} BTvCity.Items[i].Expanded := False; BTvCity.Items[i].Expanded := True; end; {选择当前循环项,并退出循环,不然他会循环到最后浪费} BTvCity.Items[i].Selected := True; Break; end; end; end;
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论