System.Drawing.Rectangle.Round(System.Drawing.RectangleF)

Here are the examples of the csharp api class System.Drawing.Rectangle.Round(System.Drawing.RectangleF) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

75 Examples 7

1. Example

Project: VisualPlus
Source File: RectangleExtension.cs
public static Rectangle ToRectangle(this RectangleF rectangleF)
        {
            return Rectangle.Round(rectangleF);
        }

2. Example

Project: TDMaker
Source File: ZedGraphControl.Events.cs
private Rectangle CalcScreenRect( Point mousePt1, Point mousePt2 )
		{
			Point screenPt = PointToScreen( mousePt1 );
			Size size = new Size( mousePt2.X - mousePt1.X, mousePt2.Y - mousePt1.Y );
			Rectangle rect = new Rectangle( screenPt, size );

			if ( _isZooming )
			{
				Rectangle chartRect = Rectangle.Round( _dragPane.Chart._rect );

				Point chartPt = PointToScreen( chartRect.Location );

				if ( !_isEnableVZoom )
				{
					rect.Y = chartPt.Y;
					rect.Height = chartRect.Height + 1;
				}
				else if ( !_isEnableHZoom )
				{
					rect.X = chartPt.X;
					rect.Width = chartRect.Width + 1;
				}
			}

			return rect;
		}

3. Example

Project: ss13remake
Source File: Hotbar.cs
public override sealed void Update(float frameTime)
        {
            hotbarBG.Position = Position;

            int y_dist = 30;
            int x_pos = 175;

            int max_x = 0;
            int max_y = 0;

            foreach (GuiComponent comp in slots)
            {
                comp.Position = new Point(Position.X + x_pos, Position.Y + y_dist);
                comp.Update(frameTime);
                if (comp.ClientArea.Right > max_x) max_x = comp.ClientArea.Right;
                if (comp.ClientArea.Bottom > max_y) max_y = comp.ClientArea.Bottom;
                x_pos += comp.ClientArea.Width + 1;
            }

            //ClientArea = new Rectangle(Position, new Size((int)max_x - Position.X + 5, (int)max_y - Position.Y + 5));
            ClientArea = Rectangle.Round(hotbarBG.AABB);
        }

4. Example

Project: Gorgon
Source File: PanelSpriteEditor.cs
private void panelSprite_MouseUp(object sender, MouseEventArgs e)
		{
			// If we don't have focus, don't ruin our sprite trying to get it back.
			if (!panelSprite.Focused)
			{
				panelSprite.Focus();
				return;
			}

			try
			{
				switch (SpriteEditorMode)
				{
					case SpriteEditorMode.AnchorDrag:
						SpriteEditorMode = SpriteEditorMode.View;
						_dragDelta = Point.Empty;
						panelSprite.Cursor = Cursors.Default;
						_content.RefreshProperty("Anchor");
						break;
					case SpriteEditorMode.Edit:
						if (!_clipper.OnMouseUp(e))
						{
							return;
						}

						var newRegion = Rectangle.Round(_clipper.ClipRegion);
						_content.Size = newRegion.Size;
						_content.TextureRegion = newRegion;
						_clipper.TextureSize = _content.Texture.Settings.Size;
						_clipper.Scale = new Vector2(1);
						break;
				}
			}
			catch (Exception ex)
			{
				GorgonDialogs.ErrorBox(ParentForm, ex);
			}
			finally
			{
				Cursor.Current = Cursors.Default;
			}
		}

5. Example

Project: Vocaluxe
Source File: Extensions.cs
public static Rectangle GetRect(this Bitmap bmp)
        {
            return Rectangle.Round(new Rectangle(0, 0, bmp.Width, bmp.Height));
        }

6. Example

Project: Mist
Source File: CssDrawingHelper.cs
private static RectangleF RoundR(RectangleF r, CssBox b)
        {
            //HACK: Don't round if in printing mode
            return Rectangle.Round(r);
        }

7. Example

Project: winauth
Source File: CssDrawingHelper.cs
private static RectangleF RoundR(RectangleF r, CssBox b)
        {
            //HACK: Don't round if in printing mode
            return Rectangle.Round(r);
        }

8. Example

