Is it possible to add a control to annotation?
Thanks,
Sachin
Annotation Control
Re: Annotation Control
Hello Sachin,
Please, you can say exactly what do you want to do? so we could try to find alternative solution, that works as you want in your application.
Thanks,
Is not possible to add a control to annotation tool.Is it possible to add a control to annotation?
Please, you can say exactly what do you want to do? so we could try to find alternative solution, that works as you want in your application.
Thanks,
Best Regards,
Sandra Pazos / 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: Annotation Control
I wanted to do something similar to that seen in the image attached for annotation
Sachin
Thanks,Sachin
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Annotation Control
Hi Sachin,
I don't think this can be done with an annotation tool. However, you can add other controls with a TChart as their parent. For example, in the code below I used a Panel and a MessageBox. You may use other controls but can't use a System.Windows.Form in a chart as it's a top-level control.
Hope this helps!
I don't think this can be done with an annotation tool. However, you can add other controls with a TChart as their parent. For example, in the code below I used a Panel and a MessageBox. You may use other controls but can't use a System.Windows.Form in a chart as it's a top-level control.
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
tChart1.Dock = DockStyle.Fill;
Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
line1.FillSampleValues();
tChart1.Click += new EventHandler(tChart1_Click);
tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
}
Panel myPanel;
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
if (myPanel != null)
{
myPanel.Dispose();
}
myPanel = new Panel();
tChart1.Controls.Add(myPanel);
myPanel.Location = new Point(e.X, e.Y);
Label myLabel = new Label();
myLabel.Text = "This is the text I want to use";
myPanel.Controls.Add(myLabel);
Button yesBtn = new Button();
yesBtn.Location = new Point(10, 20);
yesBtn.Text = "Yes";
myPanel.Controls.Add(yesBtn);
}
void tChart1_Click(object sender, EventArgs e)
{
DialogResult reply = MessageBox.Show(tChart1, "Tap either Yes or No", "Caption", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if ((reply == DialogResult.Yes))
{
// Process Yes
}
else
{
// Process No
}
}
Best Regards,
Narcís Calvet / 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: Annotation Control
I was able to create a custom similar to Msgbox as mentioned by you. I want to have a line going from Msgbox to the point on Series something similar to Annotation callout how can I acheive that?
Thanks,
Sachin
Thanks,
Sachin
Re: Annotation Control
Hi Sachin,
Taking Narcis' example, you could use OnAfterDraw event to draw a line from the desired point (in the example the sixth, valueindex 5)
Taking Narcis' example, you could use OnAfterDraw event to draw a line from the desired point (in the example the sixth, valueindex 5)
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
Steema.TeeChart.Styles.Line line1;
int MouseX, MouseY;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
tChart1.Dock = DockStyle.Fill;
line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
line1.FillSampleValues();
line1.Pointer.Visible = true;
MouseX = 0;
MouseY = 0;
tChart1.Click += new EventHandler(tChart1_Click);
tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
g.Line(line1.CalcXPos(5), line1.CalcYPos(5), MouseX, MouseY);
}
Panel myPanel;
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
if (myPanel != null)
{
myPanel.Dispose();
}
myPanel = new Panel();
tChart1.Controls.Add(myPanel);
myPanel.Location = new Point(e.X, e.Y);
Label myLabel = new Label();
myLabel.Text = "This is the text I want to use";
myPanel.Controls.Add(myLabel);
Button yesBtn = new Button();
yesBtn.Location = new Point(10, 20);
yesBtn.Text = "Yes";
myPanel.Controls.Add(yesBtn);
MouseX = e.X;
MouseY = e.Y;
tChart1.Refresh();
}
void tChart1_Click(object sender, EventArgs e)
{
DialogResult reply = MessageBox.Show(tChart1, "Tap either Yes or No", "Caption", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if ((reply == DialogResult.Yes))
{
// Process Yes
}
else
{
// Process No
}
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Annotation Control
Thanks that works
Thanks,
Sachin
Thanks,
Sachin