internal Rectangle DrawEdge(Gdi32.HDC dc, Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects) { if (!ClientUtils.IsEnumValid_Masked(edges, (int)edges, (uint)(Edges.Left | Edges.Top | Edges.Right | Edges.Bottom | Edges.Diagonal))) { throw new InvalidEnumArgumentException(nameof(edges), (int)edges, typeof(Edges)); } if (!ClientUtils.IsEnumValid_NotSequential(style, (int)style, (int)EdgeStyle.Raised, (int)EdgeStyle.Sunken, (int)EdgeStyle.Etched, (int)EdgeStyle.Bump)) { throw new InvalidEnumArgumentException(nameof(style), (int)style, typeof(EdgeStyle)); } if (!ClientUtils.IsEnumValid_Masked(effects, (int)effects, (uint)(EdgeEffects.FillInterior | EdgeEffects.Flat | EdgeEffects.Soft | EdgeEffects.Mono))) { throw new InvalidEnumArgumentException(nameof(effects), (int)effects, typeof(EdgeEffects)); } RECT destRect = bounds; var contentRect = new RECT(); _lastHResult = DrawThemeEdge( this, dc, Part, State, ref destRect, (User32.EDGE)style, (User32.BF)edges | (User32.BF)effects | User32.BF.ADJUST, ref contentRect); return(contentRect); }
/// <summary> /// [See win32 equivalent.] /// </summary> public Rectangle DrawEdge(IDeviceContext dc, Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects) { if (dc == null) { throw new ArgumentNullException(nameof(dc)); } if (!ClientUtils.IsEnumValid_Masked(edges, (int)edges, (uint)(Edges.Left | Edges.Top | Edges.Right | Edges.Bottom | Edges.Diagonal))) { throw new InvalidEnumArgumentException(nameof(edges), (int)edges, typeof(Edges)); } if (!ClientUtils.IsEnumValid_NotSequential(style, (int)style, (int)EdgeStyle.Raised, (int)EdgeStyle.Sunken, (int)EdgeStyle.Etched, (int)EdgeStyle.Bump)) { throw new InvalidEnumArgumentException(nameof(style), (int)style, typeof(EdgeStyle)); } if (!ClientUtils.IsEnumValid_Masked(effects, (int)effects, (uint)(EdgeEffects.FillInterior | EdgeEffects.Flat | EdgeEffects.Soft | EdgeEffects.Mono))) { throw new InvalidEnumArgumentException(nameof(effects), (int)effects, typeof(EdgeEffects)); } NativeMethods.COMRECT rect = new NativeMethods.COMRECT(); using (WindowsGraphicsWrapper wgr = new WindowsGraphicsWrapper(dc, AllGraphicsProperties)) { HandleRef hdc = new HandleRef(wgr, wgr.WindowsGraphics.DeviceContext.Hdc); lastHResult = SafeNativeMethods.DrawThemeEdge(new HandleRef(this, Handle), hdc, part, state, new NativeMethods.COMRECT(bounds), (int)style, (int)edges | (int)effects | EdgeAdjust, rect); } return(Rectangle.FromLTRB(rect.left, rect.top, rect.right, rect.bottom)); }
public Rectangle DrawEdge(IDeviceContext dc, Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects) { if (dc == null) { throw new ArgumentNullException("dc"); } if (!System.Windows.Forms.ClientUtils.IsEnumValid_Masked(edges, (int) edges, 0x1f)) { throw new InvalidEnumArgumentException("edges", (int) edges, typeof(Edges)); } if (!System.Windows.Forms.ClientUtils.IsEnumValid_NotSequential(style, (int) style, new int[] { 5, 10, 6, 9 })) { throw new InvalidEnumArgumentException("style", (int) style, typeof(EdgeStyle)); } if (!System.Windows.Forms.ClientUtils.IsEnumValid_Masked(effects, (int) effects, 0xd800)) { throw new InvalidEnumArgumentException("effects", (int) effects, typeof(EdgeEffects)); } System.Windows.Forms.NativeMethods.COMRECT pContentRect = new System.Windows.Forms.NativeMethods.COMRECT(); using (WindowsGraphicsWrapper wrapper = new WindowsGraphicsWrapper(dc, TextFormatFlags.PreserveGraphicsTranslateTransform | TextFormatFlags.PreserveGraphicsClipping)) { HandleRef hdc = new HandleRef(wrapper, wrapper.WindowsGraphics.DeviceContext.Hdc); this.lastHResult = System.Windows.Forms.SafeNativeMethods.DrawThemeEdge(new HandleRef(this, this.Handle), hdc, this.part, this.state, new System.Windows.Forms.NativeMethods.COMRECT(bounds), (int) style, ((int) (edges | ((Edges) ((int) effects)))) | 0x2000, pContentRect); } return Rectangle.FromLTRB(pContentRect.left, pContentRect.top, pContentRect.right, pContentRect.bottom); }
public Rectangle DrawEdge(IDeviceContext dc, Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects) { if (dc == null) { throw new ArgumentNullException(nameof(dc)); } if (!ClientUtils.IsEnumValid_Masked(edges, (int)edges, (uint)(Edges.Left | Edges.Top | Edges.Right | Edges.Bottom | Edges.Diagonal))) { throw new InvalidEnumArgumentException(nameof(edges), (int)edges, typeof(Edges)); } if (!ClientUtils.IsEnumValid_NotSequential(style, (int)style, (int)EdgeStyle.Raised, (int)EdgeStyle.Sunken, (int)EdgeStyle.Etched, (int)EdgeStyle.Bump)) { throw new InvalidEnumArgumentException(nameof(style), (int)style, typeof(EdgeStyle)); } if (!ClientUtils.IsEnumValid_Masked(effects, (int)effects, (uint)(EdgeEffects.FillInterior | EdgeEffects.Flat | EdgeEffects.Soft | EdgeEffects.Mono))) { throw new InvalidEnumArgumentException(nameof(effects), (int)effects, typeof(EdgeEffects)); } using var wgr = new WindowsGraphicsWrapper(dc, AllGraphicsProperties); var hdc = new HandleRef(wgr, wgr.WindowsGraphics.DeviceContext.Hdc); RECT destRect = bounds; var contentRect = new RECT(); lastHResult = UxTheme.DrawThemeEdge(this, hdc, part, state, ref destRect, (User32.EDGE)style, (User32.BF)edges | (User32.BF)effects | User32.BF.ADJUST, ref contentRect); return(contentRect); }
/// <summary> /// [See win32 equivalent.] /// </summary> public Rectangle DrawEdge(IDeviceContext dc, Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects) { ArgumentNullException.ThrowIfNull(dc); using var hdc = new DeviceContextHdcScope(dc); return(DrawEdge(hdc, bounds, edges, style, effects)); }
private Edge CreateEdge(string start, string finish, EdgeStyle style) { var s = new Node(start, start); var f = new Node(finish, finish); return(new Edge(s, f, style)); }
public Rectangle DrawEdge(IDeviceContext dc, Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects) { if (dc == null) { throw new ArgumentNullException("dc"); } if (!System.Windows.Forms.ClientUtils.IsEnumValid_Masked(edges, (int)edges, 0x1f)) { throw new InvalidEnumArgumentException("edges", (int)edges, typeof(Edges)); } if (!System.Windows.Forms.ClientUtils.IsEnumValid_NotSequential(style, (int)style, new int[] { 5, 10, 6, 9 })) { throw new InvalidEnumArgumentException("style", (int)style, typeof(EdgeStyle)); } if (!System.Windows.Forms.ClientUtils.IsEnumValid_Masked(effects, (int)effects, 0xd800)) { throw new InvalidEnumArgumentException("effects", (int)effects, typeof(EdgeEffects)); } System.Windows.Forms.NativeMethods.COMRECT pContentRect = new System.Windows.Forms.NativeMethods.COMRECT(); using (WindowsGraphicsWrapper wrapper = new WindowsGraphicsWrapper(dc, TextFormatFlags.PreserveGraphicsTranslateTransform | TextFormatFlags.PreserveGraphicsClipping)) { HandleRef hdc = new HandleRef(wrapper, wrapper.WindowsGraphics.DeviceContext.Hdc); this.lastHResult = System.Windows.Forms.SafeNativeMethods.DrawThemeEdge(new HandleRef(this, this.Handle), hdc, this.part, this.state, new System.Windows.Forms.NativeMethods.COMRECT(bounds), (int)style, ((int)(edges | ((Edges)((int)effects)))) | 0x2000, pContentRect); } return(Rectangle.FromLTRB(pContentRect.left, pContentRect.top, pContentRect.right, pContentRect.bottom)); }
public void VisitEdge_edgeWithArrowTail_setsStatementAttributeValueArrowTail() { var style = new EdgeStyle(); style.ArrowTail = ArrowShape.Crow; var edge = CreateEdge("start", "finish", style); var renderer = new DotRenderer(); var statement = renderer.VisitEdge(edge); Assert.That(statement.AttributeValue(Dot.ArrowTail), Is.EqualTo("crow")); }
public void VisitEdge_edgeWithArrowTail_setsStatementAttributeArrowTail() { var style = new EdgeStyle(); style.ArrowTail = ArrowShape.Box; var edge = CreateEdge("start", "finish", style); var renderer = new DotRenderer(); var statement = renderer.VisitEdge(edge); Assert.That(statement.Attributes, Has.Member(Dot.ArrowTail)); }
public EdgeStyle ReadEdgeStyle(string edgeId) { var style = new EdgeStyle(edgeId); style.Style = myReader.ReadString(); style.Color = StyleConverter.GetBrush(myReader.ReadString()); return(style); }
/// <summary> /// [See win32 equivalent.] /// </summary> public Rectangle DrawEdge(IDeviceContext dc, Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects) { if (dc is null) { throw new ArgumentNullException(nameof(dc)); } using var hdc = new DeviceContextHdcScope(dc); return(DrawEdge(hdc, bounds, edges, style, effects)); }
public int UxThemeDrawThemeEdge (IntPtr hTheme, IDeviceContext dc, int iPartId, int iStateId, Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects, out Rectangle result) { XplatUIWin32.RECT BoundsRect = XplatUIWin32.RECT.FromRectangle (bounds); XplatUIWin32.RECT retval; int hresult = UXTheme.DrawThemeEdge (hTheme, dc.GetHdc (), iPartId, iStateId, ref BoundsRect, (uint)style, (uint)edges + (uint)effects, out retval); dc.ReleaseHdc (); result = retval.ToRectangle(); return hresult; }
protected void AddEdges(Graph g, NodeIndex index) { Node nd = nodeOf[index]; if (nd == null) { return; } foreach (EdgeIndex edge in dg.EdgesInto(index)) { NodeIndex sourceIndex = dg.SourceOf(edge); Node nd2 = nodeOf[sourceIndex]; if (nd2 == null) { continue; } EdgeStyle style = GetEdgeStyle(edge); Edge e; if ((style & EdgeStyle.Back) > 0) { e = g.AddEdge(nd.Attr.Id, nd2.Attr.Id); e.Attr.Color = Color.Red; e.Attr.ArrowheadAtSource = ArrowStyle.Normal; e.Attr.ArrowheadAtTarget = ArrowStyle.None; if ((style & EdgeStyle.Blue) > 0) { e.Attr.Color = Color.Purple; } } else { e = g.AddEdge(nd2.Attr.Id, nd.Attr.Id); if ((style & EdgeStyle.Blue) > 0) { e.Attr.Color = Color.Blue; } if ((style & EdgeStyle.Dimmed) > 0) { e.Attr.Color = Color.LightGray; } } if (edgeName != null) { e.LabelText = edgeName(edge); } if ((style & EdgeStyle.Bold) > 0) { e.Attr.LineWidth = 2; } if ((style & EdgeStyle.Dashed) > 0) { e.Attr.AddStyle(Style.Dashed); } } }
public void VisitEdge_edgeWithColor_setsStatementAttributeColor() { var style = new EdgeStyle(); style.Color = Color.SkyBlue; var edge = CreateEdge("start", "finish", style); var renderer = new DotRenderer(); var statement = renderer.VisitEdge(edge); Assert.That(statement.Attributes, Has.Member(Dot.Color)); }
public void VisitEdge_edgeWithConstraing_setsStatementAttributeConstraintValue() { var style = new EdgeStyle(); style.Constraining = false; var edge = CreateEdge("start", "finish", style); var renderer = new DotRenderer(); var statement = renderer.VisitEdge(edge); Assert.That(statement.AttributeValue(Dot.EdgeConstraint), Is.EqualTo("false")); }
public Rectangle DrawEdge(IDeviceContext dc, Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects) { if (dc == null) { throw new ArgumentNullException("dc"); } Rectangle result; last_hresult = VisualStyles.UxThemeDrawThemeEdge(theme, dc, this.part, this.state, bounds, edges, style, effects, out result); return(result); }
protected object AddEdge(string idFrom, string idTo, EdgeStyle edgeStyle, Color color) { GD.Edge edge = (GD.Edge)AddEdge(idFrom, idTo, edgeStyle); if (edge == null) { return(null); } GD.Color gcolor = new GD.Color(color.A, color.R, color.G, color.B); edge.Attr.Color = gcolor; return(edge); }
public static string GetStringValue(this EdgeStyle style) { switch (style) { case EdgeStyle.Normal: return("solid"); case EdgeStyle.Dashed: return("dashed"); default: return(""); } }
public override bool Equals(object obj) { var other = obj as IStyleSheet; if (other == null) { return(false); } return(base.Equals(other) && BaseStyle.Equals(other.BaseStyle) && ItemStyle.Equals(other.ItemStyle) && EdgeStyle.Equals(other.EdgeStyle) && BackColor.Equals(other.BackColor)); }
public void RenderGraph_givenArrowShape_generatesImage( [Values(ArrowShape.Box, ArrowShape.Crow, ArrowShape.Diamond, ArrowShape.Dot, ArrowShape.Inv, ArrowShape.None, ArrowShape.Normal, ArrowShape.Tee, ArrowShape.Vee)] ArrowShape arrowHead) { var edgeStyle = new EdgeStyle(); edgeStyle.ArrowHead = arrowHead; var startStyles = new List <ArrowShape> { ArrowShape.Box, ArrowShape.Crow, ArrowShape.Diamond, ArrowShape.Dot, ArrowShape.Inv, ArrowShape.None, ArrowShape.Normal, ArrowShape.Tee, ArrowShape.Vee }; var starts = new List <Node>(); var edges = new List <Edge>(); var finish = new Node("finish", "Finish"); foreach (var shape in startStyles) { var n = Enum.GetName(typeof(ArrowShape), shape); var s = new Node(n, n); edgeStyle.ArrowTail = shape; var e = new Edge(s, finish, edgeStyle); starts.Add(s); edges.Add(e); } var graphFactory = new GraphFactory(); var graph = graphFactory.CreateGraph(starts, finish, edges); var renderer = new DotRenderer(graph); var head = Enum.GetName(typeof(ArrowShape), arrowHead); var filename = head + ".png"; var image = renderer.RenderImage(); image.Save(filename); }
protected EdgeStyle GetEdgeStyle(EdgeIndex index) { EdgeStyle style = EdgeStyle.Black; if (edgeStyles != null) { foreach (var esp in edgeStyles) { if (esp.Predicate(index)) { style |= esp.Style; } } } return(style); }
public void RenderGraph_givenArrowShape_generatesImage( [Values(ArrowShape.Box, ArrowShape.Crow, ArrowShape.Diamond, ArrowShape.Dot, ArrowShape.Inv, ArrowShape.None, ArrowShape.Normal, ArrowShape.Tee, ArrowShape.Vee)] ArrowShape arrowHead) { var edgeStyle = new EdgeStyle(); edgeStyle.ArrowHead = arrowHead; var startStyles = new List<ArrowShape> { ArrowShape.Box, ArrowShape.Crow, ArrowShape.Diamond, ArrowShape.Dot, ArrowShape.Inv, ArrowShape.None, ArrowShape.Normal, ArrowShape.Tee, ArrowShape.Vee }; var starts = new List<Node>(); var edges = new List<Edge>(); var finish = new Node("finish", "Finish"); foreach (var shape in startStyles) { var n = Enum.GetName(typeof(ArrowShape), shape); var s = new Node(n, n); edgeStyle.ArrowTail = shape; var e = new Edge(s, finish, edgeStyle); starts.Add(s); edges.Add(e); } var graphFactory = new GraphFactory(); var graph = graphFactory.CreateGraph(starts, finish, edges); var renderer = new DotRenderer(graph); var head = Enum.GetName(typeof(ArrowShape), arrowHead); var filename = head + ".png"; var image = renderer.RenderImage(); image.Save(filename); }
/// <summary> /// Initializes a new instance of the <see cref="EdgeGenerator"/> class. /// </summary> public EdgeGenerator() { mNodes = new Dictionary <string, Node>(); mMissingNodeStyle = new NodeStyle { FillColor = Color.Red, FontColor = Color.White, Shape = NodeShape.Octagon }; mDependencyEdges = new EdgeStyle { ArrowHead = ArrowShape.Normal, ArrowTail = ArrowShape.None, Color = Color.Gray }; }
public static bool DrawEdge(this Graphics graphics, Rectangle rc, EdgeStyle edge, BorderFlags flags, Rectangle?_exclude = null) { var rect = new RECT(rc); using (var hdc = graphics.GetDisposableHdc()) { bool returnValue; if (_exclude != null) { var exclude = (Rectangle)_exclude; var regionFlags = ExcludeClipRect(hdc, exclude.Left, exclude.Top, exclude.Right, exclude.Bottom); } returnValue = DrawEdge(hdc, ref rect, edge, flags); return(returnValue); } }
public static void DrawVerticalTicks(Graphics g, Rectangle bounds, int numTicks, EdgeStyle edgeStyle) { if (((numTicks > 0) && (bounds.Height > 0)) && ((bounds.Width > 0) && (g != null))) { InitializeRenderer(VisualStyleElement.TrackBar.TicksVertical.Normal, 1); if (numTicks == 1) { visualStyleRenderer.DrawEdge(g, new Rectangle(bounds.X, bounds.Y, bounds.Width, 2), Edges.Top, edgeStyle, EdgeEffects.None); } else { float num = (bounds.Height - 2f) / (numTicks - 1f); while (numTicks > 0) { float num2 = bounds.Y + ((numTicks - 1) * num); visualStyleRenderer.DrawEdge(g, new Rectangle(bounds.X, (int) Math.Round((double) num2), bounds.Width, 2), Edges.Top, edgeStyle, EdgeEffects.None); numTicks--; } } } }
internal Rectangle DrawEdge(Gdi32.HDC dc, Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects) { SourceGenerated.EnumValidator.Validate(edges, nameof(edges)); SourceGenerated.EnumValidator.Validate(style, nameof(style)); SourceGenerated.EnumValidator.Validate(effects, nameof(effects)); RECT destRect = bounds; var contentRect = new RECT(); _lastHResult = DrawThemeEdge( this, dc, Part, State, ref destRect, (User32.EDGE)style, (User32.BF)edges | (User32.BF)effects | User32.BF.ADJUST, ref contentRect); return(contentRect); }
public void VisualStyleRenderer_DrawEdge_InvalidStyle_ThrowsInvalidEnumArgumentException(EdgeStyle style) { var renderer = new VisualStyleRenderer(VisualStyleElement.Button.PushButton.Normal); using var bitmap = new Bitmap(10, 10); using Graphics graphics = Graphics.FromImage(bitmap); Assert.Throws <InvalidEnumArgumentException>("style", () => renderer.DrawEdge(graphics, new Rectangle(1, 2, 3, 4), Edges.Bottom, style, EdgeEffects.FillInterior)); }
public int UxThemeDrawThemeEdge(IntPtr hTheme, IDeviceContext dc, int iPartId, int iStateId, Rectangle_ bounds, Edges edges, EdgeStyle style, EdgeEffects effects, out Rectangle_ result) { XplatUIWin32.RECT BoundsRect = XplatUIWin32.RECT.FromRectangle(bounds); XplatUIWin32.RECT retval; int hresult = UXTheme.DrawThemeEdge(hTheme, dc.GetHdc(), iPartId, iStateId, ref BoundsRect, (uint)style, (uint)edges + (uint)effects, out retval); dc.ReleaseHdc(); result = retval.ToRectangle(); return(hresult); }
public System.Drawing.Rectangle DrawEdge(System.Drawing.IDeviceContext dc, System.Drawing.Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects) { }
public void VisualStyleRenderer_DrawEdge_Invoke_Success(Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects) { // Don't verify anything, just make sure the interop call succeeds. var renderer = new VisualStyleRenderer(VisualStyleElement.Button.PushButton.Normal); using var bitmap = new Bitmap(10, 10); using Graphics graphics = Graphics.FromImage(bitmap); Rectangle result = renderer.DrawEdge(graphics, bounds, edges, style, effects); Assert.Equal(0, renderer.LastHResult); }
/// <summary> /// Renders a vertical tick. /// </summary> public static void DrawVerticalTicks(Graphics g, Rectangle bounds, int numTicks, EdgeStyle edgeStyle) { if (numTicks <= 0 || bounds.Height <= 0 || bounds.Width <= 0 || g == null) { return; } InitializeRenderer(VisualStyleElement.TrackBar.TicksVertical.Normal, 1); //trivial case if (numTicks == 1) { visualStyleRenderer.DrawEdge(g, new Rectangle(bounds.X, bounds.Y, bounds.Width, lineWidth), Edges.Top, edgeStyle, EdgeEffects.None); return; } float inc = ((float)bounds.Height - lineWidth) / ((float)numTicks - 1); while (numTicks > 0) { //draw the nth tick float y = bounds.Y + ((float)(numTicks - 1)) * inc; visualStyleRenderer.DrawEdge(g, new Rectangle(bounds.X, (int)Math.Round(y), bounds.Width, lineWidth), Edges.Top, edgeStyle, EdgeEffects.None); numTicks--; } }
public void VisitEdge_edgeWithConstraing_setsStatementAttributeConstraint() { var style = new EdgeStyle(); style.Constraining = false; var edge = CreateEdge("start", "finish", style); var renderer = new DotRenderer(); var statement = renderer.VisitEdge(edge); Assert.That(statement.Attributes, Has.Member(Dot.EdgeConstraint)); }
/// <include file='doc\VisualStyleRenderer.uex' path='docs/doc[@for="VisualStyleRenderer.DrawEdge"]/*' /> /// <devdoc> /// <para> /// [See win32 equivalent.] /// </para> /// </devdoc> public Rectangle DrawEdge(IDeviceContext dc, Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects) { if (dc == null) { throw new ArgumentNullException("dc"); } if (!ClientUtils.IsEnumValid_Masked(edges, (int)edges,(UInt32)(Edges.Left | Edges.Top | Edges.Right | Edges.Bottom | Edges.Diagonal))) { throw new InvalidEnumArgumentException("edges", (int)edges, typeof(Edges)); } if (!ClientUtils.IsEnumValid_NotSequential(style, (int)style, (int)EdgeStyle.Raised,(int)EdgeStyle.Sunken,(int)EdgeStyle.Etched,(int)EdgeStyle.Bump )) { throw new InvalidEnumArgumentException("style", (int)style, typeof(EdgeStyle)); } if (!ClientUtils.IsEnumValid_Masked(effects, (int)effects, (UInt32)(EdgeEffects.FillInterior | EdgeEffects.Flat | EdgeEffects.Soft | EdgeEffects.Mono))) { throw new InvalidEnumArgumentException("effects", (int)effects, typeof(EdgeEffects)); } NativeMethods.COMRECT rect = new NativeMethods.COMRECT(); using( WindowsGraphicsWrapper wgr = new WindowsGraphicsWrapper( dc, AllGraphicsProperties ) ) { HandleRef hdc = new HandleRef( wgr, wgr.WindowsGraphics.DeviceContext.Hdc ); lastHResult = SafeNativeMethods.DrawThemeEdge( new HandleRef( this, Handle ), hdc, part, state, new NativeMethods.COMRECT( bounds ), (int) style, (int) edges | (int) effects | EdgeAdjust, rect ); } return Rectangle.FromLTRB(rect.left, rect.top, rect.right, rect.bottom); }
public int UxThemeDrawThemeEdge (IntPtr hTheme, IDeviceContext dc, int iPartId, int iStateId, Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects, out Rectangle result) { result = Rectangle.Empty; return (int)S.S_FALSE; }
protected object AddEdge(string idFrom, string idTo, EdgeStyle edgeStyle) { if (_ignoreSidePanelItems && _sidePanel.Lookup(idFrom)) return null; if (_ignoreSidePanelItems && _sidePanel.Lookup(idTo)) return null; string key = idFrom + "?" + idTo; bool edgePresent = _addedEdges.ContainsKey(key); if (!_options.MultipleEdges && edgePresent) return null; // Don't add it to the graph yet. GD.Edge edge = new GD.Edge(idFrom, string.Empty, idTo); if (edgeStyle == EdgeStyle.NormalArrow) edge.Attr.ArrowHeadAtTarget = GD.ArrowStyle.Normal; else edge.Attr.ArrowHeadAtTarget = GD.ArrowStyle.None; if (_options.ShowOrphans) { // Things are easy if we're showing everything. if (!edgePresent) _addedEdges.Add(key, new List<object>()); _addedEdges[key].Add(edge); } else { // Nodes linked to themselves still count as orphans. if (idFrom != idTo) { // Update non orphan list. if (!_notOrphans.ContainsKey(idFrom)) _notOrphans.Add(idFrom, true); if (!_notOrphans.ContainsKey(idTo)) _notOrphans.Add(idTo, true); if (!edgePresent) _addedEdges.Add(key, new List<object>()); _addedEdges[key].Add(edge); } else { // We still want to show cyclic, as long as their not orphans. if (_notOrphans.ContainsKey(idFrom) || _notOrphans.ContainsKey(idTo)) { if (!edgePresent) _addedEdges.Add(key, new List<object>()); _addedEdges[key].Add(edge); } } } return edge; }
/// <summary> /// Add a single edge to the graph. /// </summary> /// <param name="start">Node from which edge starts.</param> /// <param name="end">Node the edge leads to.</param> /// <param name="label">Label for the edge</param> /// <param name="style">Style in which to render the label. If null, this will use the style whose name is the same as the label, if any, otherwise the first entry in EdgeStyles.</param> public void AddEdge(TNodeType start, TNodeType end, string label, EdgeStyle style = null) { Graph.AddEdge(start, end, label, style); }
protected object AddEdge(string idFrom, string idTo, EdgeStyle edgeStyle, Color color) { GD.Edge edge = (GD.Edge)AddEdge(idFrom, idTo, edgeStyle); if (edge == null) return null; GD.Color gcolor = new GD.Color(color.A, color.R, color.G, color.B); edge.Attr.Color = gcolor; return edge; }
public static void DrawHorizontalTicks(Graphics g, Rectangle bounds, int numTicks, EdgeStyle edgeStyle) { if (!IsSupported) throw new InvalidOperationException (); if (bounds.Height <= 0 || bounds.Width <= 0 || numTicks <= 0) return; VisualStyleRenderer vsr = new VisualStyleRenderer (VisualStyleElement.TrackBar.Ticks.Normal); double x = bounds.Left; double delta = (double)(bounds.Width - 2) / (double)(numTicks-1); for(int i = 0; i < numTicks; i++) { vsr.DrawEdge(g, new Rectangle((int)Math.Round(x), bounds.Top, 5, bounds.Height), Edges.Left, edgeStyle, EdgeEffects.None); x += delta; } }
public void SetUp() { mStyle = new EdgeStyle(); mStart = new Node("start", "Start"); mFinish = new Node("finish", "Finish"); }
public Rectangle DrawEdge (IDeviceContext dc, Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects) { if (dc == null) throw new ArgumentNullException ("dc"); Rectangle result; last_hresult = VisualStyles.UxThemeDrawThemeEdge (theme, dc, this.part, this.state, bounds, edges, style, effects, out result); return result; }
public static void DrawVerticalTicks(Graphics g, Rectangle bounds, int numTicks, EdgeStyle edgeStyle) { if (!IsSupported) { throw new InvalidOperationException(); } if (bounds.Height <= 0 || bounds.Width <= 0 || numTicks <= 0) { return; } VisualStyleRenderer vsr = new VisualStyleRenderer(VisualStyleElement.TrackBar.TicksVertical.Normal); double y = bounds.Top; double delta = (double)(bounds.Height - 2) / (double)(numTicks - 1); for (int i = 0; i < numTicks; i++) { vsr.DrawEdge(g, new Rectangle(bounds.Left, (int)Math.Round(y), bounds.Width, 5), Edges.Top, edgeStyle, EdgeEffects.None); y += delta; } }
[SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] // Using Graphics instead of IDeviceContext intentionally public static void DrawVerticalTicks(Graphics g, Rectangle bounds, int numTicks, EdgeStyle edgeStyle) { if (numTicks<=0 || bounds.Height <= 0 || bounds.Width<=0 || g == null ) { return; } InitializeRenderer(VisualStyleElement.TrackBar.TicksVertical.Normal, 1); //trivial case if (numTicks == 1) { visualStyleRenderer.DrawEdge(g, new Rectangle(bounds.X, bounds.Y, bounds.Width, lineWidth), Edges.Top, edgeStyle, EdgeEffects.None); return; } float inc = ((float)bounds.Height - lineWidth) / ((float)numTicks - 1); while (numTicks > 0) { //draw the nth tick float y = bounds.Y + ((float)(numTicks - 1)) * inc; visualStyleRenderer.DrawEdge(g, new Rectangle(bounds.X, (int)Math.Round(y), bounds.Width, lineWidth), Edges.Top, edgeStyle, EdgeEffects.None); numTicks--; } }
private Edge CreateEdge(string start, string finish, EdgeStyle style) { var s = new Node(start, start); var f = new Node(finish, finish); return new Edge(s, f, style); }