این سورس کد عکس کپی شده در کلیپ برد را نمایش می دهد.
این کد من نیست و آقا احسان برام فرستادن ، آقا احسان دستت درد نکنه خیلی قشنگه .
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//source from http://www.nofa.ir/ShowArticle-id8.aspx
//اردوان دژپناه
if (Clipboard.GetDataObject() != null)
{
IDataObject data = Clipboard.GetDataObject();
if (data.GetDataPresent(DataFormats.Bitmap))
{
Image image = (Image)data.GetData(DataFormats.Bitmap, true);
image.Save("image.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
image.Save("image.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
image.Save("image.gif", System.Drawing.Imaging.ImageFormat.Gif);
PictureBox1 = new PictureBox();
// Set the location and size of the PictureBox control.
this.PictureBox1.Location = new System.Drawing.Point(70, 120);
this.PictureBox1.Size = new System.Drawing.Size(540, 540);
this.PictureBox1.TabStop = false;
// Set the SizeMode property to the StretchImage value. This
// will shrink or enlarge the image as needed to fit into
// the PictureBox.
this.PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
// Set the border style to a three-dimensional border.
this.PictureBox1.BorderStyle = BorderStyle.Fixed3D;
// Add the PictureBox to the form.
this.Controls.Add(this.PictureBox1);
PictureBox1.Image = image;
}
else
{
MessageBox.Show("The Data In Clipboard is not as image format");
}
}
else
{
MessageBox.Show("The Clipboard was empty");
}
}
public PictureBox PictureBox1 { get; set; }
}
}