コード例 #1
0
        private void listView1_ItemMouseHover(object sender, ListViewItemMouseHoverEventArgs e)
        {
            CustomLegendItemEventArgs _customLegendItemEventArgs = new CustomLegendItemEventArgs((Series)e.Item.Tag);

            this.OnLegendItemToolTipShowing(ref _customLegendItemEventArgs);

            if ((this.listView1.Columns[0].Width
                 + this.listView1.Columns[1].Width
                 + this.GetTextWidth(e.Item)
                 + 20 //NOTE: ne vem točno zakaj tu, ma je točno
                 > this.listView1.Width) ||
                (!_customLegendItemEventArgs.ShowOnlyWhenTextDoesNotFitScreen))
            {
                if (string.IsNullOrEmpty(_customLegendItemEventArgs.AlternativeText))
                {
                    this.toolTip1.Show(
                        e.Item.SubItems[2].Text,
                        this,
                        this.PointToClient(System.Windows.Forms.Cursor.Position));
                }
                else
                {
                    this.toolTip1.ToolTipTitle = e.Item.SubItems[2].Text;

                    //NOTE: če je alternative text null, potem se ne prikaže nič (to se lahko uporabi)!
                    this.toolTip1.Show(
                        _customLegendItemEventArgs.AlternativeText,
                        this,
                        this.PointToClient(System.Windows.Forms.Cursor.Position));
                }
            }
        }
コード例 #2
0
 protected virtual void OnLegendItemToolTipShowing(ref CustomLegendItemEventArgs _customLegendItemEventArgs)
 {
     if (this.LegendItemToolTipShowing != null)
     {
         this.LegendItemToolTipShowing(
             this,
             _customLegendItemEventArgs);
     }
 }