private void CloseMemberCard() { if (this.panelChildren.Controls.Count > 0) { MemberCard mc = this.panelChildren.Controls[0] as MemberCard; if (mc != null) { try { mc.Close(); } catch { } } } }
/// <summary> /// 会员卡 /// </summary> private void Btn_MemberCard_Click(object sender, EventArgs e) { initPic(); this.Btn_MemberCard.Image = Properties.Resources.会员卡3; this.panelInfor.Visible = false; CloseMemberCard(); this.panelChildren.Controls.Clear(); MemberCard mc = new MemberCard(memberConsumptionsid); mc.Owner = this; mc.TopLevel = false; mc.Dock = System.Windows.Forms.DockStyle.Fill; this.panelChildren.Controls.Add(mc); mc.Show(); this.lbTitle.Text = "会员卡"; }