private void ImageDrawing(Bitmap srcBitmap, PictureBox srcPictureBox, bool isDashed) { if (InLink.LinkedTo != null) { InLink.ClearLinkButton(srcBitmap, srcPictureBox); } if (OutLink.LinkedTo != null) { OutLink.ClearLinkButton(srcBitmap, srcPictureBox); } Graphics graphics = Graphics.FromImage(srcBitmap); Rectangle rect = new Rectangle(this.X, this.Y, OperationBlock.Width, OperationBlock.Height); graphics.FillRectangle(Brushes.White, rect); Pen pen = new Pen(Color.Black, 2); pen.Alignment = PenAlignment.Inset; if (isDashed) { float[] dashValues = { 5, 5 }; pen.DashPattern = dashValues; } graphics.DrawRectangle(pen, rect); StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; graphics.DrawString(this.Text, new Font("Tahoma", 8), Brushes.Black, rect, sf); if (OutLink.LinkedTo != null) { LinkButton.DrawLinkOutToIn(OutLink.startLinkPoint, OutLink.LinkedTo.endLinkPoint, srcBitmap, srcPictureBox); } else { OutLink.DrawLinkButton(srcBitmap, srcPictureBox); } if (InLink.LinkedTo != null) { LinkButton.DrawLinkOutToIn(InLink.LinkedTo.startLinkPoint, InLink.endLinkPoint, srcBitmap, srcPictureBox); } else { InLink.DrawLinkButton(srcBitmap, srcPictureBox); } srcPictureBox.Invalidate(); }
private void ImageDrawing(Bitmap srcBitmap, PictureBox srcPictureBox, bool isDashed) { if (InLink.LinkedTo != null) { InLink.ClearLinkButton(srcBitmap, srcPictureBox); } if (OutLinkLeft.LinkedTo != null) { OutLinkLeft.ClearLinkButton(srcBitmap, srcPictureBox); } if (OutLinkRight.LinkedTo != null) { OutLinkRight.ClearLinkButton(srcBitmap, srcPictureBox); } Graphics graphics = Graphics.FromImage(srcBitmap); graphics.FillPolygon(Brushes.White, this.GetPointsArray()); Pen pen = new Pen(Color.Black, 2); pen.Alignment = PenAlignment.Inset; if (isDashed) { float[] dashValues = { 5, 5 }; pen.DashPattern = dashValues; } graphics.DrawPolygon(pen, this.GetPointsArray()); StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; graphics.DrawString(this.Text, new Font("Tahoma", 8), Brushes.Black, new Rectangle(MiddlePoint.X - 3 * (rightPoint.X - leftPoint.X) / 8, MiddlePoint.Y - 3 * (bottomPoint.Y - topPoint.Y) / 8, 6 * (rightPoint.X - leftPoint.X) / 8, 6 * (bottomPoint.Y - topPoint.Y) / 8), sf); graphics.DrawString("T", new Font("Tahoma", 12), Brushes.Black, new Rectangle(leftPoint.X - 15, leftPoint.Y - 15, 15, 15), sf); graphics.DrawString("F", new Font("Tahoma", 12), Brushes.Black, new Rectangle(rightPoint.X, rightPoint.Y - 15, 15, 15), sf); if (OutLinkLeft.LinkedTo != null) { LinkButton.DrawLinkOutToIn(OutLinkLeft.startLinkPoint, OutLinkLeft.LinkedTo.endLinkPoint, srcBitmap, srcPictureBox); } else { OutLinkLeft.DrawLinkButton(srcBitmap, srcPictureBox); } if (OutLinkRight.LinkedTo != null) { LinkButton.DrawLinkOutToIn(OutLinkRight.startLinkPoint, OutLinkRight.LinkedTo.endLinkPoint, srcBitmap, srcPictureBox); } else { OutLinkRight.DrawLinkButton(srcBitmap, srcPictureBox); } if (InLink.LinkedTo != null) { LinkButton.DrawLinkOutToIn(InLink.LinkedTo.startLinkPoint, InLink.endLinkPoint, srcBitmap, srcPictureBox); } else { InLink.DrawLinkButton(srcBitmap, srcPictureBox); } srcPictureBox.Invalidate(); }