Hi Steema Support,
Many thanks for your reply and given examples but it is not same thing for what we are looking.
We cannot drag Rectangle Tool smoothly if we drag through Datagridview and show flickering. And when we export picture of teechart then it does not export Datagridview (Only show Rectangle Tool)
It will be very helpful for us, if you please provide any alternative solution as soon as possible.
Thanks in advance.
Thanks and Regards
Planoresearch
Grid in Rectangle tool
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Grid in Rectangle tool
Hello!
The only other solution I can think of is you manually draw your own grid within a custom RectangleTool, e.g.
again, using it like this:
The only other solution I can think of is you manually draw your own grid within a custom RectangleTool, e.g.
Code: Select all
public class MyRectangleTool : RectangleTool
{
public MyRectangleTool()
: this((Chart)null)
{
}
public MyRectangleTool(Chart c)
: base(c)
{
}
protected override void ChartEvent(EventArgs e)
{
base.ChartEvent(e);
if (e is AfterDrawEventArgs)
{
DrawGrid(Chart.Graphics3D, Bounds);
}
}
const double numCols = 3.0;
const double numRows = 3.0;
private void DrawGrid(Graphics3D g, Rectangle rect)
{
int horizIncrement = Utils.Round((double)rect.Width / numCols);
int vertIncrement = Utils.Round((double)rect.Height / numRows);
for (int i = rect.Left; i < rect.Right; i += horizIncrement)
{
g.VerticalLine(i, rect.Top, rect.Bottom - 1);
}
for (int i = rect.Top; i < rect.Bottom; i += vertIncrement)
{
g.HorizontalLine(rect.Left, rect.Right - 1, i);
}
}
}
Code: Select all
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
Line line = new Line(tChart1.Chart);
line.FillSampleValues();
MyRectangleTool tool = new MyRectangleTool(tChart1.Chart);
tool.Shape.Transparency = 0;
tool.Width = 100;
tool.Left = 100;
tool.Top = 100;
}
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: Grid in Rectangle tool
Hi Steema Support,
Can you write data in each row? We are using this g.TextOut(i, rect.Top, rect.Bottom - 1, "HI"); to write but this method write only one row not all. Image is attached
for (int i = rect.Left; i < rect.Right; i += horizIncrement)
{
g.VerticalLine(i, rect.Top, rect.Bottom - 1);
g.TextOut(i, rect.Top, rect.Bottom - 1, "HI");
} Thanks in advance.
Thanks & Regards
PlanoResearch
Can you write data in each row? We are using this g.TextOut(i, rect.Top, rect.Bottom - 1, "HI"); to write but this method write only one row not all. Image is attached
for (int i = rect.Left; i < rect.Right; i += horizIncrement)
{
g.VerticalLine(i, rect.Top, rect.Bottom - 1);
g.TextOut(i, rect.Top, rect.Bottom - 1, "HI");
} Thanks in advance.
Thanks & Regards
PlanoResearch
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Grid in Rectangle tool
This is a basic programming task which is not TeeChart API specific. You could do something like this:Amol wrote:Can you write data in each row?
Code: Select all
protected override void ChartEvent(EventArgs e)
{
base.ChartEvent(e);
if (e is AfterDrawEventArgs)
{
DrawGrid(Chart.Graphics3D, Bounds);
DrawCells(Chart.Graphics3D, Bounds);
}
}
private void DrawCells(Graphics3D g, Rectangle rect)
{
int horizIncrement = Utils.Round((double)rect.Width / numCols);
int vertIncrement = Utils.Round((double)rect.Height / numRows);
for (int i = rect.Left; i < rect.Right - 1; i += horizIncrement)
{
for (int j = rect.Top; j < rect.Bottom; j += vertIncrement)
{
g.TextOut(i, j, "BYE");
}
}
}
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: Grid in Rectangle tool
Hi Steema,
Thanks for your reply, We want to set the column size according to the text written in that column. Suppose first column have text of 100 character and second column column contains 10 character the column size should be accordingly. and can we wrap the text written in it.We are waiting for your response.
Thanks
Plano
Thanks for your reply, We want to set the column size according to the text written in that column. Suppose first column have text of 100 character and second column column contains 10 character the column size should be accordingly. and can we wrap the text written in it.We are waiting for your response.
Thanks
Plano
Last edited by Amol on Tue Nov 25, 2014 11:29 am, edited 1 time in total.
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Grid in Rectangle tool
You can use the Graphics3D.TextWidth() method to measure the length of strings, e.g.Amol wrote: Thanks for your reply, We want to set the column size according to the text written in that column. Suppose first column have text of 100 character and second column column contains 10 character the column size should be accordingly. We are waiting for your response.
Code: Select all
float width = g.TextWidth("BYE");
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 |