I'm not really sure how to create an iTunes-like playlist using C#. Do help me out please. By giving links to any help or etc.
[color=#FF0000]using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace DSAGAssignment
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class frmLinkedList : System.Windows.Forms.Form
{
private System.Windows.Forms.TreeView tvLinkedList;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
private Label lblLinkedListSize;
private Label lblLinkedListSizeValue;
private Button btnAddRear;
private Button btnAddFront;
private Button btnDeleteFront;
private Button btnDeleteRear;
private LinkedList list;
public frmLinkedList()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.tvLinkedList = new System.Windows.Forms.TreeView();
this.lblLinkedListSize = new System.Windows.Forms.Label();
this.lblLinkedListSizeValue = new System.Windows.Forms.Label();
this.btnAddRear = new System.Windows.Forms.Button();
this.btnAddFront = new System.Windows.Forms.Button();
this.btnDeleteFront = new System.Windows.Forms.Button();
this.btnDeleteRear = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// tvLinkedList
//
this.tvLinkedList.Location = new System.Drawing.Point(12, 8);
this.tvLinkedList.Name = "tvLinkedList";
this.tvLinkedList.Size = new System.Drawing.Size(535, 255);
this.tvLinkedList.TabIndex = 0;
//
// lblLinkedListSize
//
this.lblLinkedListSize.AutoSize = true;
this.lblLinkedListSize.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblLinkedListSize.Location = new System.Drawing.Point(405, 266);
this.lblLinkedListSize.Name = "lblLinkedListSize";
this.lblLinkedListSize.Size = new System.Drawing.Size(127, 16);
this.lblLinkedListSize.TabIndex = 4;
this.lblLinkedListSize.Text = "Size of Linked List : ";
this.lblLinkedListSize.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// lblLinkedListSizeValue
//
this.lblLinkedListSizeValue.AutoSize = true;
this.lblLinkedListSizeValue.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblLinkedListSizeValue.Location = new System.Drawing.Point(535, 275);
this.lblLinkedListSizeValue.Name = "lblLinkedListSizeValue";
this.lblLinkedListSizeValue.Size = new System.Drawing.Size(12, 16);
this.lblLinkedListSizeValue.TabIndex = 5;
this.lblLinkedListSizeValue.Text = " ";
//
// btnAddRear
//
this.btnAddRear.Location = new System.Drawing.Point(118, 358);
this.btnAddRear.Name = "btnAddRear";
this.btnAddRear.Size = new System.Drawing.Size(100, 25);
this.btnAddRear.TabIndex = 13;
this.btnAddRear.Text = "Add (rear)";
this.btnAddRear.UseVisualStyleBackColor = true;
//
// btnAddFront
//
this.btnAddFront.Location = new System.Drawing.Point(12, 358);
this.btnAddFront.Name = "btnAddFront";
this.btnAddFront.Size = new System.Drawing.Size(100, 25);
this.btnAddFront.TabIndex = 12;
this.btnAddFront.Text = "Add (front)";
this.btnAddFront.UseVisualStyleBackColor = true;
//
// btnDeleteFront
//
this.btnDeleteFront.Location = new System.Drawing.Point(12, 398);
this.btnDeleteFront.Name = "btnDeleteFront";
this.btnDeleteFront.Size = new System.Drawing.Size(100, 25);
this.btnDeleteFront.TabIndex = 21;
this.btnDeleteFront.Text = "Delete (front)";
this.btnDeleteFront.UseVisualStyleBackColor = true;
//
// btnDeleteRear
//
this.btnDeleteRear.Location = new System.Drawing.Point(118, 398);
this.btnDeleteRear.Name = "btnDeleteRear";
this.btnDeleteRear.Size = new System.Drawing.Size(100, 25);
this.btnDeleteRear.TabIndex = 22;
this.btnDeleteRear.Text = "Delete (rear)";
this.btnDeleteRear.UseVisualStyleBackColor = true;
//
// frmLinkedList
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
this.ClientSize = new System.Drawing.Size(562, 509);
this.Controls.Add(this.btnDeleteRear);
this.Controls.Add(this.btnDeleteFront);
this.Controls.Add(this.btnAddRear);
this.Controls.Add(this.btnAddFront);
this.Controls.Add(this.lblLinkedListSizeValue);
this.Controls.Add(this.lblLinkedListSize);
this.Controls.Add(this.tvLinkedList);
this.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Name = "frmLinkedList";
this.Text = "a";
this.Load += new System.EventHandler(this.frmLinkedList_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new frmLinkedList());
}
// ################################################################################
// NOTE: DO NOT CHANGE THIS CODE
private void Visualize(Node h)
{
this.tvLinkedList.Nodes.Clear();
if (h == null) return;
Node n = h;
TreeNode firstNode = null, tn = null;
while (n != null)
{
if (firstNode == null)
{
tn = new TreeNode(n.Data.ToString());
firstNode = tn;
}
else
{
tn.Nodes.Add(new TreeNode(n.Data.ToString()));
tn = tn.Nodes[0];
}
n = n.Link;
}
firstNode.ExpandAll();
this.tvLinkedList.Nodes.Add(firstNode);
}
// ################################################################################
private void frmLinkedList_Load(object sender, EventArgs e)
{
list = new LinkedList();
//lblLinkedListSizeValue.Text = list.Count.ToString();
}
}
}[/color]
Thanks.
Smaini

New Topic/Question
Reply




MultiQuote




|