ویژوال 30 شارپ

سورس کدهای جالب سی شارپ فقط با یک نگاه

ویژوال 30 شارپ

سورس کدهای جالب سی شارپ فقط با یک نگاه

گرفتن عکس از کلیپ بورد

این سورس کد عکس کپی شده در کلیپ برد را نمایش می دهد. 

این کد من نیست و آقا احسان برام فرستادن ، آقا احسان دستت درد نکنه خیلی قشنگه

 

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; }
    }
}

کتابخانه کد

امروز اون قولی که داده بودم رو می خوام ادا کنم. 

این هم کتابخونه ای که خودم نوشتمش خیلی آسونه ، 70 کد داره البته حذف و اضافه هم می تونید بکنید. 

اقا سینا یه لطفی بکن RezaMansori2010@yahoo.com تو لیست دوستان یاهو مسنجر اضافه کن تا یه چتی با هم داشته باشیم. حتما ها.

 

لینک کتابخونه : 

http://s1.picofile.com/v30sharp/CodeLibrary.mp3.html

سورس دیکشنری

این هم سورس دیکشنری البته کار من نیست اما واقعا قشنگه حتما دانلود کنید. 

 

http://dl.4downloads.ir/majalleh/2/DictionaryFrom%20C%20sharp_%28www.4DOWNLOADS.ir%29.zip

Startup Dir

MessageBox.Show(AppDomain.CurrentDomain.BaseDirectory);


MessageBox.Show(System.IO.Directory.GetCurrentDirectory());

MessageBox.Show(Application.StartupPath);

MessageBox.Show(System.IO.Path.GetDirectoryName(Application.ExecutablePath));

Program In Startup

private void AddStartUpKey(string _name, string  _path)
{
    RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
    key.SetValue(_name, _path);
}

private void RemoveStartUpKey(string _name)
{
    RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
    key.DeleteValue(_name, false);
}