상속: IDisposable, ISerializable
예제 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Album newAlbum = new Album(this.txtTitle.Text, this.txtDescription.Text, this.txtAuthor.Text);
            newAlbum.MainImage = this.pbMainPhoto.Image;

            Photo newPhoto = new Photo(this.pbMainPhoto.Image);

            newAlbum.AddPhoto(newPhoto);

            parentGallery.GalleryObject.AddAlbum(newAlbum);
            parentGallery.GalleryObject = this.parentGallery.GalleryObject;

            this.Close();
        }
예제 #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (this.txtTitle.Text != string.Empty)
            {
                Photo newPhoto = new Photo(this.pbPhoto.Image);
                newPhoto.vtitle = this.txtTitle.Text;
                newPhoto.vauthor = this.txtAuthor.Text;
                newPhoto.vdescription = this.txtDescription.Text;
                newPhoto.vimagepath = this.pathToPhoto;
                newPhoto.valbumid = parentGallery.GetSelectedAlbumIcon().AlbumObject.vid;

                parentGallery.GetSelectedAlbumIcon().AlbumObject.AddPhoto(newPhoto);
                parentGallery.RefreshPhotosView();
                this.Close();
            }
            else
            {
                MessageBox.Show("Podaj tytuł zdjęcia!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
예제 #3
0
 public bool SavePhotoToAlbum(Album album, Photo photo)
 {
     throw new System.Exception("Not implemented");
 }
예제 #4
0
 public Photo SavePhoto(Photo photo)
 {
     throw new System.Exception("Not implemented");
 }
예제 #5
0
 /// <summary>
 /// Method to delete the photo
 /// </summary>
 /// <param name="item">Photo object to delete</param>
 public void DeletePhoto(Photo item)
 {
     if (this.Photos != null)
     {
         this.Photos.Remove(item);
     }
 }
예제 #6
0
        /// <summary>
        /// Method to add the photo to the album
        /// </summary>
        /// <param name="item">Photo object to add</param>
        public void AddPhoto(Photo item)
        {
            if (this.Photos == null)
            {
                this.listPhotos = new List<Photo>();
            }

            this.Photos.Add(item);
        }
예제 #7
0
 /// <summary>
 /// Dodaje zdjêcie do danego albumu i zapisuje na dysku
 /// </summary>
 public bool SavePhotoToAlbum(Album album, Photo photo)
 {
     FileAdapter<Album> adapter = new FileAdapter<Album>();
     return true;
 }
예제 #8
0
 /// <summary>
 /// Zapisuje plik z danymi danego zdjêcia
 /// </summary>
 public Photo SavePhoto(Photo photo)
 {
     FileAdapter<Photo> adapter = new FileAdapter<Photo>();
     return new Photo(".");
 }
예제 #9
0
 public void AddPhoto(Photo item)
 {
     this.listPhotos.Add(item);
 }
예제 #10
0
 public void DeletePhoto(Photo item)
 {
     this.listPhotos.Remove(item);
 }
예제 #11
0
        /// <summary>
        /// Static method to zoom out Photo object
        /// </summary>
        /// <param name="photo">Photo object to zoom out</param>
        /// <param name="percent">Percent by which zoom out the photo</param>
        /// <returns></returns>
        public static Photo ZoomInOut(Photo photo, int percent)
        {
            int orginalWidth = photo.vimageobject.Width;
            int orginalHeight = photo.vimageobject.Height;

            int resizedWidth = orginalWidth - (int)(orginalWidth * percent / 100);
            int resizedHeight = orginalHeight - (int)(orginalHeight * percent / 100);

            Bitmap bmp = new Bitmap(resizedWidth, resizedHeight);

            Graphics graphic = Graphics.FromImage((Image)bmp);
            graphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;

            graphic.DrawImage(photo.m_oPhoto, 0, 0, resizedWidth, resizedHeight);

            return photo;
        }
예제 #12
0
        /// <summary>
        /// Static method to resize Photo object
        /// </summary>
        /// <param name="photo">Photo object to resize</param>
        /// <param name="width">New photo's width</param>
        /// <param name="height">New photo's height</param>
        /// <returns></returns>
        public static Photo ResizeTo(Photo photo, int width, int height)
        {
            int orginalWidth = photo.vimageobject.Width;
            int orginalHeight = photo.vimageobject.Height;

            Bitmap bmp = new Bitmap(width, height);

            Graphics graphic = Graphics.FromImage((Image)bmp);
            graphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;

            graphic.DrawImage(photo.m_oPhoto, 0, 0, width, height);

            return photo;
        }