Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.IO;
- namespace WindowsFormsApp12
- {
- public partial class Form1 : Form
- {
- OpenFileDialog fisier = new OpenFileDialog( );
- string line = "";
- OpenFileDialog imagine = new OpenFileDialog( );
- public Form1( )
- {
- InitializeComponent( );
- }
- private void button1_Click( object sender, EventArgs e )
- {
- if (fisier.ShowDialog( ) == DialogResult.OK)
- {
- StreamReader s1 = new StreamReader( fisier.FileName );
- while (line != null)
- {
- line = s1.ReadLine( );
- if (line != null)
- {
- listBox1.Items.Add( line );
- }
- }
- s1.Close( );
- }
- }
- private void button2_Click( object sender, EventArgs e )
- {
- if (imagine.ShowDialog( ) == DialogResult.OK)
- {
- Image img = Image.FromFile( imagine.FileName );
- Bitmap btmap = new Bitmap( img, new Size(400, 250 ) );
- pictureBox1.Image = btmap;
- }
- }
- private void Form1_Load( object sender, EventArgs e )
- {
- fisier.Filter = "Text Files (.txt) | *.txt";
- imagine.Filter = "Imagine | *.jpg; *.png; *.gif";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement