System.Windows.Forms.Application.DoEvents()

Here are the examples of the csharp api System.Windows.Forms.Application.DoEvents() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

795 Examples 7

19 View Source File : CollectionBase.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void RemoveAt(int Index)
        {
            List.RemoveAt(Index);
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : ControlCollection.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void Remove(Control p1)
        {
            M_ControlCollection.Remove(p1.M_Control);
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : GridTableStylesCollection.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public int Add(osf.DataGridTableStyle p1)
        {
            int res = Convert.ToInt32(M_GridTableStylesCollection.Add((System.Windows.Forms.DataGridTableStyle)p1.M_DataGridTableStyle));
            System.Windows.Forms.Application.DoEvents();
            return res;
        }

19 View Source File : TextBoxBase.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void SelectAll()
        {
            M_TextBoxBase.SelectAll();
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : HashTable.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void Set(object key, object value)
        {
            M_HashTable[key] = value;
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : Graphics.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void DrawString(string str, osf.Font font, osf.Brush brush, float x, float y)
        {
            M_Graphics.DrawString(str, font.M_Font, (System.Drawing.Brush)brush.M_Brush, x, y);
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : Control.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void ResetBackgroundImage()
        {
            M_Control.BackgroundImage = null;
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : TreeNodeCollection.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public new osf.TreeNode Add(object p1)
        {
            if (p1 is TreeNode)
            {
                M_TreeNodeCollection.Add((System.Windows.Forms.TreeNode)((TreeNode)p1).M_TreeNode);
                System.Windows.Forms.Application.DoEvents();
                return (TreeNode)p1;
            }
            TreeNode TreeNode1 = new TreeNode();
            TreeNode1.Text = Convert.ToString(p1);
            M_TreeNodeCollection.Add((System.Windows.Forms.TreeNode)((TreeNode)TreeNode1).M_TreeNode);
            System.Windows.Forms.Application.DoEvents();
            return TreeNode1;
        }

19 View Source File : DataColumnCollection.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public osf.DataColumn Add(osf.DataColumn p1)
        {
            M_DataColumnCollection.Add(p1.M_DataColumn);
            System.Windows.Forms.Application.DoEvents();
            return p1;
        }

19 View Source File : DataTableCollection.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void Remove(object p1)
        {
            if (p1 is DataTable)
            {
                M_DataTableCollection.Remove(((DataTable)p1).M_DataTable);
            }
            else
            {
                M_DataTableCollection.Remove(Convert.ToString(p1));
            }
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : TextBoxBase.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void Paste()
        {
            M_TextBoxBase.Paste();
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : TabPageCollection.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public osf.TabPage Insert(int index, object page)
        {
            if (page is TabPage)
            {
                M_TabPageCollection.Insert(index, ((dynamic)page).M_TabPage);
                System.Windows.Forms.Application.DoEvents();
                return (TabPage)page;
            }
            if (!(page is string))
            {
                return null;
            }
            TabPage TabPage1 = new TabPage((string)null);
            TabPage1.Text = Convert.ToString(page);
            M_TabPageCollection.Insert(index, (System.Windows.Forms.TabPage)TabPage1.M_TabPage);
            return TabPage1;
        }

19 View Source File : Graphics.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void DrawLine(osf.Pen pen, float x1, float y1, float x2, float y2)
        {
            M_Graphics.DrawLine(pen.M_Pen, x1, y1, x2, y2);
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : Application.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void EnableVisualStyles()
        {
            System.Windows.Forms.Application.EnableVisualStyles();
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : ListViewItem.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void Remove()
        {
            M_ListViewItem.Remove();
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : ComboBoxObjectCollection.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public new object Insert(int index, object item)
        {
            M_ComboBoxObjectCollection.Insert(index, item);
            System.Windows.Forms.Application.DoEvents();
            return item;
        }

19 View Source File : Graphics.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public osf.Graphics FromImage(osf.Image p1)
        {
            Graphics Graphics1 = new Graphics(System.Drawing.Graphics.FromImage(p1.M_Image));
            System.Windows.Forms.Application.DoEvents();
            return Graphics1;
        }

19 View Source File : Control.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public virtual void BeginUpdate()
        {
            SendMessage(M_Control.Handle, 11, 0, 0);
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : TreeNode.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void BeginEdit()
        {
            M_TreeNode.BeginEdit();
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : ControlCollection.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

[ContextMethod("Добавить", "Add")]
        public IValue Add(IValue p1)
        {
            Base_obj.Add(((dynamic)p1).Base_obj);
            System.Windows.Forms.Application.DoEvents();
            return p1;
        }

19 View Source File : HashTable.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void Clear()
        {
            M_HashTable.Clear();
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : HashTable.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void Remove(object key)
        {
            M_HashTable.Remove(key);
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : ListViewColumnHeaderCollection.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public new osf.ColumnHeader Add(object column = null)
        {
            if (column is ColumnHeader)
            {
                M_ColumnHeaderCollection.Add((ColumnHeaderEx)((ColumnHeader)column).M_ColumnHeader);
                System.Windows.Forms.Application.DoEvents();
                return (ColumnHeader)column;
            }
            ColumnHeader ColumnHeader1 = new ColumnHeader();
            if (column is string)
            {
                ColumnHeader1.Text = Convert.ToString(column);
            }
            M_ColumnHeaderCollection.Add((ColumnHeaderEx)ColumnHeader1.M_ColumnHeader);
            System.Windows.Forms.Application.DoEvents();
            return ColumnHeader1;
        }

19 View Source File : MenuItemCollection.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public osf.MenuItem Add(MenuItem item)
        {
            MenuItem menuItem;
            if (item is MenuItem)
            {
                menuItem = item;
            }
            else
            {
                menuItem = new MenuItem();
            }
            M_MenuItemCollection.Add(menuItem.M_MenuItem);
            System.Windows.Forms.Application.DoEvents();
            return menuItem;
        }

19 View Source File : Graphics.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void Clear(Color p1)
        {
            M_Graphics.Clear(p1.M_Color);
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : TextBoxBase.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void Cut()
        {
            M_TextBoxBase.Cut();
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : TextBoxBase.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void AppendText(string text)
        {
            M_TextBoxBase.AppendText(text);
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : Graphics.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void DrawImage(osf.Image image, float dx, float dy, float dw, float dh, float sx = 0.0f, float sy = 0.0f, float sw = -1f, float sh = -1f)
        {
            System.Drawing.Rectangle Rectangle1 = new System.Drawing.Rectangle();
            Rectangle1.X = (int)System.Math.Round((double)dx);
            Rectangle1.Y = (int)System.Math.Round((double)dy);
            Rectangle1.Width = (int)System.Math.Round((double)dw);
            Rectangle1.Height = (int)System.Math.Round((double)dh);
            if ((double)sw == -1.0)
            {
                sw = (float)image.Width;
            }
            if ((double)sh == -1.0)
            {
                sh = (float)image.Height;
            }
            M_Graphics.DrawImage(image.M_Image, Rectangle1, sx, sy, sw, sh, System.Drawing.GraphicsUnit.Pixel);
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : TextBoxBase.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void ScrollToCaret()
        {
            M_TextBoxBase.ScrollToCaret();
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : ListViewItem.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void EnsureVisible()
        {
            M_ListViewItem.EnsureVisible();
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : TextBoxBase.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void Undo()
        {
            M_TextBoxBase.Undo();
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : Graphics.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void DrawRectangle(osf.Pen pen, float x, float y, float width, float height)
        {
            M_Graphics.DrawRectangle(pen.M_Pen, x, y, width, height);
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : ArrayList.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public object Add(object value)
        {
            M_ArrayList.Add(value);
            System.Windows.Forms.Application.DoEvents();
            return value;
        }

19 View Source File : ListViewItemCollection.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void Remove(ListViewItem item)
        {
            M_ListViewItemCollection.Remove((System.Windows.Forms.ListViewItem)item.M_ListViewItem);
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : ComboBoxObjectCollection.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public new object Add(object item)
        {
            M_ComboBoxObjectCollection.Add(item);
            System.Windows.Forms.Application.DoEvents();
            return item;
        }

19 View Source File : Graphics.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void FillRectangle(osf.Brush brush, float x, float y, float width, float height)
        {
            M_Graphics.FillRectangle((System.Drawing.Brush)brush.M_Brush, x, y, width, height);
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : ComboBoxObjectCollection.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public new void Remove(object item)
        {
            M_ComboBoxObjectCollection.Remove(item);
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : ListViewSubItemCollection.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public new osf.ListViewSubItem Add(object item)
        {
            if (item is ListViewSubItem)
            {
                M_ListViewSubItemCollection.Add((((ListViewSubItem)item).M_ListViewSubItem));
                System.Windows.Forms.Application.DoEvents();
                return (ListViewSubItem)item;
            }
            ListViewSubItem ListViewSubItem1 = new ListViewSubItem("");
            ListViewSubItem1.Text = Convert.ToString(item);
            M_ListViewSubItemCollection.Add(ListViewSubItem1.M_ListViewSubItem);
            System.Windows.Forms.Application.DoEvents();
            return (ListViewSubItem)ListViewSubItem1;
        }

19 View Source File : Control.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public virtual void EndUpdate()
        {
            SendMessage(M_Control.Handle, 11, -1, 0);
            M_Control.Invalidate();
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : GridColumnStylesCollection.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public int Add(osf.DataGridColumnStyle p1)
        {
            int res = Convert.ToInt32(M_GridColumnStylesCollection.Add((System.Windows.Forms.DataGridColumnStyle)p1.M_DataGridColumnStyle));
            System.Windows.Forms.Application.DoEvents();
            return res;
        }

19 View Source File : ControlCollection.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public osf.Button AddButton(string text = null, int left = 0, int top = 0, int width = 0, int height = 0)
        {
            Button Button1 = new Button();
            Button1.Text = text;
            Button1.Left = left;
            Button1.Top = top;
            Button1.Width = width;
            Button1.Height = height;
            M_ControlCollection.Add((System.Windows.Forms.Control)Button1.M_Button);
            System.Windows.Forms.Application.DoEvents();
            return Button1;
        }

19 View Source File : Map.cs
License : GNU General Public License v3.0
Project Creator : AHeroicLlama

public static void Draw()
		{
			// Reset the current image to the background layer
			finalImage = (Image)backgroundLayer.Clone();

			Graphics imageGraphic = Graphics.FromImage(finalImage);
			imageGraphic.SmoothingMode = SmoothingMode.AntiAlias;
			Font font = new Font(fontCollection.Families[0], fontSize, GraphicsUnit.Pixel);

			CellScaling cellScaling = null;

			// Prepare the game version and watermark to be printed later
			string infoText = (SettingsPlot.IsTopographic() ? "Topographic View\n" : string.Empty) + "Game version " + IOManager.GetGameVersion() + "\nMade with Mappalachia - github.com/AHeroicLlama/Mappalachia";

			// Additional steps for cell mode (Add further text to watermark text, get cell height boundings)
			if (SettingsMap.IsCellModeActive())
			{
				Cell currentCell = SettingsCell.GetCell();

				// replacedign the CellScaling property
				cellScaling = currentCell.GetScaling();

				infoText =
					currentCell.displayName + " (" + currentCell.editorID + ")\n" +
					"Height distribution: " + SettingsCell.minHeightPerc + "% - " + SettingsCell.maxHeightPerc + "%\n" +
					"Scale: 1:" + Math.Round(cellScaling.scale, 2) + "\n\n" +
					infoText;
			}

			// Gather resources for drawing informational watermark text
			Brush brushWhite = new SolidBrush(Color.White);
			RectangleF infoTextBounds = new RectangleF(plotXMin, 0, mapDimension - plotXMin, mapDimension);
			StringFormat stringFormatBottomRight = new StringFormat() { Alignment = StringAlignment.Far, LineAlignment = StringAlignment.Far }; // Align the text bottom-right
			StringFormat stringFormatBottomLeft = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Far }; // Align the text bottom-left

			// Draws bottom-right info text
			imageGraphic.DrawString(infoText, font, brushWhite, infoTextBounds, stringFormatBottomRight);

			// Draw a height-color key for Topography mode
			if (SettingsPlot.IsTopographic())
			{
				// Identify the sizing and locations for drawing the height-color-key strings
				double numHeightKeys = SettingsPlotTopograph.heightKeyIndicators;
				Font topographFont = new Font(fontCollection.Families[0], 62, GraphicsUnit.Pixel);
				float singleLineHeight = imageGraphic.MeasureString(SettingsPlotTopograph.heightKeyString, topographFont, new SizeF(infoTextBounds.Width, infoTextBounds.Height)).Height;

				// Identify the lower limit to start printing the key so that it ends up centered
				double baseHeight = (mapDimension / 2) - (singleLineHeight * (numHeightKeys / 2d));

				for (int i = 0; i <= numHeightKeys - 1; i++)
				{
					Brush brush = new SolidBrush(GetTopographColor(i / (numHeightKeys - 1)));
					imageGraphic.DrawString(SettingsPlotTopograph.heightKeyString, topographFont, brush, new RectangleF(plotXMax, 0, mapDimension - plotXMax, (float)(mapDimension - baseHeight)), stringFormatBottomRight);
					baseHeight += singleLineHeight;
				}
			}

			// Draw all legend text for every MapItem
			int skippedLegends = DrawLegend(font, imageGraphic);

			// Adds additional text if some items were missed from legend
			if (skippedLegends > 0)
			{
				string extraLegendText = "+" + skippedLegends + " more item" + (skippedLegends == 1 ? string.Empty : "s") + "...";
				imageGraphic.DrawString(extraLegendText, font, brushWhite, infoTextBounds, stringFormatBottomLeft);
			}

			// Start progress bar off at 0
			progressBarMain.Value = progressBarMain.Minimum;
			float progress = 0;

			// Nothing else to plot - ensure we update for the background layer but then return
			if (FormMaster.legendItems.Count == 0)
			{
				mapFrame.Image = finalImage;
				return;
			}

			// Count how many Map Data Points are due to be mapped
			int totalMapDataPoints = 0;
			foreach (MapItem mapItem in FormMaster.legendItems)
			{
				totalMapDataPoints += mapItem.count;
			}

			// Loop through every MapDataPoint represented by all the MapItems to find the min/max z coord in the dataset
			bool first = true;
			int zMin = 0;
			int zMax = 0;
			double zRange = 0;
			if (SettingsPlot.IsTopographic())
			{
				foreach (MapItem mapItem in FormMaster.legendItems)
				{
					foreach (MapDataPoint point in mapItem.GetPlots())
					{
						if (first)
						{
							zMin = point.z - (point.boundZ / 2);
							zMax = point.z + (point.boundZ / 2);
							first = false;
							continue;
						}

						// Do not contribute outlier values to the min/max range - this ensures they have the same
						// color as the min/max *legitimate* item and they do not skew the color ranges
						if (point.z > SettingsPlotTopograph.zThreshUpper || point.z < SettingsPlotTopograph.zThreshLower)
						{
							continue;
						}

						if (point.z - (point.boundZ / 2) < zMin)
						{
							zMin = point.z - (point.boundZ / 2);
						}

						if (point.z + (point.boundZ / 2) > zMax)
						{
							zMax = point.z + (point.boundZ / 2);
						}
					}
				}

				zRange = Math.Abs(zMax - zMin);

				if (zRange == 0)
				{
					zRange = 1;
				}
			}

			if (SettingsPlot.IsIconOrTopographic())
			{
				if (SettingsPlot.IsTopographic())
				{
					// Somehow this line prevents a memory leak
					// Without it, if drawing a large topographic map on first map draw, GC will not collect the multiple PlotIcon elements used in topographic drawing.
					Application.DoEvents();
				}

				// Processing each MapItem in serial, draw plots for every matching valid MapDataPoint
				foreach (MapItem mapItem in FormMaster.legendItems)
				{
					// Generate a Plot Icon and colours/brushes to be used for all instances of the MapItem
					PlotIcon plotIcon = mapItem.GetIcon();
					Image plotIconImg = SettingsPlot.IsIcon() ? plotIcon.GetIconImage() : null; // Icon mode has icon per MapItem, Topography needs icons per MapDataPoint and will be generated later
					Color volumeColor = Color.FromArgb(volumeOpacity, plotIcon.color);
					Brush volumeBrush = new SolidBrush(volumeColor);

					// Iterate over every data point and draw it
					foreach (MapDataPoint point in mapItem.GetPlots())
					{
						// Override colors in Topographic mode
						if (SettingsPlot.IsTopographic())
						{
							// Clamp the z values to the percieved outlier threshold
							double z = point.z + (point.boundZ / 2);
							z = Math.Max(Math.Min(z, SettingsPlotTopograph.zThreshUpper), SettingsPlotTopograph.zThreshLower);

							// Normalize the height of this item between the min/max z of the whole set
							double colorValue = (z - zMin) / zRange;

							// Override the plot icon color
							plotIcon.color = GetTopographColor(colorValue);
							plotIconImg = plotIcon.GetIconImage(); // Generate a new icon with a unique color for this height color

							// Apply the color to volume plotting too
							volumeColor = Color.FromArgb(volumeOpacity, plotIcon.color);
							volumeBrush = new SolidBrush(volumeColor);
						}

						if (SettingsMap.IsCellModeActive())
						{
							// If this coordinate exceeds the user-selected cell mapping height bounds, skip it
							// (Also accounts for the z-height of volumes)
							if (point.z + (point.boundZ / 2d) < SettingsCell.GetMinHeightCoordBound() || point.z - (point.boundZ / 2d) > SettingsCell.GetMaxHeightCoordBound())
							{
								continue;
							}

							point.x += cellScaling.xOffset;
							point.y += cellScaling.yOffset;

							// Multiply the coordinates by the scaling, but multiply around 0,0
							point.x = ((point.x - (mapDimension / 2)) * cellScaling.scale) + (mapDimension / 2);
							point.y = ((point.y - (mapDimension / 2)) * cellScaling.scale) + (mapDimension / 2);
							point.boundX *= cellScaling.scale;
							point.boundY *= cellScaling.scale;
						}
						else // Skip the point if its origin is outside the surface world
						if (point.x < plotXMin || point.x >= plotXMax || point.y < plotYMin || point.y >= plotYMax)
						{
							continue;
						}

						// If this meets all the criteria to be suitable to be drawn as a volume
						if (point.primitiveShape != string.Empty && // This is a primitive shape at all
							SettingsPlot.drawVolumes && // Volume drawing is enabled
							point.boundX >= minVolumeDimension && point.boundY >= minVolumeDimension) // This is large enough to be visible if drawn as a volume
						{
							Image volumeImage = new Bitmap((int)point.boundX, (int)point.boundY);
							Graphics volumeGraphic = Graphics.FromImage(volumeImage);
							volumeGraphic.SmoothingMode = SmoothingMode.AntiAlias;

							switch (point.primitiveShape)
							{
								case "Box":
								case "Line":
								case "Plane":
									volumeGraphic.FillRectangle(volumeBrush, new Rectangle(0, 0, (int)point.boundX, (int)point.boundY));
									break;
								case "Sphere":
								case "Ellipsoid":
									volumeGraphic.FillEllipse(volumeBrush, new Rectangle(0, 0, (int)point.boundX, (int)point.boundY));
									break;
								default:
									continue; // If we reach this, we dropped the drawing of a volume. Verify we've covered all shapes via the database summary.txt
							}

							volumeImage = ImageTools.RotateImage(volumeImage, point.rotationZ);
							imageGraphic.DrawImage(volumeImage, (float)(point.x - (volumeImage.Width / 2)), (float)(point.y - (volumeImage.Height / 2)));
						}

						// This MapDataPoint is not suitable to be drawn as a volume - draw a normal plot icon, or topographic plot
						else
						{
							imageGraphic.DrawImage(plotIconImg, (float)(point.x - (plotIconImg.Width / 2d)), (float)(point.y - (plotIconImg.Height / 2d)));
						}
					}

					// Increment the progress bar per MapItem
					progress += mapItem.count;
					progressBarMain.Value = (int)((progress / totalMapDataPoints) * progressBarMain.Maximum);
					Application.DoEvents();
				}
			}
			else if (SettingsPlot.IsHeatmap())
			{
				int resolution = SettingsPlotHeatmap.resolution;
				int blendRange = SettingsPlotHeatmap.blendDistance;

				// Create a 2D Array of HeatMapGridSquare
				HeatMapGridSquare[,] squares = new HeatMapGridSquare[resolution, resolution];
				for (int x = 0; x < resolution; x++)
				{
					for (int y = 0; y < resolution; y++)
					{
						squares[x, y] = new HeatMapGridSquare();
					}
				}

				int pixelsPerSquare = mapDimension / resolution;

				foreach (MapItem mapItem in FormMaster.legendItems)
				{
					int heatmapLegendGroup = SettingsPlotHeatmap.IsDuo() ? mapItem.legendGroup % 2 : 0;

					foreach (MapDataPoint point in mapItem.GetPlots())
					{
						if (SettingsMap.IsCellModeActive())
						{
							point.x += cellScaling.xOffset;
							point.y += cellScaling.yOffset;

							point.x = ((point.x - (mapDimension / 2)) * cellScaling.scale) + (mapDimension / 2);
							point.y = ((point.y - (mapDimension / 2)) * cellScaling.scale) + (mapDimension / 2);
						}

						// Identify which grid square this MapDataPoint falls within
						int squareX = (int)Math.Floor(point.x / pixelsPerSquare);
						int squareY = (int)Math.Floor(point.y / pixelsPerSquare);

						// Loop over every grid square within range, and increment by the weight proportional to the distance
						for (int x = squareX - blendRange; x < squareX + blendRange; x++)
						{
							for (int y = squareY - blendRange; y < squareY + blendRange; y++)
							{
								// Don't try to target squares which would lay outside of the grid
								if (x < 0 || x >= resolution || y < 0 || y >= resolution)
								{
									continue;
								}

								// Pythagoras on the x and y dist gives us the 'as the crow flies' distance between the squares
								double distance = Pythagoras(squareX - x, squareY - y);

								// Weight and hence brightness is modified by 1/x^2 + 1 where x is the distance from actual item
								double additionalWeight = point.weight * (1d / ((distance * distance) + 1));
								squares[x, y].weights[heatmapLegendGroup] += additionalWeight;
							}
						}
					}

					// Increment the progress bar per MapItem
					progress += mapItem.count;
					progressBarMain.Value = (int)((progress / totalMapDataPoints) * progressBarMain.Maximum);
					Application.DoEvents();
				}

				// Find the largest weight value of all squares
				double largestWeight = 0;
				for (int x = 0; x < resolution; x++)
				{
					for (int y = 0; y < resolution; y++)
					{
						double weight = squares[x, y].GetTotalWeight();
						if (weight > largestWeight)
						{
							largestWeight = weight;
						}
					}
				}

				// Finally now weights are calculated, draw a square for every HeatGripMapSquare in the array
				for (int x = 0; x < resolution; x++)
				{
					int xCoord = x * pixelsPerSquare;

					// Don't draw grid squares which are entirely within the legend text area
					if (xCoord + pixelsPerSquare < plotXMin)
					{
						continue;
					}

					for (int y = 0; y < resolution; y++)
					{
						int yCoord = y * pixelsPerSquare;

						Color color = squares[x, y].GetColor(largestWeight);
						Brush brush = new SolidBrush(color);

						Rectangle heatMapSquare = new Rectangle(xCoord, yCoord, mapDimension / SettingsPlotHeatmap.resolution, mapDimension / SettingsPlotHeatmap.resolution);
						imageGraphic.FillRectangle(brush, heatMapSquare);
					}
				}
			}

			mapFrame.Image = finalImage;
		}

19 View Source File : ControlCollection.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void SetChildIndex(Control p1, int p2)
        {
            M_ControlCollection.SetChildIndex(p1.M_Control, p2);
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : HashTable.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void Add(object key, object value)
        {
            M_HashTable.Add(key, value);
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : DataRowView.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void Sereplacedem(object index, object item)
        {
            if (index is string)
            {
                M_DataRowView[(string)index] = item;
            }
            else
            {
                M_DataRowView[(int)index] = item;
            }
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : ClientKcp.cs
License : MIT License
Project Creator : a11s

private void button_pingpong_loop_Click(object sender, EventArgs e)
        {
            sw = new System.Diagnostics.Stopwatch();
            datebin = BitConverter.GetBytes(DateTime.Now.ToBinary());
            sw.Start();
            lastprinttime = DateTime.Now.AddSeconds(1);
            counter = 1;
            while (true)
            {
                if (client.WaitSend > 1000)
                {
                    Application.DoEvents();
                }
                else
                {

                    client.SendOperationRequest(datebin);
                    //if (withflush)
                    //{
                    //    client.KcpFlush();
                    //}
                }

            }
        }

19 View Source File : ListViewItemCollection.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public new osf.ListViewItem Add(object item)
        {
            if (item is ListViewItem)
            {
                M_ListViewItemCollection.Add((ListViewItemEx)((ListViewItem)item).M_ListViewItem);
                System.Windows.Forms.Application.DoEvents();
                return (ListViewItem)item;
            }
            ListViewItem ListViewItem1 = new ListViewItem("", -1);
            ListViewItem1.Text = Convert.ToString(item);
            M_ListViewItemCollection.Add((ListViewItemEx)ListViewItem1.M_ListViewItem);
            System.Windows.Forms.Application.DoEvents();
            return (ListViewItem)ListViewItem1;
        }

19 View Source File : ListViewItem.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void BeginEdit()
        {
            M_ListViewItem.BeginEdit();
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : Graphics.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void DrawEllipse(osf.Pen pen, float x, float y, float width, float height)
        {
            M_Graphics.DrawEllipse(pen.M_Pen, x, y, width, height);
            System.Windows.Forms.Application.DoEvents();
        }

19 View Source File : TextBoxBase.cs
License : Mozilla Public License 2.0
Project Creator : ahyahy

public void Copy()
        {
            M_TextBoxBase.Copy();
            System.Windows.Forms.Application.DoEvents();
        }

See More Examples