private void DisableButtons(CodeExpression expression) { if (expression is CodeBinaryOperatorExpression) { this.DisableButtons(((CodeBinaryOperatorExpression)expression).Left); this.DisableButtons(((CodeBinaryOperatorExpression)expression).Right); } Button button = null; if (ButtonAndMenuData.TryGetValue(expression, out button)) { button.Visible = false; } }
private void DrawOrFlush(CodeExpression expression, ref StringBuilder stringBuffer, Graphics graphics, PointF startPoint, ref PointF point) { Button button = null; if (ButtonAndMenuData.TryGetValue(expression, out button)) { SizeF size = graphics.MeasureString(stringBuffer.ToString(), this.Font); graphics.DrawString(stringBuffer.ToString(), this.Font, Brushes.Black, point); stringBuffer = new StringBuilder(); point = new PointF(point.X + size.Width + 5, point.Y); button.Location = new Point((int)point.X - 5, (int)point.Y - 5); button.Tag = new ButtonInfo(expression, new RectangleF(startPoint, new SizeF(point.X - startPoint.X - 5, size.Height))); button.Visible = true; } else { this.Flush(ref stringBuffer, ref point, graphics); } }