1.循环写出座位
Seat seat;
for (int i = 0; i < seatRow; i++)
{
for (int j = 0; j < seatLine; j++)
{
label = new Label();
//设置背景颜色
label.BackColor = Color.Yellow;
//设置字体
label.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
//设置尺寸
label.AutoSize = false;
label.Size = new System.Drawing.Size(50, 25);
//设置座位号
label.Text = (j + 1).ToString() + "-" + (i + 1).ToString();
label.TextAlign = ContentAlignment.MiddleCenter;
//设置位置
label.Location = new Point(60 + (i * 90), 60 + (j * 60));
//所有的标签都绑定到同一事件
tpCinema.Controls.Add(label);
lbs.Add(label.Text, label);
//实例化一个座位
seat = new Seat((j + 1).ToString() + "-" + (i + 1).ToString(), Color.Yellow);
//保存的座位集合
//cinema.Seats.Add(seat.SeatNum, seat);
}
2.播放节点写入
TreeNode tnd = null; foreach (KeyValuePair<string ,ScheduleItem> item in sched.Items) { if (Movenames != item.Value.Movies.MovieName) { tnd = new TreeNode(item.Value.Movies.MovieName); tnd.Tag = item.Value.Movies; this.tvMovies.Nodes.Add(tnd); } TreeNode nod = new TreeNode(item.Value.Time); tnd.Nodes.Add(nod); Movenames = item.Value.Movies.MovieName; } this.tvMovies.ExpandAll();
3.播放详情界面
if(selectedNode==null) { return; } if(selectedNode.Level==0) { return; } lblMovieName.Text = sched.Items[selectedNode.Text].Movies.MovieName; lblType.Text = sched.Items[selectedNode.Text].Movies.movietyp.ToString(); picMovie.Image = Image.FromFile(sched.Items[selectedNode.Text].Movies.Poster); lblPrice.Text = sched.Items[selectedNode.Text].Movies.Price.ToString(); lblActor.Text = sched.Items[selectedNode.Text].Movies.Actor.ToString(); lblTime.Text = sched.Items[selectedNode.Text].Time; lblDirector.Text = sched.Items[selectedNode.Text].Movies.Director;