Esempio n. 1
0
        /// <summary>
        /// Add Image to display thumbnail
        /// </summary>
        /// <param name="name"></param>
        /// <param name="image"></param>
        public void AddImage(string name, Image image)
        {
            ThumbnailButton btn = new ThumbnailButton();

            btn.Name = name;
            btn.ImageSizeSymmetric = ImageSizeSymmetric;
            btn.Image = image;

            btn.Click += thumbnailButton_Click;
            this.Controls.Add(btn);
        }
Esempio n. 2
0
 /// <summary>
 /// Get Image.
 /// </summary>
 /// <param name="name">Name of image.</param>
 /// <returns></returns>
 public Image GetImageByName(string name)
 {
     for (int i = 0; i < this.Controls.Count; i++)
     {
         ThumbnailButton btn = (ThumbnailButton)this.Controls[i];
         if (btn.Name.Equals(name))
         {
             return(btn.Image);
         }
     }
     return(null);
 }
Esempio n. 3
0
        /// <summary>
        /// Get Thumbnail button by Image object.
        /// </summary>
        /// <param name="image"></param>
        /// <returns></returns>
        public ThumbnailButton GetThumbnailButtonByImage(Image image)
        {
            for (int i = 0; i < this.Controls.Count; i++)
            {
                ThumbnailButton btn = (ThumbnailButton)this.Controls[i];
                if (btn.Image.Equals(image))
                {
                    return(btn);
                }
            }

            return(null);
        }
Esempio n. 4
0
        /// <summary>
        /// Remove Image button.
        /// </summary>
        /// <param name="name">Name of image.</param>
        public void RemoveImage(string name)
        {
            for (int i = 0; i < this.Controls.Count; i++)
            {
                if (this.Controls[i] is ThumbnailButton)
                {
                    ThumbnailButton button = this.Controls[i] as ThumbnailButton;
                    if (button == null)
                    {
                        continue;
                    }

                    if (button.Name.Equals(name))
                    {
                        this.Controls.Remove(button);
                        return;
                    }
                }
            } // end for.
        }
Esempio n. 5
0
 void thumbnailButton_Click(object sender, EventArgs e)
 {
     m_selectedThumbnailButton = sender as ThumbnailButton;
 }