ICO 0201 ESPONJA07 BUSCADOR MIXTO DE IMAGENES, MÚSICA

DISEÑO

C O D I G O :


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 Esponja07
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Llenado()
{
Resultado.Items.Clear();
string Ext = ".jpg";
this.Text = "Esponja 07 " + DateTime.Now.ToShortDateString();
if (Imagen.Checked==true)
{
label1.Text = "Buscar Imagen";
button1.Text = "Imagenes";
}
else if (Cancion.Checked == true)
{
label1.Text = "Buscar Música";
button1.Text = "Canciones";
Ext = ".mp3";

}
DirectoryInfo dir = new DirectoryInfo(@"C:\xampp\htdocs\Galeria\ANIME\");
foreach (FileInfo file in dir.GetFiles())
{
string fExtension = file.Extension.ToLower();
if (fExtension == Ext)
{
Resultado.Items.Add(file.Name.Substring(0, file.Name.Length - 4));
}
}

}
private void Form1_Load(object sender, EventArgs e)
{
Llenado();
}

private void Resultado_SelectedIndexChanged(object sender, EventArgs e)
{
}

private void Resultado_SelectedIndexChanged_1(object sender, EventArgs e)
{
try
{
if (Resultado.SelectedItem != null)
{
Bitmap B2 = new Bitmap(@"C:\xampp\htdocs\Galeria\ANIME\" +
Resultado.SelectedItem.ToString() + ".jpg");
int Xt = B2.Width;
int X = Convert.ToInt32((B2.Width * Preview.Width) / Xt);
int Y = Convert.ToInt32((B2.Height * Preview.Width) / Xt);
Preview.Image = new Bitmap(B2, X, Y);
}
}
catch
{; }
}

private void Imagen_CheckedChanged(object sender, EventArgs e)
{
label1.Text = "Buscar Imagen";
button1.Text = "Imagenes";
}

private void Cancion_CheckedChanged(object sender, EventArgs e)
{
label1.Text = "Buscar Música";
button1.Text = "Canciones";

}
}
}

No hay comentarios.:

Publicar un comentario