Hi,
We require fill properties (like Fill Color/Pattern, Transparency %, etc.) of Drawline Tool for following shapes:
1] Ellipse
2] Rectangle
3] Horizontal Parallel Line
4] Rectangle Parallel Line
Fill Ellipse Tool
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Fill Ellipse Tool
The DrawLine Tool enables a user to draw lines on a TeeChart. Lines only have Pen characteristics, unlike the shapes you mention which have both Pen and Brush characteristics. I'm not sure I understand how you want the DrawLine Tool to draw anything other than lines. Could you please explain?Quant wrote: We require fill properties (like Fill Color/Pattern, Transparency %, etc.) of Drawline Tool for following shapes:
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Fill Ellipse Tool
DrawLine Tool also provides a style property which has options for following shapes:The DrawLine Tool enables a user to draw lines on a TeeChart. Lines only have Pen characteristics, unlike the shapes you mention which have both Pen and Brush characteristics. I'm not sure I understand how you want the DrawLine Tool to draw anything other than lines. Could you please explain?
- Line,
HorizParallel,
VertParallel,
Rectangle,
Ellipse
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Fill Ellipse Tool
I have added this request as an enhancement to our issue tracking software with id=1405.Quant wrote:So we would like to request you to consider this requirement. Going further, if you are considering this requirement for future release please provide us some kind of solution to complete this requirement asap.
In the meantime, a workaround is relatively straightforward. Firstly, add this class to your code:
Code: Select all
public class MyDrawLine : DrawLine
{
public MyDrawLine(Chart c) : base(c)
{
Brush = new ChartBrush(c);
}
public ChartBrush Brush { get; set; }
protected override void ChartEvent(EventArgs e)
{
if (e is AfterDrawEventArgs)
{
if (Lines.Count > 0)
{
foreach (DrawLineItem l in Lines)
{
RedrawBrushLine(l);
}
}
if (drawing)
{
RedrawBrushLine(Selected);
}
}
base.ChartEvent(e);
}
private void RedrawBrushLine(DrawLineItem line)
{
Graphics3D g = Chart.Graphics3D;
g.Brush = Brush;
if ((Chart != null) && g.ValidState())
{
DrawLineStyle s = (line == null) ? this.Style : line.Style;
bool oldPen = g.Pen.Visible;
g.Pen.Visible = false;
ClipDrawingRegion(g);
if (line == null)
{
DoDrawLine(g, this.FromPoint, this.ToPoint, s);
}
else
{
DoDrawLine(g, AxisPoint(line.StartPos), AxisPoint(line.EndPos), s);
}
g.Pen.Visible = oldPen;
g.UnClip();
}
}
private void DoDrawLine(Graphics3D g, Point StartPos, Point EndPos, DrawLineStyle AStyle)
{
if (!base.Chart.Aspect.View3D)
{
if (AStyle != DrawLineStyle.Line)
{
if (AStyle == DrawLineStyle.Rectangle)
{
g.Rectangle(Utils.FromLTRB(StartPos.X, StartPos.Y, EndPos.X, EndPos.Y));
}
else if (AStyle == DrawLineStyle.Ellipse)
{
g.Ellipse(StartPos.X, StartPos.Y, EndPos.X, EndPos.Y);
}
}
}
else if (AStyle != DrawLineStyle.Line)
{
if (AStyle == DrawLineStyle.Rectangle)
{
g.Rectangle(Utils.FromLTRB(StartPos.X, StartPos.Y, EndPos.X, EndPos.Y), 0);
}
else if (AStyle == DrawLineStyle.Ellipse)
{
g.Ellipse(StartPos.X, StartPos.Y, EndPos.X, EndPos.Y, 0);
}
}
}
}
Code: Select all
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
Line line1 = new Line(tChart1.Chart);
line1.Add(2, 2);
line1.Add(8, 8);
MyDrawLine drawLine1 = new MyDrawLine(tChart1.Chart);
drawLine1.Pen.Color = Color.Yellow;
drawLine1.Pen.Width = 2;
drawLine1.Brush.Color = Color.Red;
Steema.TeeChart.Tools.DrawLineItem I = new Steema.TeeChart.Tools.DrawLineItem(drawLine1);
double tmp = line1.YValues.Range / 5.0;
I.StartPos = new PointDouble(5, line1.YValues.Maximum - tmp);
I.EndPos = new PointDouble(7, line1.YValues.Minimum + tmp);
I.Style = DrawLineStyle.Rectangle;
}
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Fill Ellipse Tool
Thanks for the help.
But we already updated DrawLine.cs which works as required. Check the below code snippet :
We also added following additional properties to DrawLine class as :
But we already updated DrawLine.cs which works as required. Check the below code snippet :
Code: Select all
private void DoDrawLine(Graphics3D g, Point StartPos, Point EndPos, DrawLineStyle AStyle)
{
bool oldBrush, oldPen;
if (AStyle != DrawLineStyle.Line)
{
if (AStyle == DrawLineStyle.HorizParallel)
{
g.HorizontalLine(StartPos.X, EndPos.X, StartPos.Y);
g.HorizontalLine(StartPos.X, EndPos.X, EndPos.Y);
if (IsFilled)
{
g.Brush.Color = FillColor;
g.Brush.Transparency = FillTransparency;
//Add Rectangle with Transparency
oldPen = g.Pen.Visible;
g.Pen.Visible = false;
g.Rectangle(Utils.FromLTRB(StartPos.X, StartPos.Y, EndPos.X, EndPos.Y));
g.Pen.Visible = oldPen;
}
}
else if (AStyle == DrawLineStyle.Rectangle)
{
oldBrush = g.Brush.Visible;
if (IsFilled)
{
g.Brush.Color = FillColor;
g.Brush.Transparency = FillTransparency;
g.Brush.Visible = true;
}
else
{
g.Brush.Visible = false;
}
g.Rectangle(Utils.FromLTRB(StartPos.X, StartPos.Y, EndPos.X, EndPos.Y));
g.Brush.Visible = oldBrush;
}
else if (AStyle == DrawLineStyle.Ellipse)
{
oldBrush = g.Brush.Visible;
if (IsFilled)
{
g.Brush.Color = FillColor;
g.Brush.Transparency = FillTransparency;
g.Brush.Visible = true;
}
else
{
g.Brush.Visible = false;
}
g.Ellipse(StartPos.X, StartPos.Y, EndPos.X, EndPos.Y);
g.Brush.Visible = oldBrush;
}
else
{
g.VerticalLine(StartPos.X, StartPos.Y, EndPos.Y);
g.VerticalLine(EndPos.X, StartPos.Y, EndPos.Y);
if (IsFilled)
{
g.Brush.Color = FillColor;
g.Brush.Transparency = FillTransparency;
//Add Rectangle with Transparency
oldPen = g.Pen.Visible;
g.Pen.Visible = false;
g.Rectangle(Utils.FromLTRB(StartPos.X, StartPos.Y, EndPos.X, EndPos.Y));
g.Pen.Visible = oldPen;
}
}
}
else
{
g.Line(StartPos.X, StartPos.Y, EndPos.X, EndPos.Y);
}
}
- IsFilled
FillColor
FillTransparency