本文整理汇总了C#中System.Windows.Forms.ToolStripProgressBar.GetCurrentParent方法的典型用法代码示例。如果您正苦于以下问题:C# ToolStripProgressBar.GetCurrentParent方法的具体用法?C# ToolStripProgressBar.GetCurrentParent怎么用?C# ToolStripProgressBar.GetCurrentParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ToolStripProgressBar
的用法示例。
在下文中一共展示了ToolStripProgressBar.GetCurrentParent方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetToolStripProgressBarStyle
private void SetToolStripProgressBarStyle(ToolStripProgressBar toolStripProgressBar, ProgressBarStyle style)
{
if(toolStripProgressBar.GetCurrentParent().InvokeRequired)
{
toolStripProgressBar.GetCurrentParent().Invoke(new Action<ToolStripProgressBar, ProgressBarStyle>(SetToolStripProgressBarStyle), new object[] { toolStripProgressBar, style });
}
else
{
toolStripProgressBar.Style = style;
}
}
示例2: SetToolStripProgressBarValue
private void SetToolStripProgressBarValue(ToolStripProgressBar toolStripProgressBar, int value)
{
if(toolStripProgressBar.GetCurrentParent().InvokeRequired)
{
toolStripProgressBar.GetCurrentParent().Invoke(new Action<ToolStripProgressBar, int>(SetToolStripProgressBarValue), new object[] { toolStripProgressBar, value });
}
else
{
toolStripProgressBar.Value = value;
}
}
示例3: exportarExcel
//.........这里部分代码省略.........
}
i += 2;
hoja_maderable.Cells[i, 1] = "Lugar";
hoja_maderable.Cells[i, 2] = "Responsable";
hoja_maderable.Cells[i, 3] = "Coor X";
hoja_maderable.Cells[i, 4] = "Coor Y";
hoja_maderable.Cells[i, 5] = "Linea";
hoja_maderable.Cells[i, 6] = "Parcela";
hoja_maderable.Cells[i, 7] = "Estrato";
hoja_maderable.Cells[i, 8] = "Numero de arbol";
hoja_maderable.Cells[i, 9] = "Nombre comun";
hoja_maderable.Cells[i, 10] = "Nombre cientifico";
hoja_maderable.Cells[i, 11] = "Calidad";
hoja_maderable.Cells[i, 12] = "DAP";
hoja_maderable.Cells[i, 13] = "CAP";
hoja_maderable.Cells[i, 14] = "Altura comercial";
hoja_maderable.Cells[i, 15] = "Altura total";
hoja_maderable.Cells[i, 16] = "Area basal";
hoja_maderable.Cells[i, 17] = "Volumen comercial";
hoja_maderable.Cells[i, 18] = "Volumen total";
hoja_maderable.get_Range("A1", "O1").Font.Bold = true;
hoja_maderable.get_Range("A1", "O1").VerticalAlignment =
excel.XlVAlign.xlVAlignCenter;
i++;
foreach (FORMULARIO form in py.FORMULARIO)
{
bar.Maximum = form.LINEAINVENTARIO.Count;
bar.Value = 0;
hoja_maderable.Cells[i, 1] = py.LUGAR.ToString();
hoja_maderable.Cells[i, 2] = form.USUARIO.NOMBRES + form.USUARIO.APELLIDOS;
hoja_maderable.Cells[i, 3] = form.COORDENADAX;
hoja_maderable.Cells[i, 4] = form.COORDENADAY;
hoja_maderable.Cells[i, 5] = form.LINEA.ToString();
hoja_maderable.Cells[i, 6] = form.PARCELA.ToString();
if (form.ESTRATO != null) hoja_maderable.Cells[i, 7] = form.ESTRATO.DESCRIPESTRATO.ToString();
foreach (LINEAINVENTARIO lineInv in form.LINEAINVENTARIO)
{
data = true;
hoja_maderable.Cells[i, 1] = py.LUGAR.ToString();
hoja_maderable.Cells[i, 2] = form.USUARIO.NOMBRES + form.USUARIO.APELLIDOS;
hoja_maderable.Cells[i, 3] = form.COORDENADAX.ToString();
hoja_maderable.Cells[i, 4] = form.COORDENADAY.ToString();
hoja_maderable.Cells[i, 5] = form.LINEA.ToString();
hoja_maderable.Cells[i, 6] = form.PARCELA.ToString();
if (form.ESTRATO != null) hoja_maderable.Cells[i, 7] = form.ESTRATO.DESCRIPESTRATO.ToString();
hoja_maderable.Cells[i, 8] = lineInv.NROARB.ToString();
hoja_maderable.Cells[i, 9] = lineInv.ESPECIE.NOMCOMUN.ToString();
hoja_maderable.Cells[i, 10] = lineInv.ESPECIE.NOMCIENTIFICO.ToString();
hoja_maderable.Cells[i, 11] = lineInv.CALIDAD.CODCALIDAD.ToString();
hoja_maderable.Cells[i, 12] = lineInv.DAP;
hoja_maderable.Cells[i, 13] = lineInv.CAP;
hoja_maderable.Cells[i, 14] = lineInv.ALTCOMER_M;
hoja_maderable.Cells[i, 15] = lineInv.ALTTOT_M;
hoja_maderable.Cells[i, 16] = lineInv.AREABASAL;
hoja_maderable.Cells[i, 17] = lineInv.VOLCOM;
hoja_maderable.Cells[i, 18] = lineInv.VOLTOT;
i++;
bar.Increment(1);
}
if (form.LINEAINVENTARIO.Count == 0) i++;
}
if(data)libros_trabajo.Worksheets.Add(hoja_maderable);
MessageBox.Show("Los datos se exportaron correctamente.", "Operacion exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
bar.Visible = false;
libros_trabajo.SaveAs(fichero.FileName,
excel.XlFileFormat.xlWorkbookNormal);
libros_trabajo.Close(true);
aplicacion.Quit();
System.Diagnostics.Process.Start(fichero.FileName);
}
bar.Visible = false;
}
catch (Exception ex)
{
bar.Visible = false;
throw ex;
}
}
else MessageBox.Show("No existe un proyecto abierto dentro del sistema.", "Operacion invalida", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (Exception ex)
{
bar.Visible = false;
Error_Form errorForm = new Error_Form(ex.Message);
ToolStrip menu = bar.GetCurrentParent();
Principal_Form parent = (Principal_Form)menu.Parent;
errorForm.MdiParent = (Form)parent;
errorForm.Show();
}
}
示例4: loadSpecies
public bool loadSpecies(ToolStripProgressBar bar, int hoja)
{
try
{
bar.Visible = true;
hojas_trabajo = (excel.Worksheet)libros_trabajo.Worksheets.get_Item(hoja);
exlRange = hojas_trabajo.UsedRange;
if (bar != null)
{
bar.Visible = true;
bar.Value = 0;
bar.Maximum = exlRange.Rows.Count - 1;
}
//Recorremos el archivo excel como si fuera una matriz
//leemos las especies que se encuentran en la hoja
for (int i = 2; i <= exlRange.Rows.Count; i++)
{
string nomCom = "" + (exlRange.Cells[i, 1] as excel.Range).Value + "";
string nomCien = "" + (exlRange.Cells[i, 2] as excel.Range).Value + "";
string nomFam = "" + (exlRange.Cells[i, 3] as excel.Range).Value + "";
string numDiam = "" + (exlRange.Cells[i, 4] as excel.Range).Value + "";
string gruEco = "" + (exlRange.Cells[i, 5] as excel.Range).Value + "";
specie = new ESPECIE();
specie = specieBl.GetSpecieByComNameAndScienName(nomCom, nomCien);
if (specie == null)
{
specie = new ESPECIE();
specie.CODESP = Guid.NewGuid();
//specie.DIAMMINCORTE = decimal.Parse(numDiam.Replace('.', ','));
specie.FAMILIA = nomFam;
specie.GRUPOCOM = "SV";
specie.NOMCIENTIFICO = nomCien;
specie.NOMCOMUN = nomCom;
if (gruEco == "") specie.GRUPOECOLOGICO = "NT";
else
{
if (gruEco == "Tolerante" || gruEco == "tolerante" || gruEco == "TOLERANTE") specie.GRUPOECOLOGICO = "TL";
else if (gruEco == "No Tolerante" || gruEco == "no tolerante" || gruEco == "NO TOLERANTE" || gruEco == "NO tolerante") specie.GRUPOECOLOGICO = "NT";
}
specieBl.InsertSpecie(specie);
string result = specieBl.SaveChanges();
if (!result.Equals(""))
{
Error_Form errorForm = new Error_Form(result);
ToolStrip menu = bar.GetCurrentParent();
Principal_Form parent = (Principal_Form)menu.Parent;
errorForm.MdiParent = (Form)parent;
errorForm.Show();
return false;
}
if (bar != null) bar.Increment(1);
}
if (hoja == 2) newProject.ESPECIE.Add(specie);
}
if(hoja==1) MessageBox.Show("Los datos se cargaron correctamente.", "Operacion exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
bar.Visible = false;
return true;
}
catch (Exception ex)
{
Error_Form childForm = new Error_Form(ex.Message);
childForm.Show();
bar.Visible = false;
return false;
}
}
示例5: importarExcelFuncional
//.........这里部分代码省略.........
int areaReg = 0;
decimal.TryParse(tamanioParcela.Replace(".", ","), out tam);
py.TAMANO = tam;
decimal.TryParse(tamanioSupTotal.Replace(".", ","), out tamSupTotal);
py.SUPTOT = tamSupTotal;
int.TryParse(areaderegeneracion, out areaReg);
py.AREAFUSTALESPORPARCELA = areaReg;
decimal.TryParse(factorForma.Replace(".", ","), out factor);
py.FACTORDEFORMA = factor;
py.ETAPA = 0;
py.DESCRIPCION = descripcion;
decimal.TryParse(confianza.Replace(".", ","), out conf);
py.CONFIANZA = conf;
TypeSampleDesignBl desingType = new TypeSampleDesignBl(Program.ContextData);
ObjectiveInventoryBL objInvBl = new ObjectiveInventoryBL(Program.ContextData);
if (TipoDisenio.Equals("Estratificado")) py.NOMTIPODISEMUEST = "ES";
else if (TipoDisenio.Equals("Simple")) py.NOMTIPODISEMUEST = "SI";
if (Objetivo.Equals("Maderable")) py.NOMBRETIPOINV = "MD";
else if (Objetivo.Equals("No Maderable")) py.NOMBRETIPOINV = "NM";
py.FECHA = DateTime.Now;
py.TIPOPROYECTO = "CR";
py.NROFORMULA = Guid.Parse("ED52569E-5CFD-454F-9F8B-9429A47C829F");
py.SUPMUE = 0;
py.INTMUE = 0;
py.LIMITINFDAP = 10;
py.USUARIO = user;
py.NROUSUARIO = user.NROUSUARIO;
pyBl.InsertProject(py);
string result = pyBl.SaveChanges();
if (!result.Equals(""))
{
Error_Form errorForm = new Error_Form(result);
ToolStrip menu = bar.GetCurrentParent();
Principal_Form parent = (Principal_Form)menu.Parent;
errorForm.MdiParent = (Form)parent;
errorForm.Show();
return;
}
bar.Increment(1);
}
}
exlRange = hojas_trabajo.UsedRange;
this.loadSpecies(bar, 2);
//recorremos el archivo para leer las lineas de inventario que estan en el libro
hojas_trabajo = (excel.Worksheet)libros_trabajo.Worksheets.get_Item(1);
//Definimos el el rango de celdas que seran leidas
exlRange = hojas_trabajo.UsedRange;
int posStratum = 0, posBloque = 0, posNomCom = 0, posFam = 0, posNomCien = 0, posParcela = 0, posCodCal = 0, posNumArb = 0;
//Recorremos el archivo excel como si fuera una matriz
string sValor = "";
posBloque = 1;
posStratum = 2;
posParcela = 3;
posNumArb = 4;
posNomCom = 5;
posNomCien = 6;
posFam = 7;
posCodCal = 11;
sValor = "" + (exlRange.Cells[3, posParcela] as excel.Range).Value + "";
示例6: importarExcel
public void importarExcel(ToolStripProgressBar bar)
{
try
{
bar.Visible = true;
if (this.loadFicherFile())
{
stratum = new ESTRATO();
InventoryLineBL lineInvBl = new InventoryLineBL(Program.ContextData);
listStratumsAdded = new ArrayList();
if (this.loadProject(1))
{
this.loadSpecies(bar, 2);
this.loadInventoryData(bar, 4);
bar.Visible = false;
//cerramos el libro y la aplicacion
libros_trabajo.Close();
aplicacion.Quit();
Program.Cache.Add("project", newProject, new CacheItemPolicy());
ToolStrip menu = bar.GetCurrentParent();
Principal_Form parent = (Principal_Form)menu.Parent;
parent.EstatusLabel.Text = parent.EstatusLabel.Text + " - Proyecto Abierto: " + newProject.LUGAR;
parent.Text = parent.Text + " - Proyecto Abierto " + newProject.LUGAR;
parent.changueMenuProject();
}
}
bar.Visible = false;
}
catch (Exception ex)
{
Error_Form errorForm = new Error_Form(ex.Message);
ToolStrip menu = bar.GetCurrentParent();
Principal_Form parent = (Principal_Form)menu.Parent;
errorForm.MdiParent = (Form)parent;
errorForm.Show();
bar.Visible = true;
}
}
示例7: loadInventoryData
//.........这里部分代码省略.........
if (Decimal.TryParse(((exlRange.Cells[i, j] as excel.Range).Value + "").Replace(".", ","), out cap)) lineInv.CAP = cap;
if (Decimal.TryParse(((exlRange.Cells[i, j + 1] as excel.Range).Value + "").Replace(".", ","), out altTot)) lineInv.ALTTOT_M = altTot;
if (Decimal.TryParse(((exlRange.Cells[i, j + 2] as excel.Range).Value + "").Replace(".", ","), out altCom)) lineInv.ALTCOMER_M = altCom;
QualityBL quality = new QualityBL(Program.ContextData);
lineInv.CODCALIDAD = (quality.getQualityByDescription("Regular")).CODCALIDAD; // si no se especifica la calidad se la coloca por defecto en regular,
if (("" + (exlRange.Cells[i, j + 3] as excel.Range).Value + "").Equals("x")) lineInv.CODCALIDAD = (quality.getQualityByDescription("Bueno")).CODCALIDAD; //si la calidad es buena
else
if (("" + (exlRange.Cells[i, j + 5] as excel.Range).Value + "").Equals("x")) lineInv.CODCALIDAD = (quality.getQualityByDescription("Malo")).CODCALIDAD;//si la calidad es mala
if (("" + (exlRange.Cells[i, j + 6] as excel.Range).Value + "").Equals("x")) //si la una linea maderable y el uso pertenece a alimenticia
{
LINEANOMADERABLES lineInvNM = new LINEANOMADERABLES();
NonTimberLineBL lineInvNMBl = new NonTimberLineBL(Program.ContextData);
TypeUseBL typeUseBl = new TypeUseBL(Program.ContextData);
lineInvNM.LINEANMAD = Guid.NewGuid();
lineInvNM.NROFORMULARIO = form.NROPROY;
lineInvNM.OBSERVACIONES = "" + (exlRange.Cells[i, j + 9] as excel.Range).Value + "";
form.LINEANOMADERABLES.Add(lineInvNM);
lineInvNM.TIPODEUSO.Add(typeUseBl.GetTypeUse("AL"));
form.LINEANOMADERABLES.Add(lineInvNM);
//lineInvNMBl.InsertNonTimberLine(lineInvNM);
//formBl.UpdateForm(form);
}
else
{
if (("" + (exlRange.Cells[i, j + 7] as excel.Range).Value + "").Equals("x")) //si la una linea maderable y el uso pertenece a artesanal
{
LINEANOMADERABLES lineInvNM = new LINEANOMADERABLES();
NonTimberLineBL lineInvNMBl = new NonTimberLineBL(Program.ContextData);
TypeUseBL typeUseBl = new TypeUseBL(Program.ContextData);
lineInvNM.LINEANMAD = Guid.NewGuid();
lineInvNM.NROFORMULARIO = form.NROPROY;
lineInvNM.OBSERVACIONES = (exlRange.Cells[i, j + 9] as excel.Range).Value + "";
form.LINEANOMADERABLES.Add(lineInvNM);
lineInvNM.TIPODEUSO.Add(typeUseBl.GetTypeUse("AR"));
form.LINEANOMADERABLES.Add(lineInvNM);
//lineInvNMBl.InsertNonTimberLine(lineInvNM);
//formBl.UpdateForm(form);
}
else
{
if (("" + (exlRange.Cells[i, j + 8] as excel.Range).Value + "").Equals("x")) //si la una linea maderable y el uso pertenece a medicinal
{
LINEANOMADERABLES lineInvNM = new LINEANOMADERABLES();
NonTimberLineBL lineInvNMBl = new NonTimberLineBL(Program.ContextData);
TypeUseBL typeUseBl = new TypeUseBL(Program.ContextData);
lineInvNM.LINEANMAD = Guid.NewGuid();
lineInvNM.NROFORMULARIO = form.NROPROY;
lineInvNM.OBSERVACIONES = (exlRange.Cells[i, j + 9] as excel.Range).Value + "";
form.LINEANOMADERABLES.Add(lineInvNM);
lineInvNM.TIPODEUSO.Add(typeUseBl.GetTypeUse("MD"));
form.LINEANOMADERABLES.Add(lineInvNM);
//lineInvNMBl.InsertNonTimberLine(lineInvNM);
//formBl.UpdateForm(form);
}
}
}
lineInv.DAP = lineInv.CAP / Convert.ToDecimal(Math.PI);
lineInv.AREABASAL = (lineInv.DAP * lineInv.DAP) * (Convert.ToDecimal(Math.PI) / 4);
lineInv.VOLTOT = (lineInv.ALTTOT_M * lineInv.AREABASAL * newProject.FACTORDEFORMA);
lineInv.VOLCOM = (lineInv.ALTCOMER_M * lineInv.AREABASAL * newProject.FACTORDEFORMA);
form.LINEAINVENTARIO.Add(lineInv);
string result1 = lineInvBl.SaveChanges();
if (!result1.Equals(""))
{
Error_Form errorForm = new Error_Form(result1);
ToolStrip menu = bar.GetCurrentParent();
Principal_Form parent = (Principal_Form)menu.Parent;
errorForm.MdiParent = (Form)parent;
errorForm.Show();
return;
}
//lineInvBl.InsertInventoryLine(lineInv);
//lineInvBl.SaveChanges();
bar.Increment(1);
}
if (numParcelas > 0)
{
newProject.SUPMUE = numParcelas * newProject.TAMANO;
newProject.INTMUE = (newProject.SUPMUE / newProject.SUPTOT) * 100;
pyBl.UpdateProject(newProject);
string result = pyBl.SaveChanges();
if (!result.Equals(""))
{
Error_Form errorForm = new Error_Form(result);
ToolStrip menu = bar.GetCurrentParent();
Principal_Form parent = (Principal_Form)menu.Parent;
errorForm.MdiParent = (Form)parent;
errorForm.Show();
return;
}
numParcelas = 0;
}
MessageBox.Show("Los datos se importaron correctamente", "Operacion exitosa", MessageBoxButtons.OK, MessageBoxIcon.Information);
bar.Visible = false;
}
示例8: LoadDotMod
/// <summary>
/// Loads a .mod file from given file and returns a nullable boolean (True, null, False).
/// </summary>
/// <param name="file">.mod file to load.</param>
/// <param name="modCount">REF: Total number of jobs loaded.</param>
/// <param name="progbar">ProgressBar to increment/change during method.</param>
/// <param name="ExternalCall">If true, certain functions are disabled/automated.</param>
/// <returns>True if update is to be done automatically, false if not, and null if user requests to stop loading .mod.</returns>
public static bool? LoadDotMod(string file, ref int modCount, ToolStripProgressBar progbar, bool ExternalCall)
{
bool AutoUpdate = false;
// KFreon: Load from file
using (FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read))
{
// KFreon: Attempt to get version
fs.Seek(0, SeekOrigin.Begin);
int versionLength = fs.ReadValueS32();
long countOffset = fs.Seek(0, SeekOrigin.Current); // Just in case
string version = "";
int count = -1;
string ExecutingVersion = null;
bool validVersion = false;
if (versionLength > 20) // KFreon: Version is definitely wrong
ExecutingVersion = "";
else
{
// KFreon: Do version checking
for (int i = 0; i < versionLength; i++)
version += (char)fs.ReadByte();
// KFreon: Get Executing Version and check validity of read .mod version
string vers;
ExecutingVersion = GetVersion(version, out vers, out validVersion);
version = vers;
count = fs.ReadValueS32();
// KFreon: Check if update required
if (version != ExecutingVersion)
{
if (ExternalCall)
AutoUpdate = true;
}
else // KFreon: Reset to null to signify success
ExecutingVersion = null;
}
// KFreon: Ask what to do about version
if (ExecutingVersion != null) //&& !ExternalCall) // Heff: do we want to suppress this for external calls? should they always autoupdate?
{ // Seems better to keep it the current way, so that users get prompted if they load old .mods.
DialogResult dr = MessageBox.Show(Path.GetFileName(file) + " is old and unsupported by this version of ME3Explorer." + Environment.NewLine + "Click Yes to update .mod now, No to continue loading .mod, or Cancel to stop loading .mod", "Ancient .mod detected.", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
if (dr == System.Windows.Forms.DialogResult.Cancel)
return null;
else if (dr == System.Windows.Forms.DialogResult.Yes)
AutoUpdate = true;
}
/*else if (ExecutingVersion != null) // Heff: could use this for always updating if its an external call:
AutoUpdate = true;*/
// KFreon: Reset stream position if necessary
if (!validVersion)
{
count = versionLength;
fs.Seek(countOffset, SeekOrigin.Begin);
}
// KFreon: Increment progress bar
if (progbar != null)
progbar.GetCurrentParent().Invoke(new Action(() =>
{
progbar.Value = 0;
progbar.Maximum = count;
}));
// KFreon: Read Data
DebugOutput.PrintLn("Found " + count + " Jobs", true);
modCount += count;
for (int i = 0; i < count; i++)
{
// KFreon: Read name
ModMaker.ModJob md = new ModMaker.ModJob();
int len = fs.ReadValueS32();
md.Name = "";
for (int j = 0; j < len; j++)
md.Name += (char)fs.ReadByte();
// KFreon: Read script
len = fs.ReadValueS32();
md.Script = "";
for (int j = 0; j < len; j++)
md.Script += (char)fs.ReadByte();
// KFreon: Read data
len = fs.ReadValueS32();
byte[] buff = fs.ReadBytes(len);
md.data = buff;
ModMaker.JobList.Add(md);
DebugOutput.PrintLn("Add Job \"" + md.Name + "\"", true);
//.........这里部分代码省略.........
示例9: UpdateProgressBar
private void UpdateProgressBar(ToolStripProgressBar bar, int value)
{
if (value <= 100)
{
bar.Value = 100;
bar.GetCurrentParent().Refresh();
bar.Value = value;
bar.GetCurrentParent().Refresh();
}
else
{
bar.Value = 100;
bar.GetCurrentParent().Refresh();
}
}