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


C# ProgressBar.PerformStep方法代码示例

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


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

示例1: Sub_Color

        public static void Sub_Color(Image[] img, int k1, int k2, int k3, ProgressBar progressBar1, double N1, double N2)
        {
            int w1 = img[k1 - 1].Width;
            int h1 = img[k1 - 1].Height;
            Bitmap bmp1 = new Bitmap(img[k1 - 1], w1, h1);

            int w2 = img[k2 - 1].Width;
            int h2 = img[k2 - 1].Height;
            Bitmap bmp2 = new Bitmap(img[k2 - 1], w2, h2);

            w1 = (int)Math.Min(w1, w2);
            h1 = (int)Math.Min(h1, h2);

            Bitmap bmp3 = new Bitmap(img[k3 - 1], w1, h1);

            Color c1, c2;
            int r1, r2, rs;
            int max=-32000, min=32000;
            progressBar1.Visible = true;
            progressBar1.Minimum = 1;
            progressBar1.Maximum = w1;
            progressBar1.Value = 1;
            progressBar1.Step = 1;

            for (int i = 0; i < w1; i++)
            {
                for (int j = 0; j < h1; j++)
                {
                    c1 = bmp1.GetPixel(i, j);  r1 = (int) (c1.R * N1);
                    c2 = bmp2.GetPixel(i, j);  r2 = (int) (c2.R * N2);
                    rs = (r1 - r2);
                    min = Math.Min(rs, min);
                    max = Math.Max(rs, max);
                }

                progressBar1.PerformStep();
            }
            // ---------------------------------------------------------------------------------------------------
            progressBar1.Value = 1;
            for (int i = 0; i < w1; i++)
            {
                for (int j = 0; j < h1; j++)
                {
                    c1 = bmp1.GetPixel(i, j); r1 = (int) (c1.R * N1);
                    c2 = bmp2.GetPixel(i, j); r2 = (int) (c2.R * N2);
                    rs = (r1 - r2);
                    rs = (rs - min) * 255 / (max - min);
                    bmp3.SetPixel(i, j, Color.FromArgb(rs, rs, rs));
                }

                progressBar1.PerformStep();
            }
            img[k3 - 1] = bmp3;
        }
开发者ID:interferometry7,项目名称:interferometry,代码行数:54,代码来源:SumClass.cs

示例2: ATAN_123

        public static void ATAN_123(Image[] img, PictureBox pictureBox01, ProgressBar progressBar1, int n, double[] fzz, double Gamma)
        {
            int w1 = img[0].Width;
            int h1 = img[0].Height;

            int n_sdv = n;                                                       // Число фазовых сдвигов

            double[] i_sdv = new double[4];
            double[] v_sdv = new double[4];                                  // Вектор коэффициентов
            double[] k_sin = new double[4];
            double[] k_cos = new double[4];
            double pi = Math.PI;

            for (int i = 0; i < n_sdv; i++) { k_sin[i] = Math.Sin(fzz[i] * pi / 180); k_cos[i] = Math.Cos(fzz[i] * pi / 180); }  //  Сдвиги фаз

            Color c;
            int r;
            double fz, fz1, fz2;
            Bitmap bmp1 = new Bitmap(img[0], w1, h1);
            Bitmap bmp2 = new Bitmap(img[1], w1, h1);
            Bitmap bmp3 = new Bitmap(img[2], w1, h1);
            Bitmap bmp4 = new Bitmap(img[3], w1, h1);
            Bitmap bmp5 = new Bitmap(w1, h1);

            progressBar1.Visible = true;
            progressBar1.Minimum = 1;
            progressBar1.Maximum = w1;
            progressBar1.Value = 1;
            progressBar1.Step = 1;

            for (int i = 0; i < w1; i++)
            {
                for (int j = 0; j < h1; j++)
                {
                    c = bmp1.GetPixel(i, j); r = (c.R + c.G + c.B) / 3; i_sdv[0] = (int)Math.Pow(r, Gamma);
                    c = bmp2.GetPixel(i, j); r = (c.R + c.G + c.B) / 3; i_sdv[1] = (int)Math.Pow(r, Gamma);
                    c = bmp3.GetPixel(i, j); r = (c.R + c.G + c.B) / 3; i_sdv[2] = (int)Math.Pow(r, Gamma);
                    c = bmp4.GetPixel(i, j); r = (c.R + c.G + c.B) / 3; i_sdv[3] = (int)Math.Pow(r, Gamma);

                    // ------                                     Формула расшифровки

                    v_sdv[0] = i_sdv[1] - i_sdv[n_sdv - 1];
                    v_sdv[n_sdv - 1] = i_sdv[0] - i_sdv[n_sdv - 2];
                    for (int ii = 1; ii < n_sdv - 1; ii++) v_sdv[ii] = i_sdv[ii + 1] - i_sdv[ii - 1];
                    fz1 = fz2 = 0; for (int ii = 0; ii < n_sdv; ii++) { fz1 += v_sdv[ii] * k_sin[ii]; fz2 += v_sdv[ii] * k_cos[ii]; }

                    fz = Math.Atan2(fz1, fz2) + Math.PI;
                    r = (int)((fz * 255) / (2 * Math.PI));

                    bmp5.SetPixel(i, j, Color.FromArgb(r, r, r));
                }
                progressBar1.PerformStep();
            }
            pictureBox01.Size = bmp4.Size;
            pictureBox01.Image = bmp5;
        }
