示例#1
0
        private void cmdLoadIcon_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter = "Image Files|*.BMP;*.JPG;*.JPEG;*.GIF;*.PNG;*.EMF;*.EXIF;*.ICO;*.TIF;*.WMF";

            DialogResult dr = dialog.ShowDialog();

            if (dr == DialogResult.OK)
            {
                pictureIcon.Image = IconUtilities.CreateSquareThumbnail(Image.FromFile(dialog.FileName), IconSize);
            }
        }
示例#2
0
        /// <summary>
        /// Takes an icon as a byte[], adds it to the images list, and returns its new index in the list.
        /// </summary>
        private int AddIcon(byte[] participantIcon)
        {
            Image icon = IconUtilities.BytesToImage(participantIcon);
            int   imageIndex;

            if (icon == null)
            {
                imageIndex = this.defaultIconIndex;
            }
            else
            {
                imageIndex = images.Images.Add(icon, images.TransparentColor);
            }

            return(imageIndex);
        }