本文整理汇总了C#中Form2.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Form2.Dispose方法的具体用法?C# Form2.Dispose怎么用?C# Form2.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Form2
的用法示例。
在下文中一共展示了Form2.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnProductos_Click
private void btnProductos_Click(object sender, EventArgs e)
{
Form2 nuevoProducto = new Form2();
if (nuevoProducto.ShowDialog(this) == DialogResult.OK)
{
int codigo = Int32.Parse(nuevoProducto.txtCodigo.Text);
string descripcion = nuevoProducto.txtDescicipcion.Text;
int cantidad = Int32.Parse(nuevoProducto.txtCantidad.Text);
double precio = Double.Parse(nuevoProducto.txtPrecio.Text);
double totalLinea = cantidad * precio;
total += totalLinea;
txtTotal.Text = total.ToString();
factura.Lineas.Add(new Linea(codigo, descripcion, cantidad, precio, totalLinea));
dataGridView1.DataSource = factura.Lineas.ToArray();
Console.WriteLine("si");
}
else
{
Console.WriteLine("no");
}
nuevoProducto.Dispose();
}
示例2: DoneButton_Click
private void DoneButton_Click(object sender, EventArgs e)
{
this.engine.SetPlayers(this.NamePlayerOne.Text, this.NamePlayerTwo.Text);
this.engine.Map = new MapFile(this.MapFileName.Text);
Form2 form2 = new Form2(this.NamePlayerOne.Text, this.NamePlayerTwo.Text, this.MapFileName.Text);
form2.ShowDialog();
form2.Dispose();
}
示例3: buttonExe_Click
private void buttonExe_Click(object sender, EventArgs e)
{
// Form2の表示
Form2 frm2 = new Form2();
// メインウィンドウ(Form1)の横に表示
frm2.Left = this.Left + this.Width;
frm2.Top = this.Top;
frm2.ShowDialog();
frm2.Dispose();
}
示例4: button2_Click
private void button2_Click(object sender, EventArgs e)
{
Form2 fm2 = new Form2();
if (fm2.ShowDialog() == DialogResult.OK)
{
textBox1.Font = fm2.f;
textBox1.ForeColor = fm2.c;
}
fm2.Close();
fm2.Dispose();
}
示例5: button1_MouseClick
private void button1_MouseClick(object sender, MouseEventArgs e)
{
Form2 tempForm2=new Form2();
tempForm2.StartPosition = FormStartPosition.CenterParent;
tempForm2.Show();
TreeNode temoNode = new TreeNode();
temoNode.Text = tempForm2.GetValue();
root.Nodes.Add(temoNode);
treeView1.Nodes.Remove(root);
treeView1.Nodes.Add(root);
tempForm2.Dispose();
}
示例6: button1_Click
private void button1_Click(object sender, EventArgs e)
{
Form2 dlg = new Form2();
dlg.ShowDialog();
if (dlg.DialogResult == DialogResult.Yes)
{
Text = "그럼 이제 일해";
}
else if (dlg.DialogResult == DialogResult.No)
{
Text = "빨리 밥 먹고 와";
}
dlg.Dispose();
}
示例7: button1_Click
private void button1_Click(object sender, EventArgs e)
{
Form2 dlg = new Form2();
dlg.LabelX = label1.Left;
dlg.LabelY = label1.Top;
dlg.LabelText = label1.Text;
if (dlg.ShowDialog() == DialogResult.OK)
{
label1.Left = dlg.LabelX;
label1.Top = dlg.LabelY;
label1.Text = dlg.LabelText;
}
dlg.Dispose();
}
示例8: button4_Click
private void button4_Click(object sender, EventArgs e)
{
Form f2 = new Form2();
f2.Show();
//Delay the dispose command
for (int i = 0; i < 30; i++)
{
for (int j = 0; j < 30; j++)
{
Console.WriteLine("form2 running...");
Console.WriteLine("iii" + i + " " + j);
}
}
f2.Dispose();
}
示例9: btnAddTo_Click
private void btnAddTo_Click(object sender, System.EventArgs e)
{
Form2 dlg = new Form2();
if( dlg.ShowDialog( this ) == DialogResult.OK )
{
string name = dlg.textName.Text;
if( name.Length == 0 )
{
name = "";
}
//for( int i = 0; i < 20; i++ )
{
ListViewItem item = lstTo.Items.Add( name );
item.SubItems.Add( dlg.textAddress.Text );
item.SubItems.Add( "Ready" );
}
}
dlg.Dispose();
}
示例10: btn_NewWnd_Click
private void btn_NewWnd_Click(object sender, System.EventArgs e)
{
string strInfo = null; // â �ۼ� ���� ���
Form2 new_Form = new Form2();
new_Form.Text = "���� ����!!!";
switch(this.cmb_BorderStyle.SelectedIndex)
{
case 0:
new_Form.FormBorderStyle = FormBorderStyle.None;
break;
case 1:
new_Form.FormBorderStyle = FormBorderStyle.FixedSingle;
break;
case 2:
new_Form.FormBorderStyle = FormBorderStyle.Fixed3D;
break;
case 3:
new_Form.FormBorderStyle = FormBorderStyle.FixedDialog;
break;
case 4:
new_Form.FormBorderStyle = FormBorderStyle.Sizable;
break;
case 5:
new_Form.FormBorderStyle = FormBorderStyle.FixedToolWindow;
break;
case 6:
new_Form.FormBorderStyle = FormBorderStyle.SizableToolWindow;
break;
}
switch(this.cmb_StartPosition.SelectedIndex)
{
case 0:
new_Form.StartPosition = FormStartPosition.Manual;
break;
case 1:
new_Form.StartPosition = FormStartPosition.CenterScreen;
break;
case 2:
new_Form.StartPosition = FormStartPosition.WindowsDefaultLocation;
break;
case 3:
new_Form.StartPosition = FormStartPosition.WindowsDefaultBounds;
break;
case 4:
new_Form.StartPosition = FormStartPosition.CenterParent;
break;
}
new_Form.Opacity = 1.0 - (this.tb_Opacity.Value/100.0);
if(this.chk_Taskbar.Checked)
new_Form.ShowInTaskbar = false;
if(this.chk_TopMost.Checked)
new_Form.TopMost = true;
strInfo = this.lbl_FormBorderStyle.Text + " : ";
strInfo += this.cmb_BorderStyle.SelectedItem.ToString() + "\r\n";
strInfo += this.lbl_StartPosition.Text + " : ";
strInfo += this.cmb_StartPosition.SelectedItem.ToString() + "\r\n";
strInfo += this.lbl_FormStyle.Text + " : ";
strInfo += this.cmb_FormStyle.SelectedItem.ToString() + "\r\n";
strInfo += this.chk_Taskbar.Text + " : ";
strInfo += ((this.chk_Taskbar.Checked)? "false" : "true") + "\r\n";
strInfo += this.chk_TopMost.Text + " : ";
strInfo += ((this.chk_TopMost.Checked)? "true" : "false") + "\r\n";
strInfo += this.lbl_Opacity.Text + " : ";
strInfo += this.lbl_OpacityValue.Text + "\r\n";
new_Form.lblInfo = strInfo;
if(this.cmb_FormStyle.SelectedIndex == 0)
{
new_Form.ShowDialog(this);
new_Form.Dispose();
}
else
{
new_Form.Show();
}
}
示例11: btnGameGenerate_Click
private void btnGameGenerate_Click(object sender, EventArgs e)
{
applyAll();
string colour = null;
string gameN = null;
string filename = "";
Form2 gameName = new Form2();
//Show testDialog as a modal dialog and determine if DialogResult = OK.
if (gameName.ShowDialog(this) == DialogResult.OK)
{
//Read the contents of gameName's TextBox.
gameN = gameName.txtName.Text;
filename = gameName.txtName.Text + ".html";
}
else
{
return;
}
//Destroy the second form from memory because there is no reason
gameName.Dispose();
string directory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
string path = Path.Combine(directory, filename);
DialogResult = MessageBox.Show("Would you like to use a custom colour scheme?", "Change colour:", MessageBoxButtons.YesNo);
if (DialogResult == DialogResult.Yes)
{
//Allow for changing of main colour
colourPicker.ShowDialog();
var colourChoice = colourPicker.Color;
colour = ColorTranslator.ToHtml(colourChoice);
}
//Variables to check which game type frameworks should be connected to.
bool dnd = false;
bool mc = false;
bool popup = false;
//Go through each question within the game and trigger the correct framework variables
foreach (var question in game)
{
if (question.Value is questionObjectSimple)
{
mc = true;
//Check for if game uses popups in any of the questions. If it does, will include popup plugin.
for (int f = 0; f < question.Value.questionItems.Count; f++)
{
if (question.Value.questionItems[f].popups.popupEnabled == true)
{
popup = true;
}
}
}
else if (question.Value is questionObjectComplex)
{
dnd = true;
}
}
//Using StringBuilder instead of just a string or the original write, due to performance gains. When modifying a string repeatedly, a lot of overhead is used with realocating the memory. StringBuilder does
//not deal with this issue and therefore saves time. The reason I am changing to just a single write vs multiple is due to errors. This way I can return out of the function without having a half completed file
//saved to disk.
//Setting the default max capacity to around 1500 as a start and it will automatically double when capacity is reached. Just to make sure that it is not constantly allocating more memory.
StringBuilder documentContent = new StringBuilder("<!DOCTYPE html>", 1500);
documentContent.Append("<html lang=\"en\">");
documentContent.Append("<head>");
documentContent.Append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
documentContent.Append("<link rel=\"stylesheet\" href=\"https://mylearningspace.wlu.ca/shared/root/tna.css\">");
//if a question is a drag n drop then link the framework
if (dnd == true)
{
documentContent.Append("<link rel=\"stylesheet\" href=\"https://mylearningspace.wlu.ca/shared/root/dnd.css\">");
}
//if a question is a multiple choice then link the appropriate framework
if (mc == true)
{
if (popup == true)
{
documentContent.Append("<link rel=\"stylesheet\" href=\"https://mylearningspace.wlu.ca/shared/root/pop.css\">");
}
}
if (colour != null)
{
documentContent.Append("<style>#header,.item,.option,.question{background:" + colour + "}.button{color:" + colour + "}</style>");
}
documentContent.Append("<script src=\"https://mylearningspace.wlu.ca/shared/root/jsf.js\" type=\"text/javascript\" async></script>");
//Writting Javascript underneath the css, this is why I check the booleans twice.
if (dnd == true)
{
documentContent.Append("<script src=\"https://mylearningspace.wlu.ca/shared/root/dnf.js\" type=\"text/javascript\" async></script>");
}
if (mc == true)
{
documentContent.Append("<script src=\"https://mylearningspace.wlu.ca/shared/root/mpf.js\" type=\"text/javascript\" asnyc></script>");
}
documentContent.Append("<script>");
bool multiQ = false;
//.........这里部分代码省略.........
示例12: toolStripStatusLabel5_Click
private void toolStripStatusLabel5_Click(object sender, EventArgs e)
{
Form2 debugtool = new Form2();
debugtool.setDebugInfo(debugstr);
debugtool.ShowDialog();
debugtool.Dispose();
}
示例13: button1_Click
private void button1_Click(object sender, System.EventArgs e)
{
//Get the layer selected in the combo box
IGeoFeatureLayer geofeaturelayer = null;
IMap map = axPageLayoutControl1.ActiveView.FocusMap;
for (int i=0; i<= map.LayerCount-1; i++)
{
if (map.get_Layer(i).Name == comboBox1.SelectedItem.ToString())
{
geofeaturelayer = (IGeoFeatureLayer) map.get_Layer(i);
break;
}
}
if (geofeaturelayer == null) return;
//Create ClassBreaks form
Form2 classBreaksForm = new Form2();
//Get a ClassBreakRenderer that uses the selected ColorRamp
IClassBreaksRenderer classBreaksRenderer = classBreaksForm.GetClassBreaksRenderer(geofeaturelayer);
if (classBreaksRenderer == null) return;
//Set the new renderer
geofeaturelayer.Renderer = (IFeatureRenderer) classBreaksRenderer;
//Trigger contents changed event for TOCControl
axPageLayoutControl1.ActiveView.ContentsChanged();
//Refresh the display
axPageLayoutControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, geofeaturelayer, null);
//Dispose of the form
classBreaksForm.Dispose();
}
示例14: button2_Click
private void button2_Click(object sender, EventArgs e)
{
OpenFileDialog openfile = new OpenFileDialog();
openfile.Filter = "工作薄(*.xls)|*.xls|所有文件(*.*)|*.*";
if (openfile.FilterIndex == 1 && openfile.ShowDialog() == DialogResult.OK)
{
s = openfile.FileName;
strConn = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + s + ";" + "Extended Properties=Excel 12.0 ;";
Form2 form2 = new Form2();
form2.Owner = this;
form2.substrconn = strConn;
form2.ShowDialog();
if (form2.confirm())
{
sta = form2.StartIndex();
end = form2.EndIndex();
label5.Text = "数据文件: " + s;
label6.Text = "起始时间: " + form2.StartTime();
label7.Text = "终止时间: " + form2.EndTime();
form2.Dispose();
if (init == true && conn.State == ConnectionState.Open)
{
conn.Close();
conn.ConnectionString = strConn;
conn.Open();
myCommand1.Dispose();
table1.Dispose();
table1 = new DataTable();
myCommand1 = new OleDbDataAdapter(strExcel1, strConn);
myCommand1.Fill(table1);
}
else
{
init = true;
conn = new OleDbConnection(strConn);
conn.Open();
myCommand1 = new OleDbDataAdapter(strExcel1, strConn);
myCommand1.Fill(table1);
}
point1.Clear();
point2.Clear();
point3.Clear();
for (int i = 0; i < length; i++)
{
point1.Add(pointr);
point2.Add(pointr);
point3.Add(pointr);
}
x = 0;
front = 0;
rear = 0;
flag = true;
judge = 0;
hScrollBar1.Value = 126 - length / 5;
vScrollBar1.Value = 0;
this.button1.Text = "暂停";
if (button1.Enabled == false)
this.button1.Enabled = true;
array.Clear();
for (int i = 0; i < length; i++)
{
array.Add(initnode);
}
this.button5.Enabled = this.button1.Enabled;
this.hScrollBar1.Enabled = this.button1.Enabled;
this.vScrollBar1.Enabled = this.button1.Enabled;
process();
}
}
}
示例15: EventImageWeb_Click
private void EventImageWeb_Click(object sender, EventArgs e)
{
var f = new Form2();
if (f.ShowDialog() == DialogResult.OK)
{
eventImage.Text = System.IO.Path.GetFileName(f.link);
eventImage.Tag = f.link;
}
f.Dispose();
}