private void LoadPhotos(Album album) { List <Photo> photosToLoad = album.Photos; //remove all PhotoIcon objects foreach (Control ctrl in this.panelPhotos.Controls) { if (ctrl is PhotoIcon) { this.panelPhotos.Controls.Remove(ctrl); } } int nextPhotoLocation = leftMargin; //create new PhotoIcon objects with photos from selected Album foreach (Photo pht in photosToLoad) { PhotoIcon photo = new PhotoIcon(); photo.Size = new Size(widthPhotoObject, heightPhotoObject); photo.Location = new Point(nextPhotoLocation, topMargin); photo.Visible = true; photo.PhotoObject = pht; photo.PhotoClick += new PhotoIcon.PhotoIconClick(photo_Click); this.panelPhotos.Controls.Add(photo); nextPhotoLocation += widthPhotoObject + leftMargin; } }
public frmPhotoEdit(PhotoIcon photoToEdit, PhotoGallery parentGallery) { InitializeComponent(); this.photo = photoToEdit; this.parentPhotoGallery = parentGallery; this.txtTitle.Text = photoToEdit.PhotoObject.vtitle; this.txtDescription.Text = photoToEdit.PhotoObject.vdescription; this.txtAuthor.Text = photoToEdit.PhotoObject.vauthor; this.pbPhoto.Image = photoToEdit.PhotoObject.vimageobject; }
void photo_Click(object sender, EventArgs e) { PhotoIcon photoIco = ((PhotoIcon)sender); this.txtAuthor.Visible = false; this.txtDate.Visible = false; this.MainPicture.Image = photoIco.PhotoObject.vimageobject; this.txtAuthor.Text = photoIco.PhotoObject.vauthor; this.txtTitle.Text = photoIco.PhotoObject.vtitle; this.txtAuthor.Visible = true; this.txtDate.Visible = true; this.txtDate.Text = photoIco.PhotoObject.vdateadded; }
void photo_Click(object sender, EventArgs e) { PhotoIcon photoIco = ((PhotoIcon)sender); this.pictureNotes.Visible = false; this.txtAuthor.Visible = false; this.txtDate.Visible = false; this.MainPicture.Image = photoIco.PhotoObject.Image; this.pictureNotes.Visible = true; this.txtAuthor.Text = photoIco.PhotoObject.Author; this.txtTitle.Text = photoIco.PhotoObject.Title; this.txtAuthor.Visible = true; this.txtDate.Visible = true; this.txtDate.Text = photoIco.PhotoObject.DateAdded.ToShortDateString(); }
public void LoadPhotos(Album album) { //remove all PhotoIcon objects foreach (Control ctrl in this.panelPhotos.Controls) { if (ctrl is PhotoIcon) { this.panelPhotos.Controls.Remove(ctrl); } } this.MainPicture.Image = null; this.txtAuthor.Text = string.Empty; this.txtTitle.Text = string.Empty; this.txtDate.Text = string.Empty; if (album != null) { List <Photo> photosToLoad = album.vphotos; this.panelPhotos.AutoScrollPosition = new Point(0, 0); int nextPhotoLocation = leftMargin; //create new PhotoIcon objects with photos from selected Album foreach (Photo pht in photosToLoad) { PhotoIcon photo = new PhotoIcon(); photo.Size = new Size(widthPhotoObject, heightPhotoObject); photo.Location = new Point(nextPhotoLocation, topMargin); photo.PhotoClick += new PhotoIcon.PhotoIconClick(photo_Click); photo.ContextMenuStrip = this.cmPhoto; photo.PhotoObject = pht; this.panelPhotos.Controls.Add(photo); nextPhotoLocation += widthPhotoObject + leftMargin; } } }
public void LoadPhotos(Album album) { //remove all PhotoIcon objects foreach (Control ctrl in this.panelPhotos.Controls) { if (ctrl is PhotoIcon) { this.panelPhotos.Controls.Remove(ctrl); } } this.MainPicture.Image = null; this.txtAuthor.Text = string.Empty; this.txtTitle.Text = string.Empty; this.txtDate.Text = string.Empty; if (album != null) { List<Photo> photosToLoad = album.vphotos; this.panelPhotos.AutoScrollPosition = new Point(0, 0); int nextPhotoLocation = leftMargin; //create new PhotoIcon objects with photos from selected Album foreach (Photo pht in photosToLoad) { PhotoIcon photo = new PhotoIcon(); photo.Size = new Size(widthPhotoObject, heightPhotoObject); photo.Location = new Point(nextPhotoLocation, topMargin); photo.PhotoClick += new PhotoIcon.PhotoIconClick(photo_Click); photo.ContextMenuStrip = this.cmPhoto; photo.PhotoObject = pht; this.panelPhotos.Controls.Add(photo); nextPhotoLocation += widthPhotoObject + leftMargin; } } }
private void LoadPhotos(Album album) { List<Photo> photosToLoad = album.Photos; //remove all PhotoIcon objects foreach (Control ctrl in this.panelPhotos.Controls) { if (ctrl is PhotoIcon) { this.panelPhotos.Controls.Remove(ctrl); } } int nextPhotoLocation = leftMargin; //create new PhotoIcon objects with photos from selected Album foreach (Photo pht in photosToLoad) { PhotoIcon photo= new PhotoIcon(); photo.Size = new Size(widthPhotoObject, heightPhotoObject); photo.Location = new Point(nextPhotoLocation, topMargin); photo.Visible = true; photo.PhotoObject = pht; photo.PhotoClick += new PhotoIcon.PhotoIconClick(photo_Click); this.panelPhotos.Controls.Add(photo); nextPhotoLocation += widthPhotoObject + leftMargin; } }