Index: src/Common/DelftTools.Controls.Swf/Charting/Tools/ImageTool.cs =================================================================== diff -u -r18f9b18cab9da0c768badb3084415e993a5414ee -r5fc71a385897af92ccb092f2f969b5709afab85a --- src/Common/DelftTools.Controls.Swf/Charting/Tools/ImageTool.cs (.../ImageTool.cs) (revision 18f9b18cab9da0c768badb3084415e993a5414ee) +++ src/Common/DelftTools.Controls.Swf/Charting/Tools/ImageTool.cs (.../ImageTool.cs) (revision 5fc71a385897af92ccb092f2f969b5709afab85a) @@ -4,20 +4,22 @@ using System.Windows.Forms; using DelftTools.Controls.Swf.Charting.Customized; using Steema.TeeChart.Drawing; +using Steema.TeeChart.Tools; namespace DelftTools.Controls.Swf.Charting.Tools { /// /// Hack: This tool is used to plot small images (icons) in a figure. If we decide to leave TeeChart, /// this functionality is not one of the must haves of the first version of the new implementation. /// - public class ImageTool : Steema.TeeChart.Tools.Annotation, IImageTool + public class ImageTool : Annotation, IImageTool { + public event EventHandler ActiveChanged; + private readonly DeltaShellTChart teeChart; private Image image1; private string toolTip; - private readonly DeltaShellTChart teeChart; private Steema.TeeChart.Chart.ChartToolTip annotationToolTip; - + public ImageTool(DeltaShellTChart teeChart) : base(teeChart.Chart) { @@ -36,7 +38,10 @@ public new bool Active { - get { return base.Active; } + get + { + return base.Active; + } set { base.Active = value; @@ -47,11 +52,12 @@ } } - public event EventHandler ActiveChanged; - public Image Image { - get { return image1; } + get + { + return image1; + } set { image1 = value; @@ -62,7 +68,10 @@ public string ToolTip { - get { return toolTip; } + get + { + return toolTip; + } set { if (toolTip != null) @@ -93,14 +102,23 @@ public new int Height { - get { return base.Height == -1 ? image1.Height : base.Height; } + get + { + return base.Height == -1 ? image1.Height : base.Height; + } set { base.Height = value; ResizeImage(); } } + protected override void Dispose(bool disposing) + { + teeChart.MouseMove -= TeeChartMouseMove; + base.Dispose(disposing); + } + private void ResizeImage() { if (image1 == null) @@ -127,9 +145,9 @@ { return; } - + var mouseOnImage = (e.X <= Left + Width && e.X >= Left && e.Y >= Top && e.Y <= Top + Height); - + if (annotationToolTip == null && mouseOnImage) { annotationToolTip = chart.ToolTip; @@ -142,7 +160,7 @@ { return; } - + annotationToolTip.Hide(); annotationToolTip = null; } @@ -152,11 +170,5 @@ var tChart = sender as DeltaShellTChart; return tChart == null ? null : tChart.Chart; } - - protected override void Dispose(bool disposing) - { - teeChart.MouseMove -= TeeChartMouseMove; - base.Dispose(disposing); - } } } \ No newline at end of file