Project: ZedGraph
Source File: ZedGraphControl.Events.cs
private Rectangle CalcZoomRect(Point point1, Point point2)
		{
			Size size = new Size(point2.X - point1.X, point2.Y - point1.Y);
			Rectangle rect = new Rectangle(point1, size);

			Rectangle chartRect = Rectangle.Round(this._dragPane.Chart.Rect);

			Point chartPt = chartRect.Location;

			if (!this.IsEnableVZoom)
			{
				rect.Y = chartPt.Y;
				rect.Height = chartRect.Height + 1;
			}
			else if (!this.IsEnableHZoom)
			{
				rect.X = chartPt.X;
				rect.Width = chartRect.Width + 1;
			}

			return rect;
		}

9. Example

Project: ClearCanvas
Source File: ImageRenderer.cs
internal static void CalculateVisibleRectangles(
			ImageGraphic imageGraphic,
			Rectangle clientRectangle,
			out Rectangle dstVisibleRectangle,
			out RectangleF srcVisibleRectangle)
		{
			Rectangle srcRectangle = new Rectangle(0, 0, imageGraphic.Columns, imageGraphic.Rows);
			RectangleF dstRectangle = imageGraphic.SpatialTransform.ConvertToDestination(srcRectangle);

			// Find the intersection between the drawable client rectangle and
			// the transformed destination rectangle
			dstRectangle = RectangleUtilities.RoundInflate(dstRectangle);
			dstRectangle = RectangleUtilities.Intersect(clientRectangle, dstRectangle);

			if (dstRectangle.IsEmpty)
			{
				dstVisibleRectangle = Rectangle.Empty;
				srcVisibleRectangle = RectangleF.Empty;
				return;
			}

			// Figure out what portion of the image is visible in source coordinates
			srcVisibleRectangle = imageGraphic.SpatialTransform.ConvertToSource(dstRectangle);
			//dstRectangle is already rounded, this is just a conversion to Rectangle.
			dstVisibleRectangle = Rectangle.Round(dstRectangle);
		}

10. Example

Project: ClearCanvas
Source File: CompositeScaleGraphic.cs
private static Rectangle ComputeScaleBounds(IPresentationImage presentationImage, float horizontalReduction, float verticalReduction)
		{
			RectangleF clientBounds = presentationImage.ClientRectangle;
			float hReduction = horizontalReduction*Math.Min(1000f, clientBounds.Width);
			float vReduction = verticalReduction*Math.Min(1000f, clientBounds.Height);

			clientBounds = new RectangleF(clientBounds.X + hReduction, clientBounds.Y + vReduction, clientBounds.Width - 2*hReduction, clientBounds.Height - 2*vReduction);

			if (presentationImage is IImageGraphicProvider)
			{
				ImageGraphic imageGraphic = ((IImageGraphicProvider) presentationImage).ImageGraphic;
				Rectangle srcRectangle = new Rectangle(0, 0, imageGraphic.Columns, imageGraphic.Rows);

				RectangleF imageBounds = imageGraphic.SpatialTransform.ConvertToDestination(srcRectangle);
				imageBounds = RectangleUtilities.ConvertToPositiveRectangle(imageBounds);
				hReduction = horizontalReduction*imageBounds.Width;
				vReduction = verticalReduction*imageBounds.Height;

				imageBounds = new RectangleF(imageBounds.X + hReduction, imageBounds.Y + vReduction, imageBounds.Width - 2*hReduction, imageBounds.Height - 2*vReduction);
				return Rectangle.Round(RectangleUtilities.Intersect(imageBounds, clientBounds));
			}
			else
			{
				return Rectangle.Round(clientBounds);
			}
		}

11. Example

Project: ClearCanvas
Source File: RectangleUtilities.cs
public static Rectangle ConvertToRectangle(Point centroid, Size dimensions)
		{
			//TODO (cr Feb 2010): would result in incorrect result if width and height are not divisible by 2.  Delete method.
			//Currently not used by anything other than EditBox control.
			return Rectangle.Round(ConvertToRectangle((PointF) centroid, dimensions));
		}

12. Example

Project: Mist
Source File: HtmlPanel.cs
protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            foreach (CssBox box in htmlContainer.LinkRegions.Keys)
            {
                RectangleF rect = htmlContainer.LinkRegions[box];
                if (Rectangle.Round(rect).Contains(e.X, e.Y))
                {
                    Cursor = Cursors.Hand;
                    return;
                }
            }

            Cursor = Cursors.Default;
        }

13. Example

