AzRaEL
Colaborador
   
Desconectado
Mensajes: 127

CrackenFind © 2006 - Consultorio Networks
|
 |
« Respuesta #1 : 17 de Noviembre de 2005, 11:44:27 » |
|
mira te dejo este sencillisimo reproductor de mp3 espero que al menos lo leas para saber como se hace uno ok?
[code form1.cs]
using System; using System.Drawing; using System.Collect ions; using System.Compone ntModel; using System.Windows .Forms; using System.Data; using System.IO; namespace ReproductorMp3 { /// <summary> /// Descripción breve de Form1. /// </summary> public class Form1 : System.Windows .Forms.Form { private System.Windows .Forms.Button button1; private System.Windows .Forms.Button button2; private System.Windows .Forms.Button button3; private System.Windows .Forms.Button button4; private System.Windows .Forms.LinkLab el linkLabel1; private System.Windows .Forms.ListBox listBox1; private System.Windows .Forms.LinkLab el linkLabel2; private System.Compone ntModel.IConta iner components; private System.Windows .Forms.StatusB arPanel statusBarPanel 1; private System.Windows .Forms.StatusB arPanel statusBarPanel 2; private System.Windows .Forms.StatusB arPanel statusBarPanel 3; private System.Windows .Forms.OpenFil eDialog Of; private System.Windows .Forms.Timer timer1; private System.Windows .Forms.StatusB ar stMensajes; private System.Windows .Forms.StatusB ar stTiempos;
private System.Windows .Forms.TrackBa r trackBar1; private System.Windows .Forms.Label label1; private System.Windows .Forms.CheckBo x checkBox1; private System.Windows .Forms.LinkLab el linkLabel3;
// Creamos el objeto dela clase reproductor. private Reproductor Sonido = new Reproductor(); // Una colección para agrupar los elementos listados. private Hashtable hashMusica = new Hashtable(); // Bandera para informar sobre el arrastre del indicador de progreso. private bool trackBarClick = false;
public Form1() { // // Necesario para admitir el Diseñador de Windows Forms // InitializeComponent();
// // TODO: Agregar código de constructor despuà ©s de llamar a InitializeComp onent // }
/// <summary> /// Limpiar los recursos que se està ©n utilizando. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); }
#region Windows Form Designer generated code /// <summary> /// Mà ©todo necesario para admitir el Diseñador, no se puede modificar /// el contenido del mà ©todo con el editor de código. /// </summary> private void InitializeComp onent() { this.components = new System.Compone ntModel.Contai ner(); System.Resources.ResourceManager resources = new System.Resourc es.ResourceMan ager(typeof(Form1)); this.button1 = new System.Windows .Forms.Button(); this.button2 = new System.Windows .Forms.Button(); this.button3 = new System.Windows .Forms.Button(); this.button4 = new System.Windows .Forms.Button(); this.linkLabel1 = new System.Windows .Forms.LinkLab el(); this.stMensajes = new System.Windows .Forms.StatusB ar(); this.statusBarPanel1 = new System.Windows .Forms.StatusB arPanel(); this.listBox1 = new System.Windows .Forms.ListBox (); this.linkLabel2 = new System.Windows .Forms.LinkLab el(); this.stTiempos = new System.Windows .Forms.StatusB ar(); this.statusBarPanel2 = new System.Windows .Forms.StatusB arPanel(); this.statusBarPanel3 = new System.Windows .Forms.StatusB arPanel(); this.Of = new System.Windows .Forms.OpenFil eDialog(); this.timer1 = new System.Windows .Forms.Timer(this.component s); this.trackBar1 = new System.Windows .Forms.TrackBa r(); this.label1 = new System.Windows .Forms.Label(); this.checkBox1 = new System.Windows .Forms.CheckBo x(); this.linkLabel3 = new System.Windows .Forms.LinkLab el(); ((System.Compone ntModel.ISuppo rtInitialize)(this.statusBar Panel1)).BeginInit(); ((System.Compone ntModel.ISuppo rtInitialize)(this.statusBar Panel2)).BeginInit(); ((System.Compone ntModel.ISuppo rtInitialize)(this.statusBar Panel3)).BeginInit(); ((System.Compone ntModel.ISuppo rtInitialize)(this.trackBar1)).BeginInit(); this.SuspendLayout(); // // button1 // this.button1.FlatStyle = System.Windows .Forms.FlatSty le.System; this.button1.Location = new System.Drawing .Point(280, 56); this.button1.Name = "button1"; this.button1.Size = new System.Drawing .Size(88, 24); this.button1.TabIndex = 1; this.button1.Text = "&Reproducir"; this.button1.Click += new System.EventHa ndler(this.button1_C lick); // // button2 // this.button2.FlatStyle = System.Windows .Forms.FlatSty le.System; this.button2.Location = new System.Drawing .Point(280, 92); this.button2.Name = "button2"; this.button2.Size = new System.Drawing .Size(88, 24); this.button2.TabIndex = 2; this.button2.Text = "&Pausar"; this.button2.Click += new System.EventHa ndler(this.button2_C lick); // // button3 // this.button3.FlatStyle = System.Windows .Forms.FlatSty le.System; this.button3.Location = new System.Drawing .Point(280, 128); this.button3.Name = "button3"; this.button3.Size = new System.Drawing .Size(88, 24); this.button3.TabIndex = 3; this.button3.Text = "&Detener"; this.button3.Click += new System.EventHa ndler(this.button3_C lick); // // button4 // this.button4.FlatStyle = System.Windows .Forms.FlatSty le.System; this.button4.Location = new System.Drawing .Point(280, 168); this.button4.Name = "button4"; this.button4.Size = new System.Drawing .Size(88, 24); this.button4.TabIndex = 4; this.button4.Text = "&Salir"; this.button4.Click += new System.EventHa ndler(this.button4_C lick); // // linkLabel1 // this.linkLabel1.Cursor = System.Windows .Forms.Cursors .Hand; this.linkLabel1.Location = new System.Drawing .Point(8, 196); this.linkLabel1.Name = "linkLabel1"; this.linkLabel1.Size = new System.Drawing .Size(56, 16); this.linkLabel1.TabIndex = 5; this.linkLabel1.TabStop = true; this.linkLabel1.Text = "Examinar"; this.linkLabel1.LinkClicked += new System.Windows .Forms.LinkLab elLinkClickedE ventHandler(this.linkLabel 1_LinkClicked); // // stMensajes // this.stMensajes.Location = new System.Drawing .Point(0, 264); this.stMensajes.Name = "stMensajes"; this.stMensajes.Panels.AddRange(new System.Windows .Forms.StatusB arPanel[] { this.statusBar Panel1}); this.stMensajes.ShowPanels = true; this.stMensajes.Size = new System.Drawing .Size(380, 20); this.stMensajes.TabIndex = 6; this.stMensajes.Text = "statusBar1"; // // statusBarPanel 1 // this.statusBarPanel1.BorderStyle = System.Windows .Forms.StatusB arPanelBorderS tyle.None; this.statusBarPanel1.Width = 200; // // listBox1 // this.listBox1.HorizontalScrollbar = true; this.listBox1.Location = new System.Drawing .Point(8, 56); this.listBox1.Name = "listBox1"; this.listBox1.Size = new System.Drawing .Size(260, 134); this.listBox1.TabIndex = 7; this.listBox1.DoubleClick += new System.EventHa ndler(this.listBox1_ DoubleClick); // // linkLabel2 // this.linkLabel2.Location = new System.Drawing .Point(68, 196); this.linkLabel2.Name = "linkLabel2"; this.linkLabel2.Size = new System.Drawing .Size(92, 16); this.linkLabel2.TabIndex = 8; this.linkLabel2.TabStop = true; this.linkLabel2.Text = "Quitar Elementos"; this.linkLabel2.LinkClicked += new System.Windows .Forms.LinkLab elLinkClickedE ventHandler(this.linkLabel 2_LinkClicked); // // stTiempos // this.stTiempos.Dock = System.Windows .Forms.DockSty le.Top; this.stTiempos.Name = "stTiempos"; this.stTiempos.Panels.AddRange(new System.Windows .Forms.StatusB arPanel[] { this.statusBar Panel2, this.statusBar Panel3}); this.stTiempos.ShowPanels = true; this.stTiempos.Size = new System.Drawing .Size(380, 20); this.stTiempos.TabIndex = 9; this.stTiempos.Text = "statusBar2"; // // statusBarPanel 2 // this.statusBarPanel2.BorderStyle = System.Windows .Forms.StatusB arPanelBorderS tyle.None; this.statusBarPanel2.Text = "Tiempo Total:"; this.statusBarPanel2.Width = 180; // // statusBarPanel 3 // this.statusBarPanel3.BorderStyle = System.Windows .Forms.StatusB arPanelBorderS tyle.None; this.statusBarPanel3.Text = "Tiempo Transcurrido"; this.statusBarPanel3.Width = 180; // // timer1 // this.timer1.Tick += new System.EventHa ndler(this.timer1_Ti ck); // // trackBar1 // this.trackBar1.AutoSize = false; this.trackBar1.Location = new System.Drawing .Point(4, 224); this.trackBar1.Name = "trackBar1"; this.trackBar1.Size = new System.Drawing .Size(368, 45); this.trackBar1.TabIndex = 10; this.trackBar1.TickStyle = System.Windows .Forms.TickSty le.None; this.trackBar1.MouseUp += new System.Windows .Forms.MouseEv entHandler(this.trackBar1 _MouseUp); this.trackBar1.MouseDown += new System.Windows .Forms.MouseEv entHandler(this.trackBar1 _MouseDown); // // label1 // this.label1.Location = new System.Drawing .Point(8, 32); this.label1.Name = "label1"; this.label1.Size = new System.Drawing .Size(120, 16); this.label1.TabIndex = 11; this.label1.Text = "Lista de Reproducción"; // // checkBox1 // this.checkBox1.Location = new System.Drawing .Point(164, 32); this.checkBox1.Name = "checkBox1"; this.checkBox1.Size = new System.Drawing .Size(108, 16); this.checkBox1.TabIndex = 12; this.checkBox1.Text = "Recorrer la lista"; // // linkLabel3 // this.linkLabel3.Location = new System.Drawing .Point(164, 196); this.linkLabel3.Name = "linkLabel3"; this.linkLabel3.Size = new System.Drawing .Size(108, 16); this.linkLabel3.TabIndex = 13; this.linkLabel3.TabStop = true; this.linkLabel3.Text = "Quitar Seleccionado"; this.linkLabel3.LinkClicked += new System.Windows .Forms.LinkLab elLinkClickedE ventHandler(this.linkLabel 3_LinkClicked); // // Form1 // this.AllowDrop = true; this.AutoScaleBaseSize = new System.Drawing .Size(5, 13); this.ClientSize = new System.Drawing .Size(380, 284); this.Controls.AddRange(new System.Windows .Forms.Control [] { this.linkLabel 3, this.checkBox1, this.label1, this.stTiempos, this.linkLabel 2, this.listBox1, this.stMensaje s, this.linkLabel 1, this.button4, this.button3, this.button2, this.button1, this.trackBar1}); this.FormBorderStyle = System.Windows .Forms.FormBor derStyle.Fixed Single; this.Icon = ((System.Drawing .Icon)(resources.GetO bject("$this.Icon"))); this.MaximizeBox = false; this.Name = "Form1"; this.StartPosition = System.Windows .Forms.FormSta rtPosition.Cen terScreen; this.Text = "Reproductor de mp3"; this.Closing += new System.Compone ntModel.Cancel EventHandler(this.Form1_Clo sing); this.Load += new System.EventHa ndler(this.Form1_Loa d); this.DragOver += new System.Windows .Forms.DragEve ntHandler(this.Form1_Dra gOver); this.DragDrop += new System.Windows .Forms.DragEve ntHandler(this.Form1_Dra gDrop); ((System.Compone ntModel.ISuppo rtInitialize)(this.statusBar Panel1)).EndInit(); ((System.Compone ntModel.ISuppo rtInitialize)(this.statusBar Panel2)).EndInit(); ((System.Compone ntModel.ISuppo rtInitialize)(this.statusBar Panel3)).EndInit(); ((System.Compone ntModel.ISuppo rtInitialize)(this.trackBar1)).EndInit(); this.ResumeLayout(false);
} #endregion
/// <summary> /// Punto de entrada principal de la aplicación. /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); }
private void Form1_Load(object sender, System.EventAr gs e) { // Inicializamos el panel de mensajes. stMensajes.Panels[0].Text = "Listo"; // Asiganamos un manejador para el evento Mensajes del Reproductor. Sonido.ReproductorEstado += new Reproductor.Re productorMessa ge(this.MensajesD elReproductor); // Establecemos la propiedad que permite seleccionar varios elementos // en el cuadro de dialogo abrir. Of.Multiselect = true;
//Verificamos el n
|