Solved

Copy thumbnailed images from one location to another

Posted on 2007-03-28
3
190 Views
Last Modified: 2013-12-17
Hi all, I need to understand how to display thumbnails in a windows forms panel (c# dot.net), copy them to another panel and then upon pressing the apply button, copy the selection to a specified location (ie.  My pictures)

I have provided an image for what I am trying to acheve.  Shouldn't be too difficult i hope but all help would be greatly appreciated.

http://www.cdnpharmaceuticals.com.au/experts/Image.JPG
0
Comment
Question by:cdempster
3 Comments
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 500 total points
ID: 18822931
is this
what u wnat u can drag image from one panel to another then saving would be relatively easy

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace WINAPP
{
      /// <summary>
      /// Summary description for Form5.
      /// </summary>
      public class Form5 : System.Windows.Forms.Form
      {
            private System.Windows.Forms.Panel panel1;
            private System.Windows.Forms.Panel panel2;
            /// <summary>
            /// Required designer variable.
            /// </summary>
            private System.ComponentModel.Container components = null;

            public Form5()
            {
                  //
                  // Required for Windows Form Designer support
                  //
                  InitializeComponent();

                  PictureBox FBox1 = new PictureBox
                        ();
                  FBox1.Image = new Bitmap(@"D:\DOC\2.jpg");
                  FBox1.SizeMode = PictureBoxSizeMode.StretchImage;
                  FBox1.Dock = DockStyle.Top;
                  panel1.Controls.Add(FBox1);
                  panel2.AllowDrop = true;
                  this.AllowDrop = true;
                  FBox1.MouseDown += new MouseEventHandler(FBox1_MouseDown);
                  FBox1 = new PictureBox
                        ();
                  FBox1.SizeMode = PictureBoxSizeMode.StretchImage;
                  FBox1.Image = new Bitmap(@"D:\DOC\3.jpg");
                  FBox1.Dock = DockStyle.Top;
                  panel2.DragDrop += new DragEventHandler(groupBox2_DragDrop);
                  panel2.DragEnter += new DragEventHandler(groupBox2_DragEnter);
                  this.DragEnter += new DragEventHandler(groupBox2_DragEnter);
                  FBox1.MouseDown += new MouseEventHandler(FBox1_MouseDown);
                  panel1.Controls.Add(FBox1);
            }

            void FBox1_MouseDown(object sender, MouseEventArgs e)
            {
                  DoDragDrop(((PictureBox)sender).Image, DragDropEffects.Copy);
            }

            void groupBox2_DragEnter(object sender, DragEventArgs e)
            {
                  e.Effect = DragDropEffects.Copy;
            }

            void groupBox2_DragDrop(object sender, DragEventArgs e)
            {
                  if (e.Data.GetData(typeof(Bitmap)) != null)
                  {
                        Bitmap FMap =
                              (Bitmap)e.Data.GetData(typeof(Bitmap));
                        PictureBox FBox1 = new PictureBox
                              ();
                        FBox1.Image = FMap;
                        FBox1.SizeMode = PictureBoxSizeMode.StretchImage;
                        FBox1.Dock = DockStyle.Top;
                        panel2.Controls.Add(FBox1);  
                  }
            }

            /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            protected override void Dispose( bool disposing )
            {
                  if( disposing )
                  {
                        if(components != null)
                        {
                              components.Dispose();
                        }
                  }
                  base.Dispose( disposing );
            }

            #region Windows Form Designer generated code
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {
                  this.panel1 = new System.Windows.Forms.Panel();
                  this.panel2 = new System.Windows.Forms.Panel();
                  this.SuspendLayout();
                  //
                  // panel1
                  //
                  this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
                  this.panel1.Location = new System.Drawing.Point(8, 8);
                  this.panel1.Name = "panel1";
                  this.panel1.Size = new System.Drawing.Size(288, 264);
                  this.panel1.TabIndex = 2;
                  //
                  // panel2
                  //
                  this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
                  this.panel2.Location = new System.Drawing.Point(320, 8);
                  this.panel2.Name = "panel2";
                  this.panel2.Size = new System.Drawing.Size(336, 256);
                  this.panel2.TabIndex = 3;
                  //
                  // Form5
                  //
                  this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
                  this.ClientSize = new System.Drawing.Size(672, 273);
                  this.Controls.Add(this.panel2);
                  this.Controls.Add(this.panel1);
                  this.Name = "Form5";
                  this.Text = "Form5";
                  this.ResumeLayout(false);

            }
            #endregion
      }
}

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question