コード例 #1
0
        /// <summary>
        /// 向集合中添加一个图片。
        /// </summary>
        /// <param name="fileName">图片文件名。</param>
        public void AddPic(string fileName)
        {
            PicsBrowserItem pbi = new PicsBrowserItem(System.Drawing.Image.FromFile(fileName), System.IO.Path.GetFileName(fileName), System.IO.Path.GetFileNameWithoutExtension(fileName));

            pbi.Size = this.PicSize;
            this.flowLayoutPanel1.Controls.Add(pbi);
        }
コード例 #2
0
        ///// <summary>
        ///// 向集合中添加一个图片。
        ///// </summary>
        ///// <param name="fileName">图片文件名。</param>
        ///// <param name="Declaration">说明。</param>
        //public void AddPic(string fileName, string Declaration)
        //{
        //    PicsBrowserItem pbi = new PicsBrowserItem(fileName, System.Guid.NewGuid().ToString() + System.IO.Path.GetExtension(fileName), Declaration);
        //    pbi.Size = this.PicSize;
        //    this.flowLayoutPanel1.Controls.Add(pbi);
        //}

        /// <summary>
        /// 添加一个图片。
        /// </summary>
        /// <param name="img">图片信息。</param>
        /// <param name="Name">图片名称。</param>
        /// <param name="Declaration">说明。</param>
        public void AddPic(Image img, string Name, string Declaration)
        {
            PicsBrowserItem pbi = new PicsBrowserItem(img, Name, Declaration);

            pbi.Size = this.PicSize;
            this.flowLayoutPanel1.Controls.Add(pbi);
        }
コード例 #3
0
        ///// <summary>
        ///// 从集合中移除指定的图片信息。
        ///// </summary>
        ///// <param name="img">待移除的图片。</param>
        //public void Remove(Image img)
        //{
        //    for (int i = 0; i < this.flowLayoutPanel1.Controls.Count; i++)
        //    {
        //        PicsBrowserItem pbi = this.flowLayoutPanel1.Controls[i] as PicsBrowserItem;
        //        if (pbi != null && pbi.Image == img)
        //        {
        //            this.flowLayoutPanel1.Controls.Remove(pbi);
        //            return;
        //        }
        //    }

        //}

        /// <summary>
        /// 从集合中移除指定的图片信息。
        /// </summary>
        /// <param name="name">待移除的图片名称。</param>
        public void Remove(string name)
        {
            for (int i = 0; i < this.flowLayoutPanel1.Controls.Count; i++)
            {
                PicsBrowserItem pbi = this.flowLayoutPanel1.Controls[i] as PicsBrowserItem;
                if (pbi != null && pbi.Name == name)
                {
                    this.flowLayoutPanel1.Controls.Remove(pbi);
                    return;
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// 从集合中移除指定的图片信息。
 /// </summary>
 /// <param name="pbi">待移除的图片项目。</param>
 public void Remove(PicsBrowserItem pbi)
 {
     this.flowLayoutPanel1.Controls.Remove(pbi);
 }
コード例 #5
0
 /// <summary>
 /// 添加一个图片项目。
 /// </summary>
 /// <param name="pbi">图片项目。</param>
 public void AddPic(PicsBrowserItem pbi)
 {
     pbi.Size = this.PicSize;
     this.flowLayoutPanel1.Controls.Add(pbi);
 }