最后是将座位信息以label标签的形式动态绘制到窗体里,这里也是最难的地方,参考了一下书
- private void InitialSeat() {
- int seatRow = 7; int seatLine = 5;
- for (int i = 0; i < seatRow; i++)//列 {
- for (int j = 0; j < seatLine; j++)//行 {
- label = new Label(); //设置背景颜色
- label.BackColor = Color.Yellow; //设置字体 字体,大小,指定应用到文本的字形信息为普通文本,指定给定数据的度量单位,新字体的GDI字符集
- label.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); //取消自动尺寸方便我们设置尺寸
- label.AutoSize = false; //指定label的宽和高
- label.Size = new System.Drawing.Size(50, 25); //设置座位号
- label.Text = (j + 1).ToString() + "-" + (i + 1).ToString(); label.TextAlign = ContentAlignment.MiddleCenter;










