private int CalcBlockInfoHeight(SelectedPointInfo blockInfo) { if (blockInfo.Height > 0) { return(blockInfo.Height); } return((int)(blockInfo.Lines.Count * blockInfo.LineHeight + blockInfo.Gap)); }
private int CalcBlockInfoWidth(SelectedPointInfo blockInfo) { if (blockInfo.Width > 0) { return(blockInfo.Width); } return(20); }
public void DrawGraph(Graphics g, ColorConfig colorConfig) { SelectedPointInfo blockInfo = this; Point p = blockInfo.StartPoint; int blockWidth = CalcBlockInfoWidth(blockInfo); int blockHeight = CalcBlockInfoHeight(blockInfo); g.FillRectangle(new SolidBrush(Color.Black), p.X, p.Y, blockWidth, blockHeight); g.DrawRectangle(colorConfig.Pen_CrossHair, p.X, p.Y, blockWidth, blockHeight); Point linePoint = p; linePoint.Y += blockInfo.Gap; for (int i = 0; i < blockInfo.Lines.Count; i++) { BlockLineInfo lineInfo = blockInfo.Lines[i]; g.DrawString(lineInfo.Text, lineInfo.TextFont, lineInfo.TextBrush, linePoint); linePoint.Y += blockInfo.LineHeight; } }