Page 1 of 1
Rectangular Tool
Posted: Mon Feb 25, 2008 5:24 pm
by 13045128
There seems to be a change in the way the rectangle tool is able to be dragged with the mouse. We used to be able to drag the rectangle with the mouse anywhere within the rectangle. Now we have to select the top left corner and drag. This has caused a number of issues one being that it is not obvious and difficult to find.
Is there a way of making it more intuitive for the next release?
Thanks
Posted: Mon Feb 25, 2008 7:31 pm
by narcis
Hi history,
Yes, this is a known issue, as you can read
here, which has already been fixed for the next maintenance release.
Posted: Tue Feb 26, 2008 1:11 pm
by 13045128
Narcis
When can we expect to see this next maintenance release?
Posted: Tue Feb 26, 2008 1:18 pm
by 13045128
Is there a way to control the painting of the rectangle tool. I would like to have more control on the text displayed within the rectangle tool. Ability to change the color and formating of the text displayed.
Thanks
Posted: Tue Feb 26, 2008 2:15 pm
by narcis
Hi history,
When can we expect to see this next maintenance release?
We expect the maintenance release to be ready during this week.
Is there a way to control the painting of the rectangle tool. I would like to have more control on the text displayed within the rectangle tool. Ability to change the color and formating of the text displayed.
Yes, you can use something like this:
Code: Select all
rectangle1.Text = "Hello World!";
rectangle1.Shape.Font.Color = Color.Lime;
rectangle1.Shape.Font.Size = 12;
rectangle1.Shape.Font.Bold = true;
Posted: Tue Feb 26, 2008 3:05 pm
by 13045128
What I would like to do is have multiple color text within the rectangle text box
Posted: Wed Feb 27, 2008 12:02 pm
by narcis
Hi history,
Rectangletool's lines can be painted in different colours, but this does require (at the moment) an override of one of its methods, as shown in the example:
Code: Select all
public partial class CustomLegendDrag : Form
{
public CustomLegendDrag()
{
InitializeComponent();
InitializeChart();
}
private Steema.TeeChart.Styles.Bar bar;
private MyRectangleTool rect;
private void InitializeChart()
{
tChart1.Series.Add(bar = new Steema.TeeChart.Styles.Bar());
bar.FillSampleValues();
tChart1.Legend.Visible = true;
tChart1.Zoom.Allow = false;
tChart1.Tools.Add(rect = new MyRectangleTool());
rect.Text = "Text \n Again";
rect.ColorLineOne = Color.Red;
}
private bool dragging = false;
private int x, y;
private void tChart1_MouseDown(object sender, MouseEventArgs e)
{
if (tChart1.Legend.Clicked(e.X, e.Y) != -1)
{
x = e.X;
y = e.Y;
tChart1.Legend.Left = x;
tChart1.Legend.Top = y;
tChart1.Legend.CustomPosition = true;
dragging = true;
}
}
private void tChart1_MouseUp(object sender, MouseEventArgs e)
{
dragging = false;
}
private void tChart1_MouseMove(object sender, MouseEventArgs e)
{
if (dragging)
{
x = e.X;
y = e.Y;
tChart1.Invalidate();
}
}
private void tChart1_AfterDraw(object sender,
Steema.TeeChart.Drawing.Graphics3D g)
{
if (dragging)
{
tChart1.Legend.Left = x;
tChart1.Legend.Top = y;
}
}
}
public class MyRectangleTool : RectangleTool
{
protected override void DrawString(Steema.TeeChart.Drawing.Graphics3D g,
int x, int y, int t, int tmpHeight, string[] s)
{
Color oldColor = g.Font.Color;
if (t == 1)
{
g.Font.Color = ColorLineOne;
}
base.DrawString(g, x, y, t, tmpHeight, s);
g.Font.Color = oldColor;
}
private Color colorLineOne;
public Color ColorLineOne
{
get { return colorLineOne; }
set { colorLineOne = value; }
}
}