cliftonm / flowsharp Goto Github PK
View Code? Open in Web Editor NEWA WinForm Diagramming Tool
A WinForm Diagramming Tool
Being able to plug in shapes defined by others is going to a be a really useful feature for customization.
Technically, even the built-in shapes should be organized as a core plugin.
Implement shape rotation.
A nice to have feature when working on documents that need to fit on specific page sizes.
I'm drawing a diagram with boxes nested inside other boxes. While trying to resize the outer box, if an inner box is nearby then FlowSharp tends to prefer to drag that object instead, even if the resize handles of the selected box are closer to the mouse!
If the document changes (shapes added / removed) or shape property changes, the document should be flagged as changed and should prompt user for saving changes before exit/new/load.
Currently you have to save as a PNG and then print the PNG with a separate tool.
Dealing with multiple page layout, as well as centering on page, or shrinking to fit on page are must have features.
Related to snapping to grid spacing, changing the grid spacing would be useful.
Click on shape
Click on a field in the property grid and change it's value
Notice what you type appears in the edit box of the shape!
Note how the shape inside the groupbox is dragged. This only happens when you start the dragging operation on the ungrouped shape without releasing the mouse button.
Implement undo/redo feature.
As suggested in article comments.
If connection points of the group box and the inner children are too close together, a connector
snaps to the wrong connection point. Need to snap to the nearest connection, not just the first near connection.
I was drawing the diagram you can see on this screenshot:
The vertical lines are impossible to place after adding the text boxes ("Target", "Args[0]", etc.) because the vertical lines want very much to snap to the vertical edges of the (borderless) text boxes instead of to the outer box. It's probably best if
The exception in the screen shot is unrelated but caused me to lose some work, since clicking Continue seems to make the same exception again. I don't know what I did to cause it but here's the stack trace:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.ArgumentException: Parameter is not valid.
at System.Drawing.Pen.get_Width()
at FlowSharpLib.VerticalLine.get_UpdateRectangle()
at FlowSharpLib.GraphicElement.OnScreen()
at FlowSharpLib.BaseController.MoveElement(GraphicElement el, Point delta)
at FlowSharpLib.Line.MoveElementOrAnchor(GripType gt, Point delta)
at FlowSharpLib.CanvasController.<>c__DisplayClass8_0.b__0(Connection c)
at System.Collections.Generic.List1.ForEach(Action
1 action)
at FlowSharpLib.CanvasController.DragSelectedElements(Point delta)
at FlowSharpLib.MouseController.DragShapes()
at FlowSharpLib.MouseController.b__66_21()
at FlowSharpLib.MouseController.<>c.b__67_1(MouseRouter r)
at System.Collections.Generic.List1.ForEach(Action
1 action)
at FlowSharpLib.MouseController.HandleEvent(MouseAction action)
at FlowSharpLib.MouseController.b__64_2(Object sndr, MouseEventArgs args)
at System.Windows.Forms.Control.OnMouseMove(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Particularly for diagonal connectors, but dynamic connectors is general, the determination for selecting a connector should be based on whether the click point is near the line(s) rather than inside the overall display rectangle.
Implement zoom.
Other than arrows and diamonds.
How to recover gracefully from an exception, particularly one that persists because of an error with a drawing parameter. See Issue #32 for a screenshot example.
Drop a triangle, add a connector to one of the center connector points, resize the triangle. The connector snaps to a different connection point. Seem to only happen with triangle shapes.
Nothing more to explain about this one.
Observe that when the groupbox is moved, the connector double-moves.
Implement custom connection points.
Connection points should adjust proportionally when shape is sized.
In the update of about 20 hours ago, if you group together a box and anything else on top of that box, the group is impossible to move and impossible to duplicate, since clicking on the box selects the box, not the group. Even worse, it seems impossible to ungroup the group! The workaround is to select the box and delete it.
In fact, this problem occurs if you simply draw a box and group the box by itself.
Another comment: "Group" now has the unusual side-effect of creating an outer box. This is often useful for me, but it is not always useful. Perhaps there should be two grouping options, "Group in box" and just "Group" (which, consistent with other programs, does not create an outer box or creates an invisible outer box.)
As suggested in article comments.
Real routing, multiple corners, and automatic routing around shapes.
DONE: Corners and justification would be nice.
Text should also be clipped to not exceed extents of shape.
Multi-line text.
Connectors don't support text.
Text location for connectors.
Create a big box
Create a small box and drag it into the big box
Shift-click to select the big box
Ctrl+C
Ctrl+V
Notice that the big box is now on top, you have to move its z-order to the bottom for the little box to appear.
Select a shape, then click on the canvas. The shape is deselected but the property grid still shows the properties for the shape.
As suggested by reader comments.
Particularly an interesting problem when a shape is completely underneath another shape, and the cursor's selection point could select both. How do we show the completely hidden shape as selected?
Create a shape and disconnected connector.
Select both.
Drag the shape.
Notice that the connector doesn't move!
This is the result of getting rid of the "MoveAnchorOrShape" (or whatever it was called) method.
Combine a group of shapes to an "off page" connector shape and double-click to bring up the sub-shapes.
Rather than using the PropertyGrid. Creating an editor window would be ideal.
The request has been made to be able to prevent auto-snapping, particularly when moving a line or connector manually via keyboard arrow keys.
This issue has been resolved by ignoring the snap check when the connector or line is moved while holding down the Ctrl key.
As a result of commit 59012fe connected lines no longer move when shape is moved.
Create a box
Attach a vertical or horizontal line
Group the box
Observe how dragging the box results in trails and double-movement of the line.
Doesn't seem right -- the anchor shouldn't bounce around as we traverse X and Y axes.
Similar to Visual Studio's form designer, be able to identify and snap a shape as it's being dragged to other shape centers and edges.
Ability to snap to grid spacing.
Lines are a weird situation, that I'm not actually happy with myself. The reason that lines only snap when dragging is that, if the endpoint snaps, then the entire line would have to be moved left-right or up-down. This may actually be acceptable behavior. Will consider.
Currently, only the first discovered shape is selected. For overlapping shapes, it would be nice to rotate the selection between all shapes that qualify as selectable. This requires figuring out how to display a shape underneath another shape.
Replace PropertyGrid with a user friendly toolbar.
Be able to show (enable) common properties of multiple selected shapes, disable properties not common to multiple selected shapes.
See the TODO in DiagonalConnector.cs
Create a selection box that only partially includes a shape. Note that the partially included shape is part of the selected shapes. This is particularly annoying when grouping shapes with connectors that you don't want as part of the group.
Minimizing the window with or without shapes on it is triggering this error from line 119 of Canvas.cs which is creating a new Bitmap with the height and width passed in. I noticed the height was set to 0 but this is not what is causing the exception as I hardcoded several other heights in which changed nothing. From what I've gathered on SO, it's most likely a memory issue, however, the SO questions I've located are really separate use cases of Bitmap() such as a file stream from a png file and an image size that was taking up like 1.3GB and the issue there was memory cap.
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.ArgumentException: Parameter is not valid.
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
at FlowSharpLib.Canvas.CreateBitmap() in D:\Downloaded-Projects\FlowSharp\FlowSharpLib\Canvas.cs:line 119
at FlowSharpLib.Canvas.<Initialize>b__26_0(Object sndr, EventArgs args) in D:\Downloaded-Projects\FlowSharp\FlowSharpLib\Canvas.cs:line 64
at System.Windows.Forms.Control.OnResize(EventArgs e)
at System.Windows.Forms.Panel.OnResize(EventArgs eventargs)
at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows.Forms.Control.UpdateBounds()
at System.Windows.Forms.Control.WmWindowPosChanged(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
FlowSharp
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///D:/Downloaded-Projects/FlowSharp/bin/Debug/FlowSharp.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
FlowSharpLib
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///D:/Downloaded-Projects/FlowSharp/bin/Debug/FlowSharpLib.DLL
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Drawing.Design
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing.Design/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.Design.dll
----------------------------------------
Accessibility
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Select a shape (click)
Click-hold and drag
Release mouse button
Notice property grid is empty.
In fact, notice on mouse-down of the second click, the property grid goes empty.
Select two shapes, change a property like color. Position, size, text -- all properties of both shapes are updated to the same values.
Add a shape that auto-fits and image to the shape's dimensions.
Create two shapes and a connector attached to both shapes.
Group one of the shapes (without the connector)
Drag the surface.
Observe how the connector attached to the grouped shape disconnects and moves at 2x rate of canvas dragging.
Create a box and a connector attached to the box. Group both the box and the connector. Drag the groupbox. The connector's endpoint moves at 2x rate.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.