Project: Mist
Source File: HtmlPanel.cs
protected override void OnMouseClick(MouseEventArgs e)
        {
            base.OnMouseClick(e);

            foreach (CssBox box in htmlContainer.LinkRegions.Keys)
            {
                RectangleF rect = htmlContainer.LinkRegions[box];
                if (Rectangle.Round(rect).Contains(e.X, e.Y))
                {
                    CssValue.GoLink(box.GetAttribute("href", string.Empty));
                    return;
                }
            }

        }

14. Example

Project: winauth
Source File: HtmlPanel.cs
protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            foreach (CssBox box in htmlContainer.LinkRegions.Keys)
            {
                RectangleF rect = htmlContainer.LinkRegions[box];
                if (Rectangle.Round(rect).Contains(e.X, e.Y))
                {
                    Cursor = Cursors.Hand;
                    return;
                }
            }

            Cursor = Cursors.Default;
        }

15. Example

Project: winauth
Source File: HtmlPanel.cs
protected override void OnMouseClick(MouseEventArgs e)
        {
            base.OnMouseClick(e);

            foreach (CssBox box in htmlContainer.LinkRegions.Keys)
            {
                RectangleF rect = htmlContainer.LinkRegions[box];
                if (Rectangle.Round(rect).Contains(e.X, e.Y))
                {
                    CssValue.GoLink(box.GetAttribute("href", string.Empty));
                    return;
                }
            }

        }

16. Example

Project: lua-tilde
Source File: DocumentSwitchWindow.cs
protected override void OnPaint(PaintEventArgs pevent)
			{
				RectangleF rect = new RectangleF(this.DisplayRectangle.Left + this.Padding.Left, this.DisplayRectangle.Top + this.Padding.Top, this.DisplayRectangle.Width - this.Padding.Horizontal - 1, this.DisplayRectangle.Height - this.Padding.Vertical - 1);
				if (this.Focused)
				{
					pevent.Graphics.Clear(Color.LightSteelBlue);
					pevent.Graphics.DrawRectangle(SystemPens.WindowFrame, Rectangle.Round(rect));
				}
				else
				{
					pevent.Graphics.Clear(SystemColors.Control);
				}
				pevent.Graphics.DrawString(this.Text, this.Font, mButtonSettings.mLabelBrush, rect, mButtonSettings.mLabelFormat);
			}

17. Example

Project: referencesource
Source File: ChartGraphics.cs
private void DrawSecondRowLabelBoxMark(
			Axis axis, 
			Color markColor,
			RectangleF absPosition/n ..... /n //View Source file for more details /n }

18. Example

Project: referencesource
Source File: Legend.cs
private void DrawLegendTitle(ChartGraphics chartGraph)
		{
			// Check if title text is specified an/n ..... /n //View Source file for more details /n }

19. Example

Project: Launcher_Multigaming
Source File: Italk.cs
private void DrawCustomArrow(Graphics g, ToolStripSplitButton item)
        {
            int dropWidth = System.Convert.ToInt32(item.DropDownButtonBounds.Width - 1);
            int dropHeight = System.Convert.ToInt32(item.DropDownButtonBounds.Height - 1);
            float triangleWidth = dropWidth / 2.0F + 1;
            float triangleLeft = System.Convert.ToSingle(item.DropDownButtonBounds.Left + (dropWidth - triangleWidth) / 2.0F);
            float triangleHeight = triangleWidth / 2.0F;
            float triangleTop = System.Convert.ToSingle(item.DropDownButtonBounds.Top + (dropHeight - triangleHeight) / 2.0F + 1);
            RectangleF arrowRect = new RectangleF(triangleLeft, triangleTop, triangleWidth, triangleHeight);

            this.DrawCustomArrow(g, item, Rectangle.Round(arrowRect));
        }

20. Example

Project: Launcher_Multigaming
Source File: Italk.cs
private void DrawCustomArrow(Graphics g, ToolStripSplitButton item)
        {
            int dropWidth = System.Convert.ToInt32(item.DropDownButtonBounds.Width - 1);
            int dropHeight = System.Convert.ToInt32(item.DropDownButtonBounds.Height - 1);
            float triangleWidth = dropWidth / 2.0F + 1;
            float triangleLeft = System.Convert.ToSingle(item.DropDownButtonBounds.Left + (dropWidth - triangleWidth) / 2.0F);
            float triangleHeight = triangleWidth / 2.0F;
            float triangleTop = System.Convert.ToSingle(item.DropDownButtonBounds.Top + (dropHeight - triangleHeight) / 2.0F + 1);
            RectangleF arrowRect = new RectangleF(triangleLeft, triangleTop, triangleWidth, triangleHeight);

            this.DrawCustomArrow(g, item, Rectangle.Round(arrowRect));
        }

21. Example

Project: Launcher_Multigaming
Source File: Italk.cs
private void DrawCustomArrow(Graphics g, ToolStripSplitButton item)
        {
            int dropWidth = System.Convert.ToInt32(item.DropDownButtonBounds.Width - 1);
            int dropHeight = System.Convert.ToInt32(item.DropDownButtonBounds.Height - 1);
            float triangleWidth = dropWidth / 2.0F + 1;
            float triangleLeft = System.Convert.ToSingle(item.DropDownButtonBounds.Left + (dropWidth - triangleWidth) / 2.0F);
            float triangleHeight = triangleWidth / 2.0F;
            float triangleTop = System.Convert.ToSingle(item.DropDownButtonBounds.Top + (dropHeight - triangleHeight) / 2.0F + 1);
            RectangleF arrowRect = new RectangleF(triangleLeft, triangleTop, triangleWidth, triangleHeight);

            this.DrawCustomArrow(g, item, Rectangle.Round(arrowRect));
        }

22. Example

Project: ShareX
Source File: FreehandContainer.cs
public override bool HandleMouseMove(int mouseX, int mouseY)
        {
            Point previousPoint = capturePoints[capturePoints.Count - 1];

            if (GeometryHelper.Distance2D(previousPoint.X, previousPoint.Y, mouseX, mouseY) >= 2 * EditorConfig.FreehandSensitivity)
            {
                capturePoints.Add(new Point(mouseX, mouseY));
            }
            if (GeometryHelper.Distance2D(lastMouse.X, lastMouse.Y, mouseX, mouseY) >= EditorConfig.FreehandSensitivity)
            {
                //path.AddCurve(new Point[]{lastMouse, new Point(mouseX, mouseY)});
                freehandPath.AddLine(lastMouse, new Point(mouseX, mouseY));
                lastMouse = new Point(mouseX, mouseY);
                // Only re-calculate the bounds & redraw when we added something to the path
                myBounds = Rectangle.Round(freehandPath.GetBounds());
                Invalidate();
            }
            return true;
        }

23. Example

Project: ss13remake
Source File: HealthPanel.cs
public override void Update(float frameTime)
        {
            const int x_inner = 4;
          /n ..... /n //View Source file for more details /n }

24. Example

Project: Gorgon
Source File: PanelTexture.cs
private void panelTextureDisplay_MouseMove(object sender, MouseEventArgs e)
		{
			if (_clipper == null)
			{
				return;
			}

			if (!_clipper.OnMouseMove(e))
			{
				return;
			}

			Rectangle numericValues = Rectangle.Intersect(Rectangle.Round(_clipper.ClipRegion),
			                                              new Rectangle(0, 0, _texture.Settings.Width, _texture.Settings.Height));

			numericX.Value = numericValues.X;
			numericY.Value = numericValues.Y;
			numericWidth.Value = numericValues.Width;
			numericHeight.Value = numericValues.Height;

			UpdateLabelInfo();

			OnBrushChanged();
		}

25. Example

Project: ShareX
Source File: FreehandContainer.cs
public override bool HandleMouseMove(int mouseX, int mouseY)
        {
            Point previousPoint = capturePoints[capturePoints.Count - 1];

            if (GeometryHelper.Distance2D(previousPoint.X, previousPoint.Y, mouseX, mouseY) >= (2 * EditorConfig.FreehandSensitivity))
            {
                capturePoints.Add(new Point(mouseX, mouseY));
            }
            if (GeometryHelper.Distance2D(lastMouse.X, lastMouse.Y, mouseX, mouseY) >= EditorConfig.FreehandSensitivity)
            {
                //path.AddCurve(new Point[]{lastMouse, new Point(mouseX, mouseY)});
                freehandPath.AddLine(lastMouse, new Point(mouseX, mouseY));
                lastMouse = new Point(mouseX, mouseY);
                // Only re-calculate the bounds & redraw when we added something to the path
                myBounds = Rectangle.Round(freehandPath.GetBounds());
                Invalidate();
            }
            return true;
        }

26. Example

Project: ClearCanvas
Source File: TextEditControlGraphic.cs
public bool StartEdit()
		{
			// remove any pre-existing edit boxes
			EndEdit();

			bool result = false;
			this.CoordinateSystem = CoordinateSystem.Destination;
			try
			{
				EditBox editBox = new EditBox(this.Text ?? string.Empty);
				editBox.Location = Point.Round(this.Location);
				editBox.Size = Rectangle.Round(this.BoundingBox).Size;
				editBox.Multiline = this.Multiline;
				editBox.FontName = this.FontName;
				editBox.FontSize = this.FontSize;
				editBox.ValueAccepted += OnEditBoxComplete;
				editBox.ValueCancelled += OnEditBoxComplete;
				InstallEditBox(_currentCalloutEditBox = editBox);
				result = true;
			}
			finally
			{
				this.ResetCoordinateSystem();
			}

			return result;
		}

27. Example

Project: diagramnet
Source File: LineController.cs
public bool HitTest(Rectangle r)
		{
			GraphicsPath gp = new GraphicsPath();
			Matrix mtx = new Matrix();

			gp.AddRectangle(new Rectangle(el.Location.X,
				el.Location.Y,
				el.Size.Width,
				el.Size.Height));
			gp.Transform(mtx);
			Rectangle retGp = Rectangle.Round(gp.GetBounds());
			return r.Contains (retGp);
		}

28. Example

Project: diagramnet
Source File: RectangleController.cs
public virtual bool HitTest(Rectangle r)
		{
			GraphicsPath gp = new GraphicsPath();
			Matrix mtx = new Matrix();

			Point elLocation = el.Location;
			Size elSize = el.Size;
			gp.AddRectangle(new Rectangle(elLocation.X,
				elLocation.Y,
				elSize.Width,
				elSize.Height));
			gp.Transform(mtx);
			Rectangle retGp = Rectangle.Round(gp.GetBounds());
			return r.Contains (retGp);
		}

29. Example

Project: diagramnet
Source File: RightAngleLinkController.cs
bool Dalssoft.DiagramNet.IController.HitTest(Rectangle r)
		{
			GraphicsPath gp = new GraphicsPath();
			Matrix mtx = new Matrix();

			Point elLocation = el.Location;
			Size elSize = el.Size;
			gp.AddRectangle(new Rectangle(elLocation.X,
				elLocation.Y,
				elSize.Width,
				elSize.Height));
			gp.Transform(mtx);
			Rectangle retGp = Rectangle.Round(gp.GetBounds());
			return r.Contains (retGp);
		}

30. Example

Project: Embryo
Source File: ImageFromPathAttrib.cs
void displayComponent(Graphics graphics, Brush myBrush, Font ubuntuFont, Pen pen, StringFormat myFormat)
        {
            graphics.FillRectangle(myBrush, Rectangle.Round(Bounds));
            graphics.DrawRectangle(pen, Rectangle.Round(Bounds));
            graphics.DrawString("[email protected]", ubuntuFont, Brushes.White, new Point((int)this.Bounds.Location.X + 12, (int)this.Bounds.Location.Y + 480 - 6 - 10), myFormat);
            graphics.DrawImage(Owner.Icon_24x24, Bounds.Location.X + 12, Bounds.Location.Y + 450 - 10);
        }

31. Example

Project: scallion
Source File: TextRendering.cs
public void DrawString(string text, Font font, Brush brush, PointF point)
            {
                gfx.DrawString(text, font, brush, point);

                SizeF size = gfx.MeasureString(text, font);
                dirty_region = Rectangle.Round(RectangleF.Union(dirty_region, new RectangleF(point, size)));
                dirty_region = Rectangle.Intersect(dirty_region, new Rectangle(0, 0, bmp.Width, bmp.Height));
            }

32. Example

Project: LiveSplit
Source File: TimerForm.cs
private void DrawBackground(Graphics g)
        {
            if (Layout.Settings.BackgroundType == /n ..... /n //View Source file for more details /n }

33. Example

Project: TDMaker
Source File: ImageObj.cs
override public void Draw( Graphics g, PaneBase pane, float scaleFactor )
		{
			if ( _image != null )
			{
				// Convert the rectangle coordinates from the user coordinate system
				// to the screen coordinate system
				RectangleF tmpRect = _location.TransformRect( pane );

				if ( _isScaled )
					g.DrawImage( _image, tmpRect );
				else
				{
					Region clip = g.Clip;
					g.SetClip( tmpRect );
					g.DrawImageUnscaled( _image, Rectangle.Round( tmpRect ) );
					g.SetClip( clip, CombineMode.Replace );
					//g.DrawImageUnscaledAndClipped( image, Rectangle.Round( tmpRect ) );
				}
			}

		}

34. Example

Project: referencesource
Source File: ChartGraphics.cs
private void DrawSecondRowLabelMark(
			Axis axis, 
			Color markColor,
			RectangleF absPosition, 
/n ..... /n //View Source file for more details /n }

35. Example

Project: referencesource
Source File: Legend.cs
private void DrawLegendHeader(ChartGraphics chartGraph)
		{
			// Check if header should be drawn
		/n ..... /n //View Source file for more details /n }

36. Example

Project: Office365APIEditor
Source File: RequestForm.cs
private void listBox_RunHistory_DrawItem(object sender, DrawItemEventArgs e)
        {
            //n ..... /n //View Source file for more details /n }

37. Example

Project: ShareX
Source File: RegionCaptureTasks.cs
public static Image ApplyRegionPathToImage(Image img, GraphicsPath gp)
        {
            if (img != null && gp != null)
            {
                Rectangle regionArea = Rectangle.Round(gp.GetBounds());
                Rectangle screenRectangle = CaptureHelpers.GetScreenBounds0Based();
                regionArea = Rectangle.Intersect(regionArea, screenRectangle);

                if (regionArea.IsValid())
                {
                    using (Bitmap bmp = img.CreateEmptyBitmap())
                    using (Graphics g = Graphics.FromImage(bmp))
                    using (TextureBrush brush = new TextureBrush(img))
                    {
                        g.PixelOffsetMode = PixelOffsetMode.Half;
                        g.SmoothingMode = SmoothingMode.HighQuality;

                        g.FillPath(brush, gp);

                        return ImageHelpers.CropBitmap(bmp, regionArea);
                    }
                }
            }

            return null;
        }

38. Example

Project: Gorgon
Source File: formMain.cs
protected override void OnLoad(EventArgs e)
		{
			base.OnLoad(e);

			try
			{
				// Set our defau/n ..... /n //View Source file for more details /n }

39. Example

Project: Gorgon
Source File: GorgonText.cs
public void Draw()
		{
			Rectangle clipRegion = Rectangle.Round(ClipRegion);
			Rectangle? lastClip/n ..... /n //View Source file for more details /n }

40. Example

Project: Mist
Source File: CssLineBox.cs
internal void DrawRectangles(Graphics g)
        {
            foreach (CssBox b in Rectangles.Keys)
            {
                if (float.IsInfinity(Rectangles[b].Width)) 
                    continue;
                g.FillRectangle(new SolidBrush(Color.FromArgb(50, Color.Black)),
                    Rectangle.Round(Rectangles[b]));
                g.DrawRectangle(Pens.Red, Rectangle.Round(Rectangles[b]));
            }
        }

41. Example

Project: winauth
Source File: CssLineBox.cs
internal void DrawRectangles(Graphics g)
        {
            foreach (CssBox b in Rectangles.Keys)
            {
                if (float.IsInfinity(Rectangles[b].Width)) 
                    continue;
                g.FillRectangle(new SolidBrush(Color.FromArgb(50, Color.Black)),
                    Rectangle.Round(Rectangles[b]));
                g.DrawRectangle(Pens.Red, Rectangle.Round(Rectangles[b]));
            }
        }

42. Example

Project: ZedGraph
Source File: ImageObj.cs
override public void Draw( Graphics g, PaneBase pane, float scaleFactor )
		{
			if ( _image != null )
			{
				// Convert the rectangle coordinates from the user coordinate system
				// to the screen coordinate system
				RectangleF tmpRect = _location.TransformRect( pane );

				if ( _isScaled )
					g.DrawImage( _image, tmpRect );
				else
				{
					Region clip = g.Clip;
					g.SetClip( tmpRect );
					g.DrawImageUnscaled( _image, Rectangle.Round( tmpRect ) );
					g.SetClip( clip, CombineMode.Replace );
					//g.DrawImageUnscaledAndClipped( image, Rectangle.Round( tmpRect ) );
				}
			}

		}

43. Example

Project: ClearCanvas
Source File: InteractiveTextGraphicBuilder.cs
public bool StartEdit()
		{
			// remove any pre-existing edit boxes
			EndEdit();

			bool result = false;
			this.Graphic.CoordinateSystem = CoordinateSystem.Destination;
			try
			{
				EditBox editBox = new EditBox(_textGraphic.Text ?? string.Empty);
				if (string.IsNullOrEmpty(_textGraphic.Text))
					editBox.Value = SR.LabelEnterText;
				editBox.Multiline = true;
				editBox.Location = Point.Round(_textGraphic.Location);
				editBox.Size = Rectangle.Round(_textGraphic.BoundingBox).Size;
				editBox.FontName = _textGraphic.Font;
				editBox.FontSize = _textGraphic.SizeInPoints;
				editBox.ValueAccepted += OnEditBoxComplete;
				editBox.ValueCancelled += OnEditBoxComplete;
				InstallEditBox(_currentCalloutEditBox = editBox);
				result = true;
			}
			finally
			{
				this.Graphic.ResetCoordinateSystem();
			}

			return result;
		}

44. Example

Project: Toxy
Source File: ShapeCaptureHelpers.cs
public static Image GetRegionImage(Image surfaceImage, GraphicsPath regionFillPath, GraphicsPath regionDrawPath, SurfaceOptions options)
        {
            if (regionFillPath != null)
            {
                Image img;

                Rectangle regionArea = Rectangle.Round(regionFillPath.GetBounds());
                Rectangle screenRectangle = CaptureHelpers.GetScreenBounds0Based();
                Rectangle newRegionArea = Rectangle.Intersect(regionArea, screenRectangle);

                using (GraphicsPath gp = (GraphicsPath)regionFillPath.Clone())
                {
                    MoveGraphicsPath(gp, -Math.Max(0, regionArea.X), -Math.Max(0, regionArea.Y));
                    img = ImageHelpers.CropImage(surfaceImage, newRegionArea, gp);

                    if (options.DrawBorder)
                    {
                        GraphicsPath gpOutline = regionDrawPath ?? regionFillPath;

                        using (GraphicsPath gp2 = (GraphicsPath)gpOutline.Clone())
                        {
                            MoveGraphicsPath(gp2, -Math.Max(0, regionArea.X), -Math.Max(0, regionArea.Y));
                            img = ImageHelpers.DrawOutline(img, gp2);
                        }
                    }
                }

                return img;
            }

            return null;
        }

45. Example

Project: Embryo
Source File: ChildOutputPlugAttrib.cs
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
        {
            if (channel == GH_CanvasChannel.Wires)
            {
                base.Render(canvas, graphics, channel);
            }

            if (channel == GH_CanvasChannel.Objects)
            {

                //base.Render(canvas, graphics, channel);

                Pen myPen;
                SolidBrush myBrush;

                if (Owner.RuntimeMessageLevel == GH_RuntimeMessageLevel.Blank)
                {
                    myPen = new Pen(Color.Black, 3);
                    myBrush = new SolidBrush(Color.Black);
                }
                else
                {
                    myPen = new Pen(Friends.EM_Colour(), 3);
                    myBrush = new SolidBrush(Friends.EM_Colour());
                }

                graphics.FillEllipse(myBrush, Bounds.Location.X - 1 - 4, Bounds.Location.Y + 16 - 4, 8, 8);
                graphics.FillRectangle(myBrush, Rectangle.Round(Bounds));
                graphics.DrawRectangle(myPen, Rectangle.Round(Bounds));

                //RenderComponentParameters(canvas, graphics, Owner, new GH_PaletteStyle(Color.Azure));

                PointF iconLocation = new PointF(Pivot.X + 8, Pivot.Y + 4);
                graphics.DrawImage(Owner.Icon_24x24, iconLocation);

            }
        }

46. Example

Project: Embryo
Source File: GetGeometryAttrib.cs
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
        {
            if (channel == GH_CanvasChannel.Wires)
            {
                base.Render(canvas, graphics, channel);
            }

            if (channel == GH_CanvasChannel.Objects)
            {

                //base.Render(canvas, graphics, channel);

                Pen myPen;
                SolidBrush myBrush;

                if (Owner.RuntimeMessageLevel == GH_RuntimeMessageLevel.Blank)
                {
                    myPen = new Pen(Color.Black, 3);
                    myBrush = new SolidBrush(Color.Black);
                }
                else
                {
                    myPen = new Pen(Friends.EM_Colour(), 3);
                    myBrush = new SolidBrush(Friends.EM_Colour());
                }

                graphics.FillEllipse(myBrush, Bounds.Location.X + 41 - 4, Bounds.Location.Y + 16 - 4, 8, 8);
                graphics.FillEllipse(myBrush, Bounds.Location.X - 1 - 4, Bounds.Location.Y + 16 - 4, 8, 8);
                graphics.FillRectangle(myBrush, Rectangle.Round(Bounds));
                graphics.DrawRectangle(myPen, Rectangle.Round(Bounds));

                //RenderComponentParameters(canvas, graphics, Owner, new GH_PaletteStyle(Color.Azure));

                PointF iconLocation = new PointF(Pivot.X + 8, Pivot.Y + 4);
                graphics.DrawImage(Owner.Icon_24x24, iconLocation);

            }
        }

47. Example

Project: Embryo
Source File: ParentInputAttrib.cs
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
        {
            if (channel == GH_CanvasChannel.Wires)
            {
                base.Render(canvas, graphics, channel);
            }

            if (channel == GH_CanvasChannel.Objects)
            {

                //base.Render(canvas, graphics, channel);

                Pen myPen;
                SolidBrush myBrush;

                if (Owner.Params.Output[0].Recipients.Count != 0)
                {
                    myPen = new Pen(Color.Black, 3);
                    myBrush = new SolidBrush(Color.Black);
                }
                else
                {
                    myPen = new Pen(Friends.EM_Colour(), 3);
                    myBrush = new SolidBrush(Friends.EM_Colour());
                }

                graphics.FillEllipse(myBrush, Bounds.Location.X + 41 - 4, Bounds.Location.Y + 16 - 4, 8, 8);
                graphics.FillRectangle(myBrush, Rectangle.Round(Bounds));
                graphics.DrawRectangle(myPen, Rectangle.Round(Bounds));

                //RenderComponentParameters(canvas, graphics, Owner, new GH_PaletteStyle(Color.Azure));

                PointF iconLocation = new PointF(Pivot.X+8, Pivot.Y+4);
                graphics.DrawImage(Owner.Icon_24x24, iconLocation);

            }
        }

48. Example

Project: Embryo
Source File: ParentOutputAttrib.cs
protected override void Render(GH_Canvas canvas, Graphics graphics, GH_CanvasChannel channel)
        {
            if (channel == GH_CanvasChannel.Wires)
            {
                base.Render(canvas, graphics, channel);
            }

            if (channel == GH_CanvasChannel.Objects)
            {

                //base.Render(canvas, graphics, channel);

                Pen myPen;
                SolidBrush myBrush;

                if (Owner.RuntimeMessageLevel == GH_RuntimeMessageLevel.Blank)
                {
                    myPen = new Pen(Color.Black, 3);
                    myBrush = new SolidBrush(Color.Black);
                }
                else
                {
                    myPen = new Pen(Friends.EM_Colour(), 3);
                    myBrush = new SolidBrush(Friends.EM_Colour());
                }

                graphics.FillEllipse(myBrush, Bounds.Location.X -1- 4, Bounds.Location.Y + 16 - 4, 8, 8);
                graphics.FillRectangle(myBrush, Rectangle.Round(Bounds));
                graphics.DrawRectangle(myPen, Rectangle.Round(Bounds));
                
                //RenderComponentParameters(canvas, graphics, Owner, new GH_PaletteStyle(Color.Azure));

                PointF iconLocation = new PointF(Pivot.X + 8, Pivot.Y + 4);
                graphics.DrawImage(Owner.Icon_24x24, iconLocation);

            }
        }

49. Example

Project: NodeEditorWinforms
Source File: NodesControl.cs
private void NodesControl_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
            e.Graphics.InterpolationMode = InterpolationMode.HighQualityBilinear;            

            graph.Draw(e.Graphics, PointToClient(MousePosition), MouseButtons);            

            if (dragSocket != null)
            {
                var pen = new Pen(Color.Black, 2);
                NodesGraph.DrawConnection(e.Graphics, pen, dragConnectionBegin, dragConnectionEnd);
            }

            if (selectionStart != PointF.Empty)
            {
                var rect = Rectangle.Round(MakeRect(selectionStart, selectionEnd));
                e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(50, Color.CornflowerBlue)), rect);
                e.Graphics.DrawRectangle(new Pen(Color.DodgerBlue), rect);
            }

            needRepaint = false;
        }

50. Example

Project: referencesource
Source File: ChartGraphics.cs
private void DrawPieGradientEffects( 
			PieDrawingStyle pieDrawingStyle, 
			RectangleF position, 
/n ..... /n //View Source file for more details /n }