Exemplo n.º 1
0
		/// <summary>
		/// Tells collection form that project open here has been edited in OneImageForm.
		/// Update the thumbnail.
		/// </summary>
		public void UpdateProject(PPProject project)
		{
			int index = Array.IndexOf(collection.Projects, project);
			if(index == -1)
				return;
			int i = 0;
			foreach(Control control in flowPanel.Controls)
			{
				if(!(control is PictureBox))
					continue;
				if(i == index)
				{
					PictureBox pictureBox = (control as PictureBox);
					pictureBox.Image = project.GetThumbnail(THUMBNAIL_SIZE, THUMBNAIL_SIZE);
					return;
				}
				i++;
			}
		}
Exemplo n.º 2
0
		private void DisplayProject(PPProject project)
		{
			int padding = 4;

			Panel panel = new Panel();
			panel.Cursor = Cursors.Hand;
			panel.ContextMenu = projectContextMenu;

			PictureBox pictureBox = new PictureBox();
			pictureBox.Width = THUMBNAIL_SIZE + padding + padding;
			pictureBox.Height = THUMBNAIL_SIZE + padding + padding;
			pictureBox.Left = 0;
			pictureBox.Top = 0;
			pictureBox.Image = project.GetThumbnail(THUMBNAIL_SIZE, THUMBNAIL_SIZE);
			pictureBox.SizeMode = PictureBoxSizeMode.CenterImage;
			pictureBox.MouseEnter += new EventHandler(Project_OnMouseEnter);
			pictureBox.MouseLeave += new EventHandler(Project_OnMouseLeave);
			pictureBox.Click += new EventHandler(Project_OnClick);

			panel.Controls.Add(pictureBox);

			Label label = new Label();
			if(!String.IsNullOrEmpty(project.SaveToFileName))
			{
				label.Text = Path.GetFileNameWithoutExtension(project.SaveToFileName);
			}
			label.Width = THUMBNAIL_SIZE;
			label.Height = 20;
			label.Left = padding;
			label.Top = pictureBox.Bottom;
			panel.Controls.Add(label);

			panel.Width = pictureBox.Width;
			panel.Height = label.Bottom;
			flowPanel.Controls.Add(panel);
		}