Solved

Copy thumbnailed images from one location to another

Posted on 2007-03-28
3
182 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

932 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now