Here are the examples of the csharp api class System.Drawing.Size.Round(System.Drawing.SizeF) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
23 Examples
0
1. Example
Project: HTML-Renderer
Source File: HtmlPanel.cs
Source File: HtmlPanel.cs
protected void PerformHtmlLayout() { if (_htmlContainer != null) { _htmlContainer.MaxSize = new SizeF(ClientSize.Width - Padding.Horizontal, 0); Graphics g = Utils.CreateGraphics(this); if (g != null) { using (g) { _htmlContainer.PerformLayout(g); } } AutoScrollMinSize = Size.Round(new SizeF(_htmlContainer.ActualSize.Width + Padding.Horizontal, _htmlContainer.ActualSize.Height)); } }
0
2. Example
Project: Mist
Source File: HtmlLabel.cs
Source File: HtmlLabel.cs
public override void MeasureBounds() { base.MeasureBounds(); if(htmlContainer != null && AutoSize) Size = System.Drawing.Size.Round(htmlContainer.MaximumSize); }
0
3. Example
Project: winauth
Source File: HtmlLabel.cs
Source File: HtmlLabel.cs
public override void MeasureBounds() { base.MeasureBounds(); if(htmlContainer != null && AutoSize) Size = System.Drawing.Size.Round(htmlContainer.MaximumSize); }
0
4. Example
Project: Mist
Source File: HtmlPanel.cs
Source File: HtmlPanel.cs
public virtual void MeasureBounds() { htmlContainer.SetBounds(this is HtmlLabel ? new Rectangle(0, 0, 10, 10) : ClientRectangle); using (Graphics g = CreateGraphics()) { htmlContainer.MeasureBounds(g); } AutoScrollMinSize = Size.Round(htmlContainer.MaximumSize); }
0
5. Example
Project: winauth
Source File: HtmlPanel.cs
Source File: HtmlPanel.cs
public virtual void MeasureBounds() { htmlContainer.SetBounds(this is HtmlLabel ? new Rectangle(0, 0, 10, 10) : ClientRectangle); using (Graphics g = CreateGraphics()) { htmlContainer.MeasureBounds(g); } AutoScrollMinSize = Size.Round(htmlContainer.MaximumSize); }
0
6. 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
7. Example
Project: diagramnet
Source File: LabelElement.cs
Source File: LabelElement.cs
public void DoAutoSize() { if (text.Length == 0) return; Bitmap bmp = new Bitmap(1,1); Graphics g = Graphics.FromImage(bmp); SizeF sizeF = g.MeasureString(text, font, size.Width, format); Size sizeTmp = Size.Round(sizeF); if (size.Height < sizeTmp.Height) size.Height = sizeTmp.Height; }
0
8. Example
Project: OpenNlp
Source File: LithiumControl.cs
Source File: LithiumControl.cs
private int Measure(string text) { Graphics g = Graphics.FromHwnd(this.Handle); return Size.Round(g.MeasureString(text,Font)).Width +37; }
0
9. Example
Project: OpenNlp
Source File: LithiumControl.cs
Source File: LithiumControl.cs
public void Fit(ShapeBase shape) { Graphics g = Graphics.FromHwnd(this.Handle); Size s = Size.Round(g.MeasureString(shape.Text,Font)); shape.Width =s.Width +20; shape.Height = s.Height+8; }
0
10. 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
11. Example
Project: OpenNlp
Source File: ShapeBase.cs
Source File: ShapeBase.cs
public void Fit() { Graphics g = Graphics.FromHwnd(site.Handle); Size s = Size.Round(g.MeasureString(text,Font)); //if(childNodes.Count>0) //rectangle.Width =s.Width +10 + this.childNodes.Count.ToString().Length*5 +5; //the last part is to addition for the '[child count]' part //else rectangle.Width =s.Width +10; rectangle.Height = s.Height+8; Invalidate(); }
0
12. 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
13. Example
Project: Mist
Source File: HtmlToolTip.cs
Source File: HtmlToolTip.cs
void HtmlToolTip_Popup(object sender, PopupEventArgs e) { string text = this.GetToolTip(e.AssociatedControl); string font = string.Format(NumberFormatInfo.InvariantInfo, "font: {0}pt {1}", e.AssociatedControl.Font.Size, e.AssociatedControl.Font.FontFamily.Name); //Create fragment container container = new InitialContainer("<table class=htmltooltipbackground cellspacing=5 cellpadding=0 style=\"" + font + "\"><tr><td style=border:0px>" + text + "</td></tr></table>"); container.SetBounds(new Rectangle(0, 0, 10, 10)); container.AvoidGeometryAntialias = true; //Measure bounds of the container using (Graphics g = e.AssociatedControl.CreateGraphics()) { container.MeasureBounds(g); } //Set the size of the tooltip e.ToolTipSize = Size.Round(container.MaximumSize); }
0
14. Example
Project: winauth
Source File: HtmlToolTip.cs
Source File: HtmlToolTip.cs
void HtmlToolTip_Popup(object sender, PopupEventArgs e) { string text = this.GetToolTip(e.AssociatedControl); string font = string.Format(NumberFormatInfo.InvariantInfo, "font: {0}pt {1}", e.AssociatedControl.Font.Size, e.AssociatedControl.Font.FontFamily.Name); //Create fragment container container = new InitialContainer("<table class=htmltooltipbackground cellspacing=5 cellpadding=0 style=\"" + font + "\"><tr><td style=border:0px>" + text + "</td></tr></table>"); container.SetBounds(new Rectangle(0, 0, 10, 10)); container.AvoidGeometryAntialias = true; //Measure bounds of the container using (Graphics g = e.AssociatedControl.CreateGraphics()) { container.MeasureBounds(g); } //Set the size of the tooltip e.ToolTipSize = Size.Round(container.MaximumSize); }
0
15. Example
Project: diagramnet
Source File: DiagramUtil.cs
Source File: DiagramUtil.cs
public static Size MeasureString(string text, Font font) { Bitmap bmp = new Bitmap(1,1); Graphics g = Graphics.FromImage(bmp); SizeF sizeF = g.MeasureString(text, font); bmp.Dispose(); g.Dispose(); return Size.Round(sizeF); }
0
16. Example
Project: diagramnet
Source File: DiagramUtil.cs
Source File: DiagramUtil.cs
public static Size MeasureString(string text, Font font, SizeF layoutArea) { Bitmap bmp = new Bitmap(1,1); Graphics g = Graphics.FromImage(bmp); SizeF sizeF = g.MeasureString(text, font, layoutArea); bmp.Dispose(); g.Dispose(); return Size.Round(sizeF); }
0
17. Example
Project: diagramnet
Source File: DiagramUtil.cs
Source File: DiagramUtil.cs
public static Size MeasureString(string text, Font font, int width) { Bitmap bmp = new Bitmap(1,1); Graphics g = Graphics.FromImage(bmp); SizeF sizeF = g.MeasureString(text, font, width); bmp.Dispose(); g.Dispose(); return Size.Round(sizeF); }
0
18. Example
Project: diagramnet
Source File: DiagramUtil.cs
Source File: DiagramUtil.cs
public static Size MeasureString(string text, Font font, PointF origin, StringFormat stringFormat) { Bitmap bmp = new Bitmap(1,1); Graphics g = Graphics.FromImage(bmp); SizeF sizeF = g.MeasureString(text, font, origin, stringFormat); bmp.Dispose(); g.Dispose(); return Size.Round(sizeF); }
0
19. Example
Project: diagramnet
Source File: DiagramUtil.cs
Source File: DiagramUtil.cs
public static Size MeasureString(string text, Font font, SizeF layoutArea, StringFormat stringFormat) { Bitmap bmp = new Bitmap(1,1); Graphics g = Graphics.FromImage(bmp); SizeF sizeF = g.MeasureString(text, font, layoutArea, stringFormat); bmp.Dispose(); g.Dispose(); return Size.Round(sizeF); }
0
20. Example
Project: diagramnet
Source File: DiagramUtil.cs
Source File: DiagramUtil.cs
public static Size MeasureString(string text, Font font, int width, StringFormat format) { Bitmap bmp = new Bitmap(1,1); Graphics g = Graphics.FromImage(bmp); SizeF sizeF = g.MeasureString(text, font, width, format); bmp.Dispose(); g.Dispose(); return Size.Round(sizeF); }
0
21. Example
Project: diagramnet
Source File: DiagramUtil.cs
Source File: DiagramUtil.cs
public static Size MeasureString(string text, Font font, SizeF layoutArea, StringFormat stringFormat, out int charactersFitted, out int linesFilled) { Bitmap bmp = new Bitmap(1,1); Graphics g = Graphics.FromImage(bmp); SizeF sizeF = g.MeasureString(text, font, layoutArea, stringFormat, out charactersFitted, out linesFilled); bmp.Dispose(); g.Dispose(); return Size.Round(sizeF); }
0
22. Example
Project: pickaxe
Source File: CloseTabControl.cs
Source File: CloseTabControl.cs
protected override void OnDrawItem(DrawItemEventArgs e) { var bounds = e.Bounds; if (e.State != DrawItemState.Selected) bounds = new Rectangle(e.Bounds.X - 4, e.Bounds.Y - 2, e.Bounds.Width, e.Bounds.Height); var fullCaption = TabPages[e.Index].Text; var caption = fullCaption.Replace(Filler, ""); var captionSize = Size.Round(e.Graphics.MeasureString(caption, e.Font)); var closeSize = Size.Round(e.Graphics.MeasureString("x", e.Font)); e.Graphics.DrawString(caption, e.Font, Brushes.Black, bounds.X + 3, bounds.Y + 5); var closeStart = bounds.X + captionSize.Width + 4; var closeBounds = new Rectangle(closeStart, bounds.Y + 5, closeSize.Width, closeSize.Height); e.Graphics.DrawString("x", e.Font, Brushes.Black, closeBounds.X, closeBounds.Y); _closeBounds[e.Index] = closeBounds; e.DrawFocusRectangle(); }
0
23. Example
Project: WGestures
Source File: MetroButton.cs
Source File: MetroButton.cs
protected override void OnPaint(PaintEventArgs pevent) { var g = pevent.Graphics/n ..... /n //View Source file for more details /n }