Winform quick development platform and winform Development Platform

Source: Internet
Author: User

Winform quick development platform and winform Development Platform

Gooflow has been used for web-oriented workflows. Currently, my winform development platform does not have good Workflow Components.

Let us know about the current project experience. A workflow control is necessary. Of course, the third-party components of winform workflow have been found online for a long time and have not found their favorite components.

It has absolute advantages for workflow components to be implemented through web. Of course, workflow components cannot be missing from my winform platform.

We use winform to implement our own Workflow Components. Currently, I think of a solution that can implement workflow through GDI + redrawing.

Just do what you want. For example, this is the workflow control that I drew through GDI +:

Design Philosophy:

In the control, we need some defined nodes, such as start, end, custom nodes, draw lines, and a content canvas.

Abstract The outlets, points, and items. Redraw.

Double Buffering is performed on the canvas to solve the problem of pop-up screen during painting.

Brief Introduction:

How to draw a grid in the canvas:

 var gridPen = new Pen(Color.Silver){    DashStyle = DashStyle.Custom,    DashPattern = new float[] { 2f, 2f }}; for (int column = 0; column < (int)Math.Ceiling((double)this.Width / (double)gridAverage); column++){    bufferGraphics.DrawLine(gridPen, new Point(column * gridAverage, 0), new Point(column * gridAverage, this.Height));} for (int row = 0; row < (int)Math.Ceiling((double)this.Height / (double)gridAverage); row++){    bufferGraphics.DrawLine(gridPen, new Point(0, row * gridAverage), new Point(this.Width, row * gridAverage));} 

Draw the node abstract type code:

Public enum ItemType {// <summary> /// Start /// </summary> Start, /// <summary> /// workflow /// </summary> Custom, /// <summary> /// Line /// </summary> Line, /// <summary> /// End /// </summary> End}

Draw connections

Public void DrawLine (Graphics grp, Pen pen) {if (m_startPoint = null | m_endPoint = null) return; var startX = m_startPoint.ItemLocate.X + m_startPoint.ItemImage.Width/2; var startY = vertex + m_startPoint.ItemImage.Height/2; var endX = vertex + m_endPoint.ItemImage.Width/2; var endY = vertex + m_endPoint.ItemImage.Height/2; # region calculates the starting point position if (vertex <vertex) {if (condition <condition-marker) {startX = m_startPoint.ItemLocate.X + m_startPoint.ItemImage.Width/2; startY = Gradient + m_startPoint.ItemImage.Height;} else if (condition <condition + m_endPoint.ItemImage.Height) {startX = duration + m_startPoint.ItemImage.Width; startY = m_startPoint.ItemLocate.Y + m_startPoint.ItemImage.Height/2;} else {startX = duration + m_startPoint.ItemImage.Width/2; startY = duration ;}} else {if (values <strong-weight) {startX = percent + m_startPoint.ItemImage.Width/2; startY = percent + m_startPoint.ItemImage.Height;} else if (values <strong + m_endPoint.ItemImage.Height) {startX = percent; startY = shard + m_startPoint.ItemImage.Height/2;} else {startX = m_startPoint.ItemLocate.X + m_startPoint.ItemImage.Width/2; startY = shard ;}# endregion # region calculates the end point location if) {if (consumed <strong-m_startPoint.ItemLocate.Y) {endX = consumed + m_endPoint.ItemImage.Width/2; endY = consumed;} else if (consumed <strong + m_endPoint.ItemImage.Height) {endX = consumed; endY = Gradient + m_endPoint.ItemImage.Height/2;} else {endX = Gradient + m_endPoint.ItemImage.Width/2; endY = Gradient + m_endPoint.ItemImage.Height;} else {if (partial <partial-height) {endX = centers + centers/2; endY = centers;} else if (centers <centers + m_endPoint.ItemImage.Height) {endX = centers + m_endPoint.ItemImage.Width; endY = centers + m_endPoint.ItemImage.Height/2 ;} else {endX = centers + m_endPoint.ItemImage.Width/2; endY = centers + m_endPoint.ItemImage.Height ;}# endregion var startPoint = new Point (startX, startY); var endPoint = new Point (endX, endY); grp. drawLine (pen, startPoint, endPoint );}

  

With 1.1 drops of effort, we can see its perfection at every point in time. He is also looking forward to his growth.

Related Article

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.