void ReleaseDesignerOutlets() { if (Button1 != null) { Button1.Dispose(); Button1 = null; } if (Button2 != null) { Button2.Dispose(); Button2 = null; } if (Button3 != null) { Button3.Dispose(); Button3 = null; } if (Button4 != null) { Button4.Dispose(); Button4 = null; } if (Button5 != null) { Button5.Dispose(); Button5 = null; } if (Button6 != null) { Button6.Dispose(); Button6 = null; } if (Image1 != null) { Image1.Dispose(); Image1 = null; } if (Image2 != null) { Image2.Dispose(); Image2 = null; } if (WebView1 != null) { WebView1.Dispose(); WebView1 = null; } }
private void Wizard_FormClosed(object sender, FormClosedEventArgs e) { if (Image1 != null) { Image1.Dispose(); } if (Image2 != null) { Image2.Dispose(); } this.Dispose(true); GC.Collect(); }
private void button3_Click(object sender, EventArgs e) { if (Image1 != null) { Image1.Dispose(); } if (Image2 != null) { Image2.Dispose(); } this.Close(); this.Dispose(); GC.Collect(); }
void ReleaseDesignerOutlets() { if (TitleLabel != null) { TitleLabel.Dispose(); TitleLabel = null; } if (Image1 != null) { Image1.Dispose(); Image1 = null; } if (Image2 != null) { Image2.Dispose(); Image2 = null; } if (Label1 != null) { Label1.Dispose(); Label1 = null; } if (Label2 != null) { Label2.Dispose(); Label2 = null; } if (FavoritesButton != null) { FavoritesButton.Dispose(); FavoritesButton = null; } }
void ReleaseDesignerOutlets() { if (Caption != null) { Caption.Dispose(); Caption = null; } if (Label1 != null) { Label1.Dispose(); Label1 = null; } if (Image1 != null) { Image1.Dispose(); Image1 = null; } if (Image2 != null) { Image2.Dispose(); Image2 = null; } if (Label2 != null) { Label2.Dispose(); Label2 = null; } if (Image3 != null) { Image3.Dispose(); Image3 = null; } if (Label3 != null) { Label3.Dispose(); Label3 = null; } if (Image4 != null) { Image4.Dispose(); Image4 = null; } if (Label4 != null) { Label4.Dispose(); Label4 = null; } if (Number != null) { Number.Dispose(); Number = null; } if (IssueType != null) { IssueType.Dispose(); IssueType = null; } }
public void Dispose() { Image1.Dispose(); Image2.Dispose(); Cache.StoreTexture(Correlation); }
private void button2_Click(object sender, EventArgs e) { CurrentStep++; switch (CurrentStep) { case Steps.step1: { //加大括号只是为了易读 //不可能,不可能有++后才step1 MessageBox.Show("不可能的错误出现了!" + " button2 step1"); } break; case Steps.step2: //那么原来就是step1 { //---------------------------------------------------界面更改 //上一步按钮可用 button1.Visible = true; pictureBox1.Visible = true; pictureBox2.Visible = false; pictureBox3.Visible = false; pictureBox4.Visible = false; label1.Font = new Font(label1.Font, FontStyle.Regular); label2.Font = new Font(label2.Font, FontStyle.Bold); label3.Font = new Font(label3.Font, FontStyle.Regular); label4.Font = new Font(label4.Font, FontStyle.Regular); panel1.Visible = false; panel2.Visible = true; panel3.Visible = false; panel4.Visible = false; //--------------------------------------------------实际内容 //开始preview吧-------------------- //首先清空要所有label的Text labelName.Text = ""; labelTitle.Text = ""; labelCompany.Text = ""; labelLocation.Text = ""; labelCellphone.Text = ""; labelTelephone.Text = ""; labelQQ.Text = ""; labelEmail.Text = ""; linkLabelWebsite.Text = ""; pictureBoxLogo.Image = null; //其次要获取选取了哪一些节点 //对选中的要显示,未选中的不显示 //赋值然后显示, //下一步按钮默认显示中文 SetLabelNFormTextIn2Languages(true); GetCheckedNodeAndShowThem(true); } break; case Steps.step3: { //---------------------------------------------------界面更改 button2.Text = "发送"; pictureBox1.Visible = true; pictureBox2.Visible = true; pictureBox3.Visible = false; pictureBox4.Visible = false; label1.Font = new Font(label1.Font, FontStyle.Regular); label2.Font = new Font(label2.Font, FontStyle.Regular); label3.Font = new Font(label3.Font, FontStyle.Bold); label4.Font = new Font(label4.Font, FontStyle.Regular); panel1.Visible = false; panel2.Visible = false; panel3.Visible = true; panel4.Visible = false; //--------------------------------------------------实际内容 } break; case Steps.step4: //点击发送后 到(运行)此步,故发送应在此步进行 { //---------------------------------------------------界面更改 button1.Visible = false; button2.Text = "请等待..."; button2.Enabled = false; //等发送完后才可用 button3.Visible = false; labelResultText.Text = "正在发送中,请等待..."; pictureBox1.Visible = true; pictureBox2.Visible = true; pictureBox3.Visible = true; pictureBox4.Visible = true; label1.Font = new Font(label1.Font, FontStyle.Regular); label2.Font = new Font(label2.Font, FontStyle.Regular); label3.Font = new Font(label3.Font, FontStyle.Regular); label4.Font = new Font(label4.Font, FontStyle.Bold); panel1.Visible = false; panel2.Visible = false; panel3.Visible = false; panel4.Visible = true; //完成,显示发送结果 //要生成XML,并发送 //因此在这里要释放图像文件句柄 if (Image1 != null) { Image1.Dispose(); //还有一个问题/异常时:如果点中文按钮,又点英文按钮就会有一个没有引用的Image对象,这样就无法释放 } if (Image2 != null) { Image2.Dispose(); } //首先获取选中了哪些节点,生成名片,然后向指定的IPEndPoint发送之 XmlString = GetAllCheckedNodesAndGenerateXml(); ConnectServerAndSendXml(RemoteServerIP); button2.Text = "完成"; button2.Enabled = true; button2.Focus(); labelResultText.Text = "向" + RemoteServerIP + "发送名片成功!"; labelResultText.Visible = true; } break; default: //Quit if (Image1 != null) { Image1.Dispose(); } if (Image2 != null) { Image2.Dispose(); } this.Close(); this.Dispose(); GC.Collect(); break; } }