[Interesting programming] time sequence diagrams can be drawn in this way
Zhou yinhui
See the following in detail:
In peacetime, we draw a sequence chart in the form of "Drag and Drop". The sequence chart is displayed in the form of "text editing", that is, we type some statements in the text box in the upper left corner of the window, click "generate" on the right, and a sequence chart is displayed in front of you. It's interesting.
The bunch of buttons on the right are used to help you "get lazy". Just tap a few texts and click the button to insert the text on the button to the text box on the left.
Don't get me wrong, I don't have that big capability and so much time to write a Sequence Graph generator, where the builder API is provided by the http://www.websequencediagrams.com/, will the http://www.websequencediagrams.com? Sytle = mystyle & message = mycode/As webresponse, it will return the generated image stream, where style = mystyle specifies the style of the generated image, message = mycode is passed in Code Such as text in the text box.
Public Enum Sequencediagramstyle
{
Rose,
Qsd,
Napkin,
Mscgen
}
Public static class sequencediagramsgenerator
{< br> private const string generatoruri = @" http://www.websequencediagrams.com/ " ;
Public Static Bitmap generatesequencediagram ( String Code, sequencediagramstyle style)
{
VaR data = " Style = " + Style + " & Message = " + Code;
webrequest request = webrequest. create (generatoruri + " ? " + data );
request. credentials = credentialcache. defaultcredentials;
VaR response=(Httpwebresponse) request. getresponse ();
Stream datastream=Response. getresponsestream ();
Bitmap BMP;
Try
{
BMP = New Bitmap (datastream );
}
Finally
{
Datastream. Close ();
Response. Close ();
}
ReturnBMP;
}
}
Of course, I personally think this is only for entertaining or drawing some simple sequence diagrams. The reason is very simple, the layout of an image is automatically generated, but cannot be customized. It does not support all the combination fragments.
For the syntax of statements that generate the sequence diagram, see here http://www.websequencediagrams.com/examples.html
Attach the demo. To obtain the hand-drawn effect, SetProgramSelect napkin from the drop-down list on the right.
Demo: http://files.cnblogs.com/zhouyinhui/SequenceDiagramsDemo.zip