当前位置: 首页>>代码示例>>C#>>正文


C# ToolStripProgressBar.Increment方法代码示例

本文整理汇总了C#中System.Windows.Forms.ToolStripProgressBar.Increment方法的典型用法代码示例。如果您正苦于以下问题:C# ToolStripProgressBar.Increment方法的具体用法?C# ToolStripProgressBar.Increment怎么用?C# ToolStripProgressBar.Increment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.ToolStripProgressBar的用法示例。


在下文中一共展示了ToolStripProgressBar.Increment方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BehaviorIncrement

		public void BehaviorIncrement ()
		{
			ToolStripProgressBar tsi = new ToolStripProgressBar ();
			
			tsi.Increment (14);
			Assert.AreEqual (14, tsi.Value, "B1");

			tsi.Increment (104);
			Assert.AreEqual (100, tsi.Value, "B2");

			tsi.Increment (-245);
			Assert.AreEqual (0, tsi.Value, "B3");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:13,代码来源:ToolStripProgressBarTest.cs

示例2: 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;
            }
        }
开发者ID:victacora,项目名称:sifca,代码行数:68,代码来源:ImporExportExcel.cs

示例3: exportarExcel

        public void exportarExcel(ToolStripProgressBar bar)
        {
            try
            {

                SaveFileDialog fichero = new SaveFileDialog();
                bar.Visible = true;
                ProjectBL pyBl = new ProjectBL(Program.ContextData);
                FormBL formBl = new FormBL(Program.ContextData);
                InventoryLineBL lineInvBl = new InventoryLineBL(Program.ContextData);
                bool data = false;
                PROYECTO project = (PROYECTO)Program.Cache.Get("project");
                if (project != null)
                {
                    try
                    {
                        fichero.Filter = "Excel (*.xls)|*.xls";
                        fichero.FileName = "proyecto  " + project.LUGAR + " " + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year;
                        if (fichero.ShowDialog() == DialogResult.OK)
                        {
                            //hacer visible la barra de progreso y fijar el valor maximo con el numero de registros a exportar
                            bar.Visible = true;

                            aplicacion = new excel.Application();
                            libros_trabajo = aplicacion.Workbooks.Add();

                            PROYECTO py = pyBl.GetProject(project.NROPROY);

                            excel.Worksheet hoja_regeneracion;
                            hoja_regeneracion = (excel.Worksheet)libros_trabajo.Worksheets.get_Item(1);
                            hoja_regeneracion.Name = "Regeneracion";
                            hoja_regeneracion.Cells[1, 1] = "Lugar";
                            hoja_regeneracion.Cells[1, 2] = "Responsable";
                            hoja_regeneracion.Cells[1, 3] = "Coor X";
                            hoja_regeneracion.Cells[1, 4] = "Coor Y";
                            hoja_regeneracion.Cells[1, 5] = "Linea";
                            hoja_regeneracion.Cells[1, 6] = "Parcela";
                            hoja_regeneracion.Cells[1, 7] = "Estrato";
                            hoja_regeneracion.Cells[1, 8] = "Nombre Comun";
                            hoja_regeneracion.Cells[1, 9] = "Nombre Cientifico";
                            hoja_regeneracion.Cells[1, 10] = "Brinzal";
                            hoja_regeneracion.Cells[1, 11] = "Latizal";
                            hoja_regeneracion.get_Range("A1", "O1").Font.Bold = true;
                            hoja_regeneracion.get_Range("A1", "O1").VerticalAlignment =
                            excel.XlVAlign.xlVAlignCenter;

                            int j = 2;
                            foreach (FORMULARIO form in py.FORMULARIO)
                            {
                                //de formulario extraer coord x y Y el estrato la linea numero de parcela y el usuario se puede hay que revisar muy bien esta parte
                                bar.Maximum = form.LINEAREGENERACION.Count;
                                bar.Value = 0;
                                hoja_regeneracion.Cells[j, 1] = py.LUGAR.ToString();
                                hoja_regeneracion.Cells[j, 2] = form.USUARIO.NOMBRES + form.USUARIO.APELLIDOS;
                                hoja_regeneracion.Cells[j, 3] = form.COORDENADAX;
                                hoja_regeneracion.Cells[j, 4] = form.COORDENADAY;
                                hoja_regeneracion.Cells[j, 5] = form.LINEA.ToString();
                                hoja_regeneracion.Cells[j, 6] = form.PARCELA.ToString();

                                if(form.ESTRATO!=null) hoja_regeneracion.Cells[j, 7] = form.ESTRATO.DESCRIPESTRATO.ToString();

                                foreach (LINEAREGENERACION lineInv in form.LINEAREGENERACION)
                                {
                                    hoja_regeneracion.Cells[j, 1] = py.LUGAR.ToString();
                                    hoja_regeneracion.Cells[j, 2] = form.USUARIO.NOMBRES + form.USUARIO.APELLIDOS;
                                    hoja_regeneracion.Cells[j, 3] = form.COORDENADAX;
                                    hoja_regeneracion.Cells[j, 4] = form.COORDENADAY;
                                    hoja_regeneracion.Cells[j, 5] = form.LINEA.ToString();
                                    hoja_regeneracion.Cells[j, 6] = form.PARCELA.ToString();
                                    if (form.ESTRATO != null)   hoja_regeneracion.Cells[j, 7] = form.ESTRATO.DESCRIPESTRATO.ToString();

                                    hoja_regeneracion.Cells[j, 8] = lineInv.ESPECIE.NOMCOMUN;
                                    hoja_regeneracion.Cells[j, 9] = lineInv.ESPECIE.NOMCIENTIFICO;
                                    hoja_regeneracion.Cells[j, 10] = lineInv.BRINZAL;
                                    hoja_regeneracion.Cells[j, 11] = lineInv.LATIZAL;
                                    bar.Increment(1);
                                    data = true;
                                    j++;
                                }
                                if (form.LINEAREGENERACION.Count == 0) j++;
                            }
                            if(data)libros_trabajo.Worksheets.Add(hoja_regeneracion);
                            data = false;
                            excel.Worksheet hoja_nomaderables;
                            hoja_nomaderables = (excel.Worksheet)libros_trabajo.Worksheets.get_Item(1);

                            hoja_nomaderables.Name = "No maderable";
                            hoja_nomaderables.Cells[1, 1] = "Lugar";
                            hoja_nomaderables.Cells[1, 2] = "Responsable";
                            hoja_nomaderables.Cells[1, 3] = "Coor X";
                            hoja_nomaderables.Cells[1, 4] = "Coor Y";
                            hoja_nomaderables.Cells[1, 5] = "Linea";
                            hoja_nomaderables.Cells[1, 6] = "Parcela";
                            hoja_nomaderables.Cells[1, 7] = "Estrato";

                            hoja_nomaderables.Cells[1, 8] = "Observaciones";
                            TypeUseBL typeUseBl = new TypeUseBL(Program.ContextData);
                            int cont = 9;
                            foreach (TIPODEUSO type in typeUseBl.GetTypeUse())
                            {
//.........这里部分代码省略.........
开发者ID:victacora,项目名称:sifca,代码行数:101,代码来源:ImporExportExcel.cs

示例4: importarExcelFuncional


//.........这里部分代码省略.........
                                    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 + "";
                            int Numparcera = int.Parse(sValor); // se obtiene el numero de la parcela inicial

                            //fijar el valor maximo con el numero de registros a insertar en la barra de progreso
                            bar.Value = 0;
                            bar.Maximum = exlRange.Rows.Count - 3;
开发者ID:victacora,项目名称:sifca,代码行数:66,代码来源:ImporExportExcel.cs

示例5: 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;
        }
开发者ID:victacora,项目名称:sifca,代码行数:101,代码来源:ImporExportExcel.cs

示例6: LoadDotMod


//.........这里部分代码省略.........
        /// <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);

                    if (progbar != null)
                        progbar.GetCurrentParent().Invoke(new Action(() => progbar.Increment(1)));
                }
            }
            return AutoUpdate;
        }
开发者ID:ME3Explorer,项目名称:ME3Explorer,代码行数:101,代码来源:ModMakerHelper.cs


注:本文中的System.Windows.Forms.ToolStripProgressBar.Increment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。