开发者ID:interferometry7,项目名称:interferometry,代码行数:56,代码来源:FazaClass1.cs

示例3: ClearFlags

		void ClearFlags(FdoCache cache, ProgressBar progressBar)
		{
			var paras = cache.ServiceLocator.GetInstance<IStTxtParaRepository>().AllInstances().ToArray();
			progressBar.Minimum = 0;
			progressBar.Maximum = paras.Length;
			progressBar.Step = 1;
			foreach (var para in paras)
			{
				progressBar.PerformStep();
				para.ParseIsCurrent = false;
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:12,代码来源:ParseIsCurrentFixer.cs

示例4: copyMP3s

 private void copyMP3s(ListBox.ObjectCollection files, decimal starting_number, bool auto_pad, decimal padding, string target_folder, ProgressBar pb_progress)
 {
     if (auto_pad) padding = (decimal)Math.Floor(Math.Log10(files.Count) + 1);
     pb_progress.Maximum = files.Count;
     pb_progress.Step = 1;
     int now = (int)starting_number;
     int i;
     for (i = 0; i < files.Count; i++)
     {
         string f = files[i] as string;
         try
         {
             string f_name = Path.GetFileName(f);
             string new_name = target_folder + "\\" + now.ToString().PadLeft((int)padding, '0') + "_" + f_name;
             File.Copy(f, new_name);
             pb_progress.PerformStep();
             now++;
         }
         catch (FileNotFoundException)
         {
             DialogResult d = MessageBox.Show("File " + f + " has not been found...", "Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error);
             if (d == System.Windows.Forms.DialogResult.Abort)
             {
                 break;
             }
             else if (d == System.Windows.Forms.DialogResult.Retry)
             {
                 i--;
             }
             else //Ignore
             {
                 pb_progress.PerformStep();
                 now++;
             }
         }
     }
     MessageBox.Show(i+" of "+files.Count + " Files have been copied.", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
     pb_progress.Value = 0;
 }
开发者ID:WebDaD,项目名称:M3UExporter,代码行数:39,代码来源:Form1.cs

示例5: PerformStep

        public static void PerformStep(ProgressBar progressBar)
        {
            MethodInvoker miPerformStep = delegate
            {
                progressBar.PerformStep();
            };

            if (progressBar.InvokeRequired)
            {
                progressBar.Invoke(miPerformStep);
            }
            else
            {
                miPerformStep();
            }
        }
开发者ID:NORENBUCH,项目名称:XrmToolBox,代码行数:16,代码来源:ProgressBarDelegates.cs

示例6: MakeProgressBar

        public static void MakeProgressBar(int min, int max, int initialvalue, int step)
        {
            //display the progress bar control
            ProgressBar bar = new ProgressBar();

            bar.Visible = true;

            //set minimum to 1 to to represent the first file being copied
            bar.Minimum = min;
            bar.Maximum = max;
            //initial value
            bar.Value = initialvalue;
            bar.Step = step;

            Console.CursorVisible = false;
            Console.ForegroundColor = ConsoleColor.Green;
            bar.PerformStep();
        }
开发者ID:payam49er,项目名称:experiments,代码行数:18,代码来源:Program.cs

示例7: calcAddressesSE

 //functions
 public static ArrayList calcAddressesSE(IPAddress start, IPAddress end, ProgressBar progress)
 {
     ArrayList addresses = new ArrayList();
     addresses.Add(start);
     if (start.Equals(end))return addresses;
     UInt32 h = 0;
     if (progress != null)
     {
         progress.Value = 0;
         progress.Maximum = (int)(convertIPtoUInt32(end) - convertIPtoUInt32(start));
         Log.WriteLog("Progressbar Maximum (clacAddressesSE): " + progress.Maximum);
     }
     while (!(start.Equals(end)))
     {
         h = convertIPtoUInt32(start);
         h++;
         if (progress != null) progress.PerformStep();
         start = IPAddress.Parse(Convert.ToString(h));
         addresses.Add(start);
     }
     return addresses;
 }
开发者ID:tiago-system13,项目名称:BP_LicenseAudit,代码行数:23,代码来源:ControllerNetwork.cs

示例8: bit8sin

        // ------------------------------------------------------------------------------------------------------ 8 bit Cуммирование
        public static void bit8sin(int k_8bit, Image[] img, PictureBox pictureBox01, ProgressBar progressBar1)
        {
            int k0 = 8 - k_8bit;

            Bitmap[] bmp_r = new Bitmap[8];
            for (int i = k0; i < 8; i++) { bmp_r[i] = new Bitmap(img[i], img[i].Width, img[i].Height); }
            int w1 = img[7].Width;
            int h1 = img[7].Height;
            Bitmap bmp2 = new Bitmap(w1, h1);

            Color  c;

            int[] cr = new int[h1];
            int[] cb = new int[h1];
            int[] cg = new int[h1];

            int[] cr1 = new int[h1];
            int[] cb1 = new int[h1];
            int[] cg1 = new int[h1];

            progressBar1.Visible = true;
            progressBar1.Minimum = 1;
            progressBar1.Maximum = w1;
            progressBar1.Value = 1;
            progressBar1.Step = 1;

            int kk;

            progressBar1.Value = 1;
            for (int i = 0; i < w1; i++)
            {
                for (int j = 0; j < h1; j++) { c = bmp2.GetPixel(i, j); cr[j] = c.R; cg[j] = c.G; cb[j] = c.B; }
                kk = k_8bit;
                for (int k = k0; k < 8; k++, kk--)
                {
                    for (int j = 0; j < h1; j++) { c = bmp_r[k].GetPixel(i, j); cr1[j] = c.R; cg1[j] = c.G; cb1[j] = c.B; }
                    for (int j = 0; j < h1; j++) { cr[j] += cr1[j] >> kk; cg[j] += cg1[j] >> kk; cb[j] += cb1[j] >> kk;   }
                 }
              for (int j = 0; j < h1; j++)
              { if (cr[j] > 255) cr[j] = 255; if (cg[j] > 255) cg[j] = 255; if (cb[j] > 255) cb[j] = 255;
                bmp2.SetPixel(i, j, Color.FromArgb(cr[j], cb[j], cg[j]));
              }
                progressBar1.PerformStep();
            }
            //Razmer(w1, h1);

            pictureBox01.Size = new System.Drawing.Size(w1, h1);
            pictureBox01.Image = bmp2;
        }
开发者ID:interferometry7,项目名称:interferometry,代码行数:50,代码来源:SinClass1.cs

示例9: SaveToDisk

		/// <summary>
		/// Saves a wz file to the disk, AKA repacking.
		/// </summary>
		/// <param name="path">Path to the output wz file</param>
        /// <param name="progressBar">Progressbar, optional. (Set to null if not in use)</param>
		public void SaveToDisk(string path, ProgressBar progressBar)
		{
            WzIv = WzTool.GetIvByMapleVersion(mapleVersion);
			CreateVersionHash();
			wzDir.SetHash(versionHash);
            if (progressBar != null) { progressBar.PerformStep(); progressBar.Refresh(); } //30%
			string tempFile = Path.GetFileNameWithoutExtension(path) + ".TEMP";
			File.Create(tempFile).Close();
			wzDir.GenerateDataFile(tempFile);
			WzTool.StringCache.Clear();
            if (progressBar != null) { progressBar.PerformStep(); progressBar.Refresh(); } //40%
			uint totalLen = wzDir.GetImgOffsets(wzDir.GetOffsets(Header.FStart + 2));
			WzBinaryWriter wzWriter = new WzBinaryWriter(File.Create(path), WzIv);
			wzWriter.Hash = (uint)versionHash;
			Header.FSize = totalLen - Header.FStart;
			for (int i = 0; i < 4; i++)
				wzWriter.Write((byte)Header.Ident[i]);
            if (progressBar != null) { progressBar.PerformStep(); progressBar.Refresh(); } //50%
			wzWriter.Write((long)Header.FSize);
			wzWriter.Write(Header.FStart);
			wzWriter.WriteNullTerminatedString(Header.Copyright);
            if (progressBar != null) { progressBar.PerformStep(); progressBar.Refresh(); } //60%
			long extraHeaderLength = Header.FStart - wzWriter.BaseStream.Position;
			if (extraHeaderLength > 0)
			{
				wzWriter.Write(new byte[(int)extraHeaderLength]);
			}
            if (progressBar != null) { progressBar.PerformStep(); progressBar.Refresh(); } //70%
			wzWriter.Write(version);
			wzWriter.Header = Header;
			wzDir.SaveDirectory(wzWriter);
			wzWriter.StringCache.Clear();
			FileStream fs = File.OpenRead(tempFile);
			wzDir.SaveImages(wzWriter, fs);
			fs.Close();
            if (progressBar != null) { progressBar.PerformStep(); progressBar.Refresh(); } //80%
			File.Delete(tempFile);
			wzWriter.StringCache.Clear();
			wzWriter.Close();
            if (progressBar != null) { progressBar.PerformStep(); progressBar.Refresh(); } //90%
            GC.Collect();
            GC.WaitForPendingFinalizers();
		}
开发者ID:ilvmoney,项目名称:hasuite-new,代码行数:48,代码来源:WzFile.cs

示例10: Z_bmp

        // -------------------------- Z -> BMP
        // -----------------------------------------------------------------------------------------------------------------------------------
        static void Z_bmp(ProgressBar progressBar1, Bitmap bmp, Int32[,] Z, int w, int h)
        {
            Int32 b2_min = Z[ 1,  1], b2_max = Z[ 1,  1];
            int b2;
            for (int i = 0; i < w; i++) for (int j = 0; j < h; j++) { b2_max = Math.Max(b2_max, Z[i, j]); b2_min = Math.Min(b2_min, Z[i, j]); }

            MessageBox.Show(" Max = " + b2_max.ToString() + " Min =  " + b2_min.ToString());
            b2_max = b2_max - b2_min;             if (b2_max == 0) return;
            progressBar1.Minimum = 1;
            progressBar1.Maximum = w;
            progressBar1.Value = 1;

            for (int i = 0; i < w; i++)                                                                   //  Отображение точек на pictureBox01
            {
                for (int j = 0; j < h; j++)
                {
                    b2 = (Z[i, j] - b2_min) * 255 / b2_max;
                    if (b2 < 0 || b2 > 255) b2 = 0;
                    bmp.SetPixel(i, j, Color.FromArgb(b2, b2, b2));

                }
             progressBar1.PerformStep();
            }
        }
开发者ID:interferometry7,项目名称:interferometry,代码行数:26,代码来源:Pi_Class1.cs

示例11: ResetProgressBar

 /// <summary>
 /// Reset progress bar.
 /// </summary>
 /// <param name="control"></param>
 public static void ResetProgressBar(ProgressBar control)
 {
     if (control.InvokeRequired)
     {
         control.Invoke((System.Action)(() =>
         {
             control.PerformStep();
         }));
     }
     else
     {
         control.PerformStep();
     }
 }
开发者ID:gcorthey,项目名称:CrossThreadLib,代码行数:18,代码来源:Class1.cs

示例12: ExtractMessage

 public static int ExtractMessage(Bitmap bitmap, out MemoryStream messageStream, ProgressBar progressBar)
 {
     //Read the length of the file
     Color pixel = bitmap.GetPixel(0, 0);
     int fileLength = (pixel.R << 16) + (pixel.G << 8) + pixel.B;
     //Check if file length is within the allowed range
     if (fileLength >= (16777216)/8)
     {
         MessageBox.Show("You've chosen the wrong image, it does not contain file gidden with this software",
             "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         messageStream = new MemoryStream();
         return 0;
     }
     //Check if file length is not bigger than the number of pixels
     if (fileLength >= 3 * (bitmap.Size.Height * bitmap.Size.Width - 1))
     {
         MessageBox.Show("Your image can not contain file encrypted with this application",
             "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         messageStream = new MemoryStream();
         return 0;
     }
     //Set maximum value of progress bar
     progressBar.Maximum = fileLength;
     //Initialize memory stream
     messageStream = new MemoryStream(fileLength);
     //initialize x and y coordinates of pixel
     int x = 1;
     int y = 0;
     int val = 0; //0 - R, 1 - G, 2 - B
     byte message = (byte)0; //bits will be stored in this variable
     //initialize mask to get the value of the last bit in the pixel
     byte mask = (byte)Convert.ToInt32("00000001", 2);
     pixel = bitmap.GetPixel(x, y); //get next pixel in the image
     for (int i = 0; i < fileLength; i++) //loop through the image until all bytes are read
     {
         for (int j = 0; j < 8; j++) //get the next byte
         {
             switch (val)//read R - 0, G - 1, or B - 2 channel of a pixel
             {
                 case 0:
                     message = (byte)(message | ((pixel.R & mask) << j));
                     val++;
                     break;
                 case 1:
                     message = (byte)(message | ((pixel.G & mask) << j));
                     val++;
                     break;
                 case 2:
                     message = (byte)(message | ((pixel.B & mask) << j));
                     updateXY(ref x, ref y, bitmap);
                     pixel = bitmap.GetPixel(x, y);
                     val = 0;
                     break;
             }
         }
         //Write byte to the stream
         messageStream.WriteByte(message);
         //reset byte
         message = (byte)0;
         //update progress bar
         progressBar.PerformStep();
     }
     return 1;
 }
开发者ID:rums,项目名称:bdm-steg,代码行数:64,代码来源:Stegonography.cs

示例13: GoldenCrown

        /// <summary>
        /// Этот метод выполняет обработку файла золотой короны.
        /// </summary>
        /// <param name="workbookPath">Путь к файлу.</param>
        /// <param name="progress">Прогресбар.</param>
        /// <returns>Возвращает сумму за текущий час в строковом формате с запятой.</returns>
        public static double GoldenCrown(string workbookPath, ProgressBar progress)
        {
            double sum = 0;
            progress.Value = 0;
            progress.Step = 30;
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
            NumberStyles styles;
            styles = NumberStyles.AllowParentheses | NumberStyles.AllowTrailingSign | NumberStyles.Float | NumberStyles.AllowThousands;
            progress.PerformStep();

            Excel.Workbook excelWorkbook = excelApp.Workbooks.Open(workbookPath, 0, false, 5, "", "", false,
                Excel.XlPlatform.xlWindows, "", true, false, 0, true, false, false);
            progress.PerformStep();
            Excel.Sheets excelSheets = excelWorkbook.Worksheets;
            try {
                Excel.Worksheet excelWorksheet = (Excel.Worksheet)excelSheets.get_Item("pcards");
                progress.PerformStep();
                Array myvalues1;
                Array myvalues2;
                Array myvalues3;
                Excel.Range rng = excelWorksheet.Range["A3:AA25000", Type.Missing];
                progress.PerformStep();
                object cols = new object[] { 15 };
                rng.RemoveDuplicates(cols, Excel.XlYesNoGuess.xlYes);
                Excel.Range rangeNom = excelWorksheet.get_Range("S3", "S25000".ToString());
                Excel.Range rangeStat = excelWorksheet.get_Range("W3", "W25000".ToString());
                Excel.Range rangeProd = excelWorksheet.get_Range("AA3", "AA25000".ToString());
                progress.PerformStep();
                myvalues1 = (Array)rangeNom.Cells.Value;
                myvalues2 = (Array)rangeStat.Cells.Value;
                myvalues3 = (Array)rangeProd.Cells.Value;
                double total = 0;
                progress.PerformStep();
                for (int i = 1; i <= myvalues1.Length; i++)
                {
                    if (myvalues1.GetValue(i, 1) != null) {

                        if ((myvalues2.GetValue(i, 1).ToString() == "Готов к выдаче" | myvalues2.GetValue(i, 1).ToString() == "Выдан"
                            | myvalues2.GetValue(i, 1).ToString() == "Запрошен для выдачи") & (myvalues3.GetValue(i,1).ToString() != "Погашение"))
                        {
                            total += Double.Parse((myvalues1.GetValue(i, 1).ToString()).Replace(" ", ""), styles);
                        }
                    }
                }
                sum = (Math.Round(total, 2));
                excelWorkbook.Close(false);
                progress.PerformStep();
                return sum;
            }
            catch
            {
                excelWorkbook.Close(false);
                progress.Value = 0;
                return sum;
            }
        }
开发者ID:DenisMikheev,项目名称:AutoSverKa-v2.x.x.x,代码行数:62,代码来源:DataProcessing.cs

示例14: WriteBinary

        internal static void WriteBinary(string tempFile, string outFile, RichTextBox TB_Progress = null, ProgressBar PB_Show = null)
        {
            using (FileStream fs = new FileStream(outFile, FileMode.Create))
            {
                using (BinaryWriter writer = new BinaryWriter(fs))
                {
                    using (FileStream fileStream = new FileStream(tempFile, FileMode.Open, FileAccess.Read))
                    {
                        const uint BUFFER_SIZE = 0x400000; // 4MB Buffer

                        if (PB_Show.InvokeRequired)
                            PB_Show.Invoke((MethodInvoker)delegate { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = (int)(fileStream.Length / BUFFER_SIZE); });
                        else { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = (int)(fileStream.Length / BUFFER_SIZE); }

                        byte[] buffer = new byte[BUFFER_SIZE];
                        while (true)
                        {
                            int count = fileStream.Read(buffer, 0, buffer.Length);
                            if (count != 0)
                            {
                                writer.Write(buffer, 0, count);
                                if (PB_Show.InvokeRequired)
                                    PB_Show.Invoke((MethodInvoker)delegate { PB_Show.PerformStep(); });
                                else { PB_Show.PerformStep(); }
                            }
                            else
                                break;
                        }
                    }
                    writer.Flush();
                }
            }
            File.Delete(TempFile);
            updateTB(TB_Progress, "Wrote RomFS to path:" + Environment.NewLine + outFile);
        }
开发者ID:evandixon,项目名称:3DS-Builder,代码行数:35,代码来源:RomFS.cs

示例15: Styles

		public void Styles ()
		{
			ProgressBar c = new ProgressBar ();
			//--
			Assert.AreEqual(ProgressBarStyle.Blocks, c.Style, "orig=blocks");
			//--
			c.Style = ProgressBarStyle.Continuous;
			//--
			c.Style = ProgressBarStyle.Marquee;
			// Increment and PerformStep are documented to fail in Marquee style.
			try {
				c.Increment (5);
				Assert.Fail ("should have thrown -- Increment");
			} catch (InvalidOperationException) {
			}
			try {
				c.PerformStep ();
				Assert.Fail ("should have thrown -- PerformStep ");
			} catch (InvalidOperationException) {
			}
			// What about the other value-related properties?  No fail apparently!
			c.Value = 20;
			c.Minimum = 5;
			c.Maximum = 95;
			//--
			// Now undefined style values...
			try {
				c.Style = (ProgressBarStyle)4;
				Assert.Fail("should have thrown -- bad style4");
			} catch (global::System.ComponentModel.InvalidEnumArgumentException ex) {
				//Console.WriteLine(ex.Message);
				Assert.AreEqual(typeof(global::System.ComponentModel.InvalidEnumArgumentException), ex.GetType (), "Typeof bad style4");
				Assert.AreEqual("value", ex.ParamName, "ParamName bad style 4");
			}
			try {
				c.Style = (ProgressBarStyle)99;
				Assert.Fail("should have thrown -- bad style99");
			} catch (global::System.ComponentModel.InvalidEnumArgumentException ex) {
				Assert.AreEqual (typeof(global::System.ComponentModel.InvalidEnumArgumentException), ex.GetType (), "Typeof bad style99");
				Assert.AreEqual ("value", ex.ParamName, "ParamName bad style 99");
			}
		}
开发者ID:Profit0004,项目名称:mono,代码行数:42,代码来源:ProgressBarTest.cs


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