private void mainWin_Load(object sender, EventArgs e) { //创建minePanel对象 this.mPanel = new minePanel(clientAreaWidth, clientAreaHeight); // //mPanel,总的雷区布局,状态区域加扫雷区域 // //this.mPanel.BackColor = System.Drawing.Color.Silver; //设置mPanel控件,并以四边全停靠的方式,停靠在父控件上 //this.mPanel.Dock = System.Windows.Forms.DockStyle.Fill; this.mPanel.Location = new System.Drawing.Point(0, SystemInformation.MenuHeight - 10); this.mPanel.Name = "mPanel"; //this.mPanel.Size = new System.Drawing.Size(600, 400); //在主窗体内添加mPanel控件 this.Controls.Add(this.mPanel); /**********************************************************************************/ //创建mAreaMange对象 mAreaManage = new MineAreaManage(rowMines, colMines, minesCount); //mAreaManage.BackColor = Color.FromArgb(20,213,224,238); // mAreaManage.BackgroundImage = Image.FromFile("..\\..\\png\\beijing1.jpeg"); //mAreaManage.BackgroundImage = Properties.Resources.beijing2; mAreaManage.Parent = this.mPanel; //将minePanel对象传递给mAreaManage类 mAreaManage.MPanel = this.mPanel; //mAreaManage控件布局 this.mAreaManage.Location = new System.Drawing.Point(ClientRectangle.Left + 5 + 3, ClientRectangle.Top + 10 + 3 + 36); this.mAreaManage.Name = "mAreaManage"; /**********************************************************************************/ //选中初级菜单项 this.primaryMenuItem.Checked = true; this.intermediateMenuItem.Checked = false; this.seniorMenuItem.Checked = false; this.selfDefMenuItem.Checked = false; /**********************************************************************************/ // //设置主窗体客户区域大小 // this.ClientSize = new System.Drawing.Size(clientAreaWidth, clientAreaHeight); //表情状态按钮点击事件 mPanel.StusButton.Click += new EventHandler(mAreaManage.StusButton_Click); }
private void layOutAll() { /**********************************************************************************/ //判定对象是否存在 if (this.mPanel == null) { //创建minePanel对象 this.mPanel = new minePanel(clientAreaWidth, clientAreaHeight); } else { this.mPanel.Dispose(); //创建minePanel对象 this.mPanel = new minePanel(clientAreaWidth, clientAreaHeight); } // //mPanel,总的雷区布局,状态区域加扫雷区域 // //this.mPanel.BackColor = System.Drawing.Color.Silver; //设置mPanel控件,并以四边全停靠的方式,停靠在父控件上 //this.mPanel.Dock = System.Windows.Forms.DockStyle.Fill; this.mPanel.Location = new System.Drawing.Point(0, SystemInformation.MenuHeight - 10); this.mPanel.Name = "mPanel"; //this.mPanel.Size = new System.Drawing.Size(600, 400); //在主窗体内添加mPanel控件 this.Controls.Add(this.mPanel); /**********************************************************************************/ //创建mAreaMange对象 if (mAreaManage == null) { //创建mAreaManage对象 mAreaManage = new MineAreaManage(rowMines, colMines, minesCount); } else { mAreaManage.Dispose(); //创建mAreaManage对象 mAreaManage = new MineAreaManage(rowMines, colMines, minesCount); } //mAreaManage.BackColor = Color.FromArgb(20,213,224,238); //mAreaManage.BackgroundImage = Image.FromFile("..\\..\\png\\beijing1.jpeg"); //mAreaManage.BackgroundImage = Properties.Resources.beijing2; //指定控件的父窗体或控件 mAreaManage.Parent = this.mPanel; //将minePanel对象传递给mAreaManage类 mAreaManage.MPanel = this.mPanel; //mAreaManage控件布局 this.mAreaManage.Location = new System.Drawing.Point(ClientRectangle.Left + 5 + 3, ClientRectangle.Top + 10 + 3 + 36); this.mAreaManage.Name = "mAreaManage"; //mAreaManage.Dock = DockStyle.Fill; ////将mineAreaManage对象传递给mPanel类 //this.mPanel.MAreaManage = mAreaManage; /**********************************************************************************/ // //设置主窗体客户区域大小 // this.ClientSize = new System.Drawing.Size(clientAreaWidth, clientAreaHeight); }