[Interesting programming] time sequence diagrams can be drawn in this way

Source: Internet
Author: User
[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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.