Solved

Copy thumbnailed images from one location to another

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

15 Experts available now in Live!

Get 1:1 Help Now