ads
Wednesday, April 30, 2008
Picture / Image Loader sample in C#
[Controls to use]
PictureBox
Command Button
Dialog Box
Textbox
------------------------------------
[Source Code]
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)
{
DialogResult dRslt;
FileDLG.Filter = "JPEG Picture File(*.JpEg)|*.jpg|Windows Bitmap File(*.BMP)|*.bmp";
dRslt = FileDLG.ShowDialog();
textBox1.Text = FileDLG.FileName.ToString ();
}
private void FileDLG_FileOk(object sender, CancelEventArgs e)
{
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox1.Load(FileDLG.FileName.ToString());
}
}
}
Subscribe to:
Post Comments (Atom)
1 comment:
Your blog keeps getting better and better! Your older articles are not as good as newer ones you have a lot more creativity and originality now keep it up!
Post a Comment