public BlockGroup() { BlockConfig config = new BlockConfig();; config.LoadFromXmlFile(); info = new InfoArr(); info = config.BlockInfo; disapperColor = config.BlockColor; rectPix = config.BlockCol; }
private void Config_Load(object sender, EventArgs e) { mc.LineNum_X = 4; //横线数量 mc.Width = lbMode.Width; //宽度 mc.LineNum_Y = 4; //竖线数量 mc.Height = lbMode.Height; //高度 mc.States = new bool[(mc.LineNum_X + 1), (mc.LineNum_Y + 1)]; //每个砖块状态 mc.BlockColor = Color.Gray; config.LoadFromXmlFile(); //读取 InfoArr info = config.BlockInfo; ListViewItem myItem = new ListViewItem(); for (int i = 0; i < info.Length; i++) { myItem = lsvBlockSet.Items.Add(info[i].GetIdStr()); myItem.SubItems.Add(info[i].GetColorStr()); } tbToUp.Text = ((Keys)config.UpKey).ToString(); tbToUp.Tag = config.UpKey; tbToDown.Text = ((Keys)config.DownKey).ToString(); tbToDown.Tag = config.DownKey; tbToleft.Text = ((Keys)config.LeftKey).ToString(); tbToleft.Tag = config.LeftKey; tbToRight.Text = ((Keys)config.RightKey).ToString(); tbToRight.Tag = config.RightKey; tbDeasil.Text = ((Keys)config.DeasilKey).ToString(); tbDeasil.Tag = config.DeasilKey; tbContra.Text = ((Keys)config.ContraKey).ToString(); tbContra.Tag = config.ContraKey; tbBlockNumX.Text = config.BlockNumX.ToString(); tbBlockNumY.Text = config.BlockNumY.ToString(); tbBlockColNum.Text = config.BlockCol.ToString(); lbBlockBlackColor.BackColor = config.BlockColor; }
private void btnSave_Click(object sender, EventArgs e) { InfoArr info = new InfoArr(); foreach (ListViewItem item in lsvBlockSet.Items) { info.Add(item.SubItems[0].Text, item.SubItems[1].Text); } config.BlockInfo = info; config.UpKey = (Keys)tbToUp.Tag; config.DownKey = (Keys)tbToDown.Tag; config.LeftKey = (Keys)tbToleft.Tag; config.RightKey = (Keys)tbToRight.Tag; config.DeasilKey = (Keys)tbDeasil.Tag; config.ContraKey = (Keys)tbContra.Tag; config.BlockNumX = int.Parse(tbBlockNumX.Text); config.BlockNumY = int.Parse(tbBlockNumY.Text); config.BlockCol = int.Parse(tbBlockColNum.Text); config.BlockColor = lbBlockBlackColor.BackColor; config.SaveToXmlFile(); }