コード例 #1
0
        /// <summary>
        ///     初始化明信片影集时触发的操作
        /// </summary>
        /// <param name="sender">需要初始化的明信片</param>
        private void PostCardTypeNodeInit(PostCardType sender)
        {
            if (sender.ParentPostCardAlbum != null)
            {
                sender.Node = sender.ParentPostCardAlbum.Node.Nodes.Add();
            }
            else
            {
                sender.Node = treeList1.Nodes.Add();
            }

            if (sender.GetType().Name == "PostCard")
            {
                sender.Node.SetValue(treeFileName, ((PostCard)sender).SourceFile.Name);
                sender.Node.SetValue(state, ((PostCard)sender).State);
                sender.Node.ImageIndex = sender.Node.SelectImageIndex = 1;
            }

            if (sender.GetType().Name == "PostCardAlbum")
            {
                sender.Node.SetValue(state, "");
                sender.Node.SetValue(treeFileName, ((PostCardAlbum)sender).SourceFolderInfo.Name);
            }

            if (sender.Node.ParentNode != null && sender.Node.ParentNode.Expanded == false)
            {
                sender.Node.ParentNode.ExpandAll();
            }
            if (_currentPostCard == null && _currentPostCardAlbum == null)
            {
                sender.Node.Selected = true;
            }
            Application.DoEvents();
        }
コード例 #2
0
 /// <summary>
 ///     删除影集时触发的操作
 /// </summary>
 /// <param name="sender"></param>
 private void PostCardAlbumRemoving(PostCardType sender)
 {
     treeList1.DeleteNode(sender.Node);
 }