Hint for Annotation

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
TestAlways
Advanced
Posts: 228
Joined: Tue Aug 28, 2007 12:00 am
Location: Oregon, USA

Hint for Annotation

Post by TestAlways » Tue Jul 13, 2010 5:04 pm

I would like to create a custom hint for an annotation.

Is there any way to get a OnHint event for a annotation?

Ed Dressel

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Hint for Annotation

Post by Narcís » Wed Jul 14, 2010 9:55 am

Hi Ed,

No but you could use OnMouseMove event and annotation's Clicked method to check if the mouse is over an annotation tool and use delphi tooltips or windows hints then to display whatever you want.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

icecream
Newbie
Newbie
Posts: 20
Joined: Thu Aug 07, 2008 12:00 am

Re: Hint for Annotation

Post by icecream » Fri Jul 03, 2015 12:57 pm

There is no OnMouseMove event (at least in version 3) for annotation and since it is not of Control type, I cannot assign .Net ToolTip.
P.S.: not sure whether this should be placed in the .Net forum.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Hint for Annotation

Post by Narcís » Fri Jul 03, 2015 2:38 pm

Hello icecream,
icecream wrote:There is no OnMouseMove event (at least in version 3) for annotation and since it is not of Control type, I cannot assign .Net ToolTip.
I actually meant using TChart's MouseMove event and calling Annotation's Clicked method in it. Given that Annotation.Clicked is not a public method in .NET, you can create your custom annotation tool class like this:

Code: Select all

  public class MyAnnotation : Annotation
  {
    public MyAnnotation(Chart c) : base(c) { }

    public bool Clicked(Point p)
    {
      return Clicked(p.X, p.Y);
    }
  }
which can be used to implement what I suggested this way:

Code: Select all

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;

      tChart1.MouseMove += TChart1_MouseMove;

      Bar bar1 = new Bar(tChart1.Chart);
      bar1.FillSampleValues();

      tool = new MyAnnotation(tChart1.Chart);
      tool.Text = "HELLO WORLD";
    }

    MyAnnotation tool;
    private void TChart1_MouseMove(object sender, MouseEventArgs e)
    {
      if(tool.Clicked(e.Location))
      {
        MessageBox.Show("ANNOTATION CLICKED!");
      }
    }
icecream wrote:P.S.: not sure whether this should be placed in the .Net forum.
When I read .NET in your post I rushed moving it to the .NET forum. I forgot about the VCL history it could have behind. :?
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply