Here are the examples of the csharp api class System.Drawing.Point.Round(System.Drawing.PointF) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
31 Examples
0
1. Example
Project: SharpMap
Source File: SharpDXVectorStyle.cs
Source File: SharpDXVectorStyle.cs
public static Vector2 ToSharpDXPoint(PointF symbolOffset) { var tmp = System.Drawing.Point.Round(symbolOffset); return new Vector2(tmp.X, tmp.Y); }
0
2. Example
Project: Gorgon
Source File: formMain.cs
Source File: formMain.cs
private void DrawSpray(GorgonJoystick joystick, int index) { SprayCan state = _sprayStates[index]; // Update the origin of the spray. state.Origin = _stickPosition[index]; // Find out if we're spraying. if (joystick.Throttle > joystick.Capabilities.ThrottleAxisRange.Minimum) { if ((!state.IsActive) && (!state.NeedReset)) { // Convert the throttle value to a unit value. float throttleUnit = ((float)(joystick.Throttle - joystick.Capabilities.ThrottleAxisRange.Minimum) / joystick.Capabilities.ThrottleAxisRange.Range); // Set up the spray state. state.Position = state.Origin; state.Amount = joystick.Capabilities.ThrottleAxisRange.Range / 2.0f; state.Time = throttleUnit * 10.0f; state.VibrationAmount = joystick.Capabilities.VibrationMotorRanges[1].Maximum; state.SprayAlpha = (throttleUnit * 239.0f) + 16; state.IsActive = true; } } else { state.IsActive = false; } if (!state.IsActive) { return; } // Update the state spray effect. state.Update(); _surface.DrawPoint(Point.Round(state.Position), state.SprayColor, state.SprayPointSize); }
0
3. Example
Project: ImageGlass
Source File: ImageListViewRenderer.cs
Source File: ImageListViewRenderer.cs
public virtual void DrawFileIcon(Graphics g, ImageListViewItem item, Rectangle bounds) { Image icon = item.GetCachedImage(CachedImageType.SmallIcon); if (icon != null) { Size size = icon.Size; PointF ptf = new PointF((float)bounds.X + ((float)bounds.Width - (float)size.Width) / 2.0f, (float)bounds.Y + ((float)bounds.Height - (float)size.Height) / 2.0f); Point pt = Point.Round(ptf); g.DrawImage(icon, pt.X, pt.Y); } }
0
4. Example
Project: imagelistview
Source File: ImageListViewRenderer.cs
Source File: ImageListViewRenderer.cs
public virtual void DrawFileIcon(Graphics g, ImageListViewItem item, Rectangle bounds) { Image icon = item.GetCachedImage(CachedImageType.SmallIcon); if (icon != null) { Size size = icon.Size; PointF ptf = new PointF((float)bounds.X + ((float)bounds.Width - (float)size.Width) / 2.0f, (float)bounds.Y + ((float)bounds.Height - (float)size.Height) / 2.0f); Point pt = Point.Round(ptf); g.DrawImage(icon, pt.X, pt.Y); } }
0
5. Example
Project: HTML-Renderer
Source File: HtmlPanel.cs
Source File: HtmlPanel.cs
public virtual void ScrollToElement(string elementId) { ArgChecker.AssertArgNotNullOrEmpty(elementId, "elementId"); if (_htmlContainer != null) { var rect = _htmlContainer.GetElementRectangle(elementId); if (rect.HasValue) { UpdateScroll(Point.Round(rect.Value.Location)); _htmlContainer.HandleMouseMove(this, new MouseEventArgs(MouseButtons, 0, MousePosition.X, MousePosition.Y, 0)); } } }
0
6. Example
Project: Gorgon
Source File: formMain.cs
Source File: formMain.cs
private void DrawJoystickCursor(GorgonJoystick joystick, int index) { var playerColorValue = (i/n ..... /n //View Source file for more details /n }
0
7. Example
Project: BotSuite
Source File: Mouse.cs
Source File: Mouse.cs
public static bool Move(Point targetPosition, bool human = true, int steps = 100) { if(!human) { Cursor.Position = targetPosition; return true; } Point start = GetPosition(); PointF iterPoint = start; PointF slope = new PointF(targetPosition.X - start.X, targetPosition.Y - start.Y); slope.X = slope.X / steps; slope.Y = slope.Y / steps; for(int i = 0; i < steps; i++) { iterPoint = new PointF(iterPoint.X + slope.X, iterPoint.Y + slope.Y); Cursor.Position = Point.Round(iterPoint); Utility.RandomDelay(5, 10); } // test if it works return (Cursor.Position.X == targetPosition.X) && (Cursor.Position.Y == targetPosition.Y); }
0
8. Example
Project: BotSuite
Source File: Mouse.cs
Source File: Mouse.cs
public static Boolean Move(Point targetPosition, Boolean human = true, Int32 steps = 100) { if (!human) { Cursor.Position = targetPosition; return true; } Point start = GetPosition(); PointF iterPoint = start; var slope = new PointF(targetPosition.X - start.X, targetPosition.Y - start.Y); slope.X = slope.X/steps; slope.Y = slope.Y/steps; for (int i = 0; i < steps; i++) { iterPoint = new PointF(iterPoint.X + slope.X, iterPoint.Y + slope.Y); Cursor.Position = Point.Round(iterPoint); Utility.Delay(5, 10); } // test if it works if ((Cursor.Position.X == targetPosition.X) && (Cursor.Position.Y == targetPosition.Y)) return true; return false; }
0
9. Example
Project: ClearCanvas
Source File: VerticesControlGraphic.cs
Source File: VerticesControlGraphic.cs
protected virtual void DeleteVertex() { if (!_canAddRemoveVertices || !Enabled) return; object memento = this.CreateMemento(); IPointsGraphic subject = this.Subject; if (subject.Points.Count > 1) { int index = this.HitTestControlPoint(Point.Round(_lastContextMenuPoint)); if (index >= 0 && index < subject.Points.Count) { subject.Points.RemoveAt(index); } } AddToCommandHistory(this, memento, this.CreateMemento()); }
0
10. Example
Project: ClearCanvas
Source File: VerticesControlGraphic.cs
Source File: VerticesControlGraphic.cs
public override IActionSet GetExportedActions(string site, IMouseInformation mouseInformation) { /n ..... /n //View Source file for more details /n }
0
11. Example
Project: ClearCanvas
Source File: RoiCalloutGraphic.cs
Source File: RoiCalloutGraphic.cs
public void Rename() { var parent = ParentGraphic; if (parent == null) return; this.CoordinateSystem = CoordinateSystem.Destination; try { EditBox editBox = new EditBox(parent.Name ?? string.Empty); editBox.Location = Point.Round(base.TextGraphic.Location); editBox.Size = Size.Round(base.TextGraphic.BoundingBox.Size); editBox.FontName = base.TextGraphic.Font; editBox.FontSize = base.TextGraphic.SizeInPoints; editBox.Multiline = false; editBox.ValueAccepted += OnEditBoxAccepted; editBox.ValueCancelled += OnEditBoxCancelled; base.ParentPresentationImage.Tile.EditBox = editBox; } finally { this.ResetCoordinateSystem(); } }
0
12. Example
Project: ImageGlass
Source File: ImageListViewRenderer.cs
Source File: ImageListViewRenderer.cs
public virtual void DrawCheckBox(Graphics g, ImageListViewItem item, Rectangle bounds) { Size size = CheckBoxRenderer.GetGlyphSize(g, CheckBoxState.CheckedNormal); PointF pt = new PointF((float)bounds.X + ((float)bounds.Width - (float)size.Width) / 2.0f, (float)bounds.Y + ((float)bounds.Height - (float)size.Height) / 2.0f); CheckBoxState state = CheckBoxState.UncheckedNormal; if (item.Enabled) state = item.Checked ? CheckBoxState.CheckedNormal : CheckBoxState.UncheckedNormal; else state = item.Checked ? CheckBoxState.CheckedDisabled : CheckBoxState.UncheckedDisabled; CheckBoxRenderer.DrawCheckBox(g, Point.Round(pt), state); }
0
13. Example
Project: MultiversePlatform
Source File: UiComponents.cs
Source File: UiComponents.cs
public override void SetupWindowPosition() { base.SetupWindowPosition(); if (browser != null) { browser.BrowserSize = System.Drawing.Size.Round(this.Size); browser.BrowserLocation = Point.Round(this.Position); browser.PositionBrowser(); } }
0
14. Example
Project: imagelistview
Source File: ImageListViewRenderer.cs
Source File: ImageListViewRenderer.cs
public virtual void DrawCheckBox(Graphics g, ImageListViewItem item, Rectangle bounds) { Size size = CheckBoxRenderer.GetGlyphSize(g, CheckBoxState.CheckedNormal); PointF pt = new PointF((float)bounds.X + ((float)bounds.Width - (float)size.Width) / 2.0f, (float)bounds.Y + ((float)bounds.Height - (float)size.Height) / 2.0f); CheckBoxState state = CheckBoxState.UncheckedNormal; if (item.Enabled) state = item.Checked ? CheckBoxState.CheckedNormal : CheckBoxState.UncheckedNormal; else state = item.Checked ? CheckBoxState.CheckedDisabled : CheckBoxState.UncheckedDisabled; CheckBoxRenderer.DrawCheckBox(g, Point.Round(pt), state); }
0
15. Example
Project: SharpMap
Source File: HeatLayer.cs
Source File: HeatLayer.cs
private void DrawPoints(MapViewport map, IEnumerable<DataRow> features, Bitmap dot, Bitmap image) { var size = new Size(dot.Width, dot.Height); foreach (FeatureDataRow row in features) { var heatValue = HeatValueComputer(row); if (heatValue <= 0) continue; if (heatValue >= 1f) heatValue = 1; var c = row.Geometry.PointOnSurface.Coordinate; if (CoordinateTransformation != null) { c = GeometryTransform.TransformCoordinate(c, CoordinateTransformation.MathTransform); } var posF = map.WorldToImage(c); var pos = Point.Round(posF); //var pos = Point.Round(PointF.Subtract(posF, halfSize)); using (var tmpDot = ApplyHeatValueToImage(dot, heatValue)) { ImageBlender.BlendImages(image, pos.X, pos.Y, size.Width, size.Height, tmpDot, 0, 0, BlendOperation.BlendMultiply); } } }
0
16. Example
Project: Gorgon
Source File: formMain.cs
Source File: formMain.cs
private void UpdateMouseLabel(PointF position, PointingDeviceButtons button) { if ((button & PointingDeviceButtons.Button1) == PointingDeviceButtons.Button1) { _spray.SprayPoint(Point.Round(position)); _currentCursor = Resources.hand_pointer_icon; } else { _currentCursor = Resources.hand_icon; } _mousePosition = new Point((int)position.X, (int)_mouse.Position.Y); labelMouse.Text = string.Format("{0}: {1}x{2}. Button: {3}. Using {4} for data retrieval.", _mouse.Name, position.X.ToString("0.#"), position.Y.ToString("0.#"), button, (_usePolling ? "Polling" : "Events")); }
0
17. Example
Project: ClearCanvas
Source File: VerticesControlGraphic.cs
Source File: VerticesControlGraphic.cs
protected virtual void InsertVertex() { if (!_canAddRemoveVertices || !Enabled) return; object memento = this.CreateMemento(); IPointsGraphic subject = this.Subject; subject.CoordinateSystem = CoordinateSystem.Destination; try { int index = this.HitTestControlPoint(Point.Round(_lastContextMenuPoint)); if (index < 0) { // if inserting in middle of line, find which index to insert at index = IndexOfNextClosestPoint(subject, _lastContextMenuPoint); } else if (index == subject.Points.Count - 1) { // if inserting on last point, append instead of inserting before index++; } if (index >= 0) { subject.Points.Insert(index, _lastContextMenuPoint); } } finally { subject.ResetCoordinateSystem(); } AddToCommandHistory(this, memento, this.CreateMemento()); }
0
18. Example
Project: TDMaker
Source File: ZedGraphControl.Events.cs
Source File: ZedGraphControl.Events.cs
private void HandleZoomDrag( Point mousePt ) { // Hide the previous rectangle by calling the // DrawReversibleFrame method with the same parameters. Rectangle rect = CalcScreenRect( _dragStartPt, _dragEndPt ); ControlPaint.DrawReversibleFrame( rect, this.BackColor, FrameStyle.Dashed ); // Bound the zoom to the ChartRect _dragEndPt = Point.Round( BoundPointToRect( mousePt, _dragPane.Chart._rect ) ); rect = CalcScreenRect( _dragStartPt, _dragEndPt ); // Draw the new rectangle by calling DrawReversibleFrame again. ControlPaint.DrawReversibleFrame( rect, this.BackColor, FrameStyle.Dashed ); }
0
19. Example
Project: MultiversePlatform
Source File: UiComponents.cs
Source File: UiComponents.cs
internal override void ShowWindows() { base.ShowWindows(); if (browser != null) { browser.Hide(); browser.Dispose(); browser = null; } browser = new Multiverse.Web.Browser(); browser.BrowserSize = System.Drawing.Size.Round(this.Size); browser.BrowserLocation = Point.Round(this.Position); browser.BrowserScrollbars = scrollbars; browser.BrowserLine = line; browser.BrowserErrors = browsererrors; browser.Open(url); browser.ObjectForScripting = scriptingObj; browser.Show(); this.MouseDownEvent += HandleMouseDown; this.window.KeyDown += this.HandleKeyDown; // -- this doesn't work --> // this.KeyDownEvent += this.HandleKeyDown; SetFocus(); }
0
20. Example
Project: ZedGraph
Source File: ZedGraphControl.Events.cs
Source File: ZedGraphControl.Events.cs
private void HandleZoomDrag( Point mousePt ) { using (Graphics g = Graphics.FromHwnd(this.Handle)) { // Hide the previous rectangle by calling the // DrawReversibleFrame method with the same parameters. Rectangle rect = this.CalcZoomRect(this._dragStartPt, this._dragEndPt); ReversibleFrame.Draw(g, this.BackColor, rect); // Bound the zoom to the ChartRect _dragEndPt = Point.Round(this.BoundPointToRect(mousePt, this._dragPane.Chart._rect)); rect = this.CalcZoomRect(this._dragStartPt, this._dragEndPt); // Draw the new rectangle by calling DrawReversibleFrame again. ReversibleFrame.Draw(g, this.BackColor, rect); } }
0
21. Example
Project: ClearCanvas
Source File: TextEditControlGraphic.cs
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; }
0
22. Example
Project: referencesource
Source File: ChartGraphics.cs
Source File: ChartGraphics.cs
private void DrawSecondRowLabelMark( Axis axis, Color markColor, RectangleF absPosition, /n ..... /n //View Source file for more details /n }
0
23. Example
Project: SharpMap
Source File: MapBox.cs
Source File: MapBox.cs
private void HandleMapNewTileAvaliable(ITileAsyncLayer sender, Envelope box, Bitmap bm, int sourceWidth, int sourceHeight, ImageAttributes imageAttributes) { lock (_backgroundImagesLocker) { try { var min = Point.Round(_map.WorldToImage(box.Min())); var max = Point.Round(_map.WorldToImage(box.Max())); if (IsDisposed == false && _isDisposed == false) { using (var g = Graphics.FromImage(_imageBackground)) { g.DrawImage(bm, new Rectangle(min.X, max.Y, (max.X - min.X), (min.Y - max.Y)), 0, 0, sourceWidth, sourceHeight, GraphicsUnit.Pixel, imageAttributes); } UpdateImage(false); } } catch (Exception ex) { _logger.Warn(ex.Message, ex); //this can be a GDI+ Hell Exception... } } }
0
24. Example
Project: Gorgon
Source File: MainForm.cs
Source File: MainForm.cs
protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { // Load the /n ..... /n //View Source file for more details /n }
0
25. Example
Project: ClearCanvas
Source File: InteractiveTextGraphicBuilder.cs
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; }
0
26. Example
Project: referencesource
Source File: Selection.cs
Source File: Selection.cs
private GraphicsPath GetGraphicsPath(IList markers, object chartObject, ChartElementType elementType/n ..... /n //View Source file for more details /n }
0
27. Example
Project: ClearCanvas
Source File: DicomSoftcopyPresentationStateBase.cs
Source File: DicomSoftcopyPresentationStateBase.cs
protected void SerializeOverlayPlane(OverlayPlaneModuleIod overlayPlaneModule, out IOverlayMapping o/n ..... /n //View Source file for more details /n }
0
28. Example
Project: TDMaker
Source File: ZedGraphControl.Events.cs
Source File: ZedGraphControl.Events.cs
private void HandleSelectionFinish( object sender, MouseEventArgs e ) { if ( e.Button != _selec/n ..... /n //View Source file for more details /n }
0
29. Example
Project: ZedGraph
Source File: ZedGraphControl.Events.cs
Source File: ZedGraphControl.Events.cs
private void HandleSelectionFinish( object sender, MouseEventArgs e ) { if ( e.Button != _selec/n ..... /n //View Source file for more details /n }
0
30. Example
Project: ClearCanvas
Source File: ShowAnglesToolGraphic.cs
Source File: ShowAnglesToolGraphic.cs
private void Update() { const float calloutOffset = 36; const float largerCalloutOffset =/n ..... /n //View Source file for more details /n }
0
31. Example
Project: ClearCanvas
Source File: ProbeTool.cs
Source File: ProbeTool.cs
private void Probe(Point sourcePointRounded, bool showPixelValue, bool showVoiValue) { string p/n ..... /n //View Source file for more details /n }