当前位置: 首页>>代码示例>>C#>>正文


C# TreeNode.set_Tag方法代码示例

本文整理汇总了C#中System.Windows.Forms.TreeNode.set_Tag方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.set_Tag方法的具体用法?C# TreeNode.set_Tag怎么用?C# TreeNode.set_Tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.TreeNode的用法示例。


在下文中一共展示了TreeNode.set_Tag方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddApartmment

 private void AddApartmment()
 {
     if (House.FindByAddress((LocalAddress) this.SelectedAddress.Parent) == House.Null)
     {
         LocalAddress.AddHouse((LocalAddress) this.SelectedAddress.Parent);
     }
     Apartment apartment = new Apartment {
         AdrId = this.SelectedAddress.Id
     };
     apartment.SetNewNumber();
     apartment.HouseId = (this.SelectedAddress.Level == AddressLevel.MaxAddress) ? this.SelectedAddress.GetParent().GetHouse().Id : this.SelectedAddress.GetHouse().Id;
     if (Apartment.IsExistNumber(apartment.Number))
     {
         Messages.ShowWarning("На этот адрес заведен паспорт квартиры. Попробуйте поменять номер имеющегося паспорта квартиры, чтобы избежать повторения номеров паспортов.");
     }
     else
     {
         apartment.SaveChanges();
         System.Windows.Forms.TreeNode node = new System.Windows.Forms.TreeNode(apartment.ToString());
         node.set_Tag(apartment);
         base.SelectedNode.Nodes.Add(node);
         base.SelectedNode.Expand();
         base.set_SelectedNode(node);
     }
 }
开发者ID:u4097,项目名称:SQLScript,代码行数:25,代码来源:LocalAddressTree.cs

示例2: ShowSettlements

 public void ShowSettlements()
 {
     base.Nodes.Clear();
     foreach (LocalAddress address in LocalAddress.GetLevelAddresses(AddressLevel.MinAddress))
     {
         System.Windows.Forms.TreeNode node = new System.Windows.Forms.TreeNode(address.Name);
         node.set_Tag(address);
         node.Nodes.Add("");
         base.Nodes.Add(node);
     }
     if (base.Nodes.get_Count() == 1)
     {
         base.Nodes.get_Item(0).Expand();
     }
 }
开发者ID:u4097,项目名称:SQLScript,代码行数:15,代码来源:LocalAddressTree.cs

示例3: AddAndSelectNode

 private void AddAndSelectNode(LocalAddress address)
 {
     System.Windows.Forms.TreeNode node = new System.Windows.Forms.TreeNode(address.NameSocr.Trim() + this.GetSocr(address.Level));
     node.set_Tag(address);
     if (this.IsExistChildren(address))
     {
         node.Nodes.Add("");
     }
     base.SelectedNode.Nodes.Add(node);
     base.set_SelectedNode(node);
 }
开发者ID:u4097,项目名称:SQLScript,代码行数:11,代码来源:LocalAddressTree.cs

示例4: tree_BeforeExpand

 protected override void tree_BeforeExpand(object sender, System.Windows.Forms.TreeViewCancelEventArgs e)
 {
     System.Windows.Forms.TreeNode node = e.Node;
     if (node.get_Tag().GetType() == typeof(LocalAddress))
     {
         node.Nodes.Clear();
         System.Windows.Forms.Cursor.set_Current(System.Windows.Forms.Cursors.WaitCursor);
         LocalAddress address = (LocalAddress) node.get_Tag();
         foreach (System.Collections.Generic.KeyValuePair<LocalAddress, int> pair in address.GetChildrenWithCount())
         {
             System.Windows.Forms.TreeNode node2 = new System.Windows.Forms.TreeNode((pair.Key.Level == AddressLevel.Улица) ? (pair.Key.NameSocr + this.GetSocr(pair.Key.Level)) : (pair.Key.Name + this.GetSocr(pair.Key.Level)));
             node2.set_Tag(pair.Key);
             if (pair.Value > 0)
             {
                 node2.Nodes.Add("");
             }
             if ((pair.Key.Level == AddressLevel.MaxAddress) && (Apartment.FindByAddress(pair.Key).get_Count() > 0))
             {
                 node2.Nodes.Add("");
             }
             node.Nodes.Add(node2);
         }
         if (address.Level == AddressLevel.MaxAddress)
         {
             foreach (Apartment apartment in Apartment.FindByAddress(address))
             {
                 node.Nodes.Add(new ApartmentNode(apartment));
             }
         }
         System.Windows.Forms.Cursor.set_Current(System.Windows.Forms.Cursors.Default);
     }
 }
