Beispiel #1
0
        private void GenerateArrowSpaceForEndPoint(List <WorkflowLineDetail> lineEndPoints)
        {
            for (int i = 0; i < lineEndPoints.Count(); i++)
            {
                WorkflowLineDetail    line      = lineEndPoints[i];
                WorkflowLineDirection direction = line.GetLineDirection();

                Cell cell = GetIndexWorkFlowButtonCell(line.ToCell.RowIndex, line.ToCell.ColumnIndex);

                WorkflowColumnStyle columnStyle = null;
                WorkflowRowStyle    rowStyle    = null;

                switch (direction)
                {
                case WorkflowLineDirection.LEFT:
                    // add space on right side of Button cell.
                    columnStyle       = new WorkflowColumnStyle(SizeType.Absolute, WorkflowColumnType.DisplayArrow);
                    columnStyle.Width = ARROW_SPACE;

                    ParentWorkflow.InsertColumn(cell.ColumnIndex + 1, columnStyle);
                    break;

                case WorkflowLineDirection.TOP:
                    // add space on bottom side of Button cell.
                    rowStyle        = new WorkflowRowStyle(SizeType.Absolute, WorkflowRowType.DisplayArrow);
                    rowStyle.Height = ARROW_SPACE;

                    ParentWorkflow.InsertRow(cell.RowIndex + 1, rowStyle);
                    break;

                case WorkflowLineDirection.RIGHT:
                    // add space on left side of Button cell.
                    columnStyle       = new WorkflowColumnStyle(SizeType.Absolute, WorkflowColumnType.DisplayArrow);
                    columnStyle.Width = ARROW_SPACE;

                    ParentWorkflow.InsertColumn(cell.ColumnIndex, columnStyle);
                    break;

                case WorkflowLineDirection.BOTTOM:
                    // add space on top side of Button cell.
                    rowStyle        = new WorkflowRowStyle(SizeType.Absolute, WorkflowRowType.DisplayArrow);
                    rowStyle.Height = ARROW_SPACE;

                    ParentWorkflow.InsertRow(cell.RowIndex, rowStyle);
                    break;
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Drawing line follow line detail direction.
        /// </summary>
        /// <param name="g"></param>
        /// <param name="line">Line detail of start-end point that will drawing</param>
        private void DrawLine(Graphics g, WorkflowLineDetail line)
        {
            Cell fromCell = GetIndexWorkFlowButtonCell(line.FromCell.RowIndex, line.FromCell.ColumnIndex);
            Cell toCell   = GetIndexWorkFlowButtonCell(line.ToCell.RowIndex, line.ToCell.ColumnIndex);

            Cell startCell = null;
            Cell endCell   = null;

            WorkflowLineDirection direction = line.GetLineDirection();

            switch (direction)
            {
            case WorkflowLineDirection.LEFT:
                if (line.Status == WorkflowLineStatus.EndPoint)
                {
                    toCell.ColumnIndex += 1;
                }
                startCell = toCell;
                endCell   = fromCell;
                break;

            case WorkflowLineDirection.TOP:
                if (line.Status == WorkflowLineStatus.EndPoint)
                {
                    toCell.RowIndex += 1;
                }
                startCell = toCell;
                endCell   = fromCell;
                break;

            case WorkflowLineDirection.RIGHT:
                if (line.Status == WorkflowLineStatus.EndPoint)
                {
                    toCell.ColumnIndex -= 1;
                }
                startCell = fromCell;
                endCell   = toCell;
                break;

            case WorkflowLineDirection.BOTTOM:
                if (line.Status == WorkflowLineStatus.EndPoint)
                {
                    toCell.RowIndex -= 1;
                }
                startCell = fromCell;
                endCell   = toCell;
                break;

            case WorkflowLineDirection.NONE:
                return;
            }

            if (startCell == null || endCell == null)
            {
                return;
            }

            // Draw Straight-Line (Without Arrow).
            Rectangle lineRect = GetLineRectangle(startCell, endCell, direction);

            Image img = GetImageFromLineDirection(direction);

            //img = ImageHelper.GetThumbnailImage(img, lineRect.Width, lineRect.Height);
            img = ImageHelper.ResizeImage(img, lineRect.Width, lineRect.Height);

            g.DrawImage(img, lineRect);
            img.Dispose();

            if (line.Status == WorkflowLineStatus.EndPoint)
            {
                Image     arrowImg  = GetArrowImageFromLineDirection(direction);
                Rectangle arrowRect = GetArrowRectangle(toCell, direction);
                g.DrawImage(arrowImg, arrowRect);
            }
        }