开发者ID:u4097,项目名称:SQLScript,代码行数:32,代码来源:LocalAddressTree.cs

示例5: AddNode

 public void AddNode(System.Windows.Forms.TreeNode node)
 {
     base.BeginUpdate();
     LocalAddress address = (LocalAddress) node.get_Tag();
     if (address.Level == AddressLevel.MinAddress)
     {
         System.Windows.Forms.TreeNode node2 = this.FindCityNode(node);
         if (node2 == null)
         {
             base.Nodes.Add((System.Windows.Forms.TreeNode) node.Clone());
         }
         else
         {
             foreach (System.Windows.Forms.TreeNode node3 in node.Nodes)
             {
                 node2.Nodes.Add((System.Windows.Forms.TreeNode) node3.Clone());
             }
         }
     }
     else if (address.Level == AddressLevel.Улица)
     {
         System.Windows.Forms.TreeNode streetNode = this.FindCityNode(node.Parent);
         if (streetNode == null)
         {
             streetNode = base.Nodes.Add(node.Parent.get_Text());
             streetNode.set_Tag(node.Parent.get_Tag());
             streetNode.Nodes.Add((System.Windows.Forms.TreeNode) node.Clone());
         }
         else
         {
             System.Windows.Forms.TreeNode node5 = this.FindHouseNode(streetNode, node);
             if (node5 == null)
             {
                 streetNode.Nodes.Add((System.Windows.Forms.TreeNode) node.Clone());
             }
             else
             {
                 foreach (System.Windows.Forms.TreeNode node6 in node.Nodes)
                 {
                     node5.Nodes.Add((System.Windows.Forms.TreeNode) node6.Clone());
                 }
             }
         }
     }
     else if (address.Level == AddressLevel.Дом)
     {
         System.Windows.Forms.TreeNode node7 = this.FindCityNode(node.Parent.Parent);
         if (node7 == null)
         {
             node7 = base.Nodes.Add(node.Parent.Parent.get_Text());
             node7.set_Tag(node.Parent.Parent.get_Tag());
             System.Windows.Forms.TreeNode node8 = new System.Windows.Forms.TreeNode(node.Parent.get_Text());
             node8.set_Tag(node.Parent.get_Tag());
             node7.Nodes.Add(node8);
             node8.Nodes.Add((System.Windows.Forms.TreeNode) node.Clone());
         }
         else
         {
             System.Windows.Forms.TreeNode node9 = this.FindHouseNode(node7, node.Parent);
             if (node9 == null)
             {
                 node9 = node7.Nodes.Add(node.Parent.get_Text());
                 node9.set_Tag(node.Parent.get_Tag());
             }
             node9.Nodes.Add((System.Windows.Forms.TreeNode) node.Clone());
         }
     }
     else
     {
         System.Windows.Forms.TreeNode node10 = this.FindCityNode(node.Parent.Parent.Parent);
         if (node10 == null)
         {
             node10 = base.Nodes.Add(node.Parent.Parent.Parent.get_Text());
             node10.set_Tag(node.Parent.Parent.Parent.get_Tag());
             System.Windows.Forms.TreeNode node11 = new System.Windows.Forms.TreeNode(node.Parent.Parent.get_Text());
             node11.set_Tag(node.Parent.Parent.get_Tag());
             node10.Nodes.Add(node11);
             System.Windows.Forms.TreeNode node12 = new System.Windows.Forms.TreeNode(node.Parent.get_Text());
             node12.set_Tag(node.Parent.get_Tag());
             node11.Nodes.Add(node12);
             node12.Nodes.Add((System.Windows.Forms.TreeNode) node.Clone());
         }
         else
         {
             System.Windows.Forms.TreeNode node13 = this.FindHouseNode(node10, node.Parent.Parent);
             if (node13 == null)
             {
                 node13 = node10.Nodes.Add(node.Parent.Parent.get_Text());
                 node13.set_Tag(node.Parent.Parent.get_Tag());
             }
             System.Windows.Forms.TreeNode node14 = this.FindHouseNode(node13, node.Parent);
             if (node14 == null)
             {
                 node14 = node13.Nodes.Add(node.Parent.get_Text());
                 node14.set_Tag(node.Parent.get_Tag());
             }
             node14.Nodes.Add((System.Windows.Forms.TreeNode) node.Clone());
         }
     }
     base.EndUpdate();
//.........这里部分代码省略.........
开发者ID:u4097,项目名称:SQLScript,代码行数:101,代码来源:DbTree.cs

示例6: FillAreaAddressesNew

 public void FillAreaAddressesNew(Area area, System.Collections.Generic.List<LocalAddress> citys, System.Collections.Generic.Dictionary<long, System.Collections.Generic.List<LocalAddress>> streets, System.Collections.Generic.Dictionary<long, System.Collections.Generic.List<LocalAddress>> houses, System.Collections.Generic.Dictionary<long, System.Collections.Generic.List<LocalAddress>> flats)
 {
     foreach (LocalAddress address in citys)
     {
         System.Windows.Forms.TreeNode node = new System.Windows.Forms.TreeNode(address.NameSocr);
         node.set_Tag(address);
         base.Nodes.Add(node);
         if (streets.ContainsKey(address.Id))
         {
             foreach (LocalAddress address2 in streets[address.Id])
             {
                 System.Windows.Forms.TreeNode node2 = new System.Windows.Forms.TreeNode(address2.NameSocr);
                 node2.set_Tag(address2);
                 node.Nodes.Add(node2);
                 if (houses.ContainsKey(address2.Id))
                 {
                     foreach (LocalAddress address3 in houses[address2.Id])
                     {
                         System.Windows.Forms.TreeNode node3 = node2.Nodes.Add(Utility.AddDigits(4, address3.Name, " "));
                         node3.set_Tag(address3);
                         if (flats.ContainsKey(address3.Id))
                         {
                             foreach (LocalAddress address4 in flats[address3.Id])
                             {
                                 node3.Nodes.Add(Utility.AddDigits(4, address4.Name, " ")).set_Tag(address4);
                             }
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:u4097,项目名称:SQLScript,代码行数:33,代码来源:DbTree.cs

示例7: FillAreaAddresses2

 public void FillAreaAddresses2(LocalAddress parent, System.Windows.Forms.TreeNodeCollection coll, System.Collections.Generic.IList<LocalAddress> adr, AddressLevel level)
 {
     if (level <= AddressLevel.MaxAddress)
     {
         foreach (LocalAddress address in adr)
         {
             if (address.ParentId == parent.Id)
             {
                 System.Windows.Forms.TreeNode node = new System.Windows.Forms.TreeNode(address.NameSocr);
                 node.set_Tag(address);
                 coll.Add(node);
                 node.Nodes.Add("");
                 this.FillAreaAddresses2(address, node.Nodes, adr, level + AddressLevel.MinAddress);
             }
         }
     }
 }
开发者ID:u4097,项目名称:SQLScript,代码行数:17,代码来源:DbTree.cs


注:本文中的System.Windows.Forms.TreeNode.set_Tag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。