結合したセルのToolTipTextが正しく表示されない場合がある

文書番号 : 37720     文書種別 : 不具合     登録日 : 2015/01/20     最終更新日 : 2015/11/06
文書を印刷する
対象製品
CalendarGrid for Windows Forms 1.0J
状況
修正済み
詳細
結合したセルの上にマウスカーソルを移動した時、セルに設定されているツールチップテキスト(ToolTipText)が表示されない、または設定値と異なる文字列を表示することがあります。この現象は、次のいずれの場合に発生します。

・スクロールなどによって結合したセルの最初の位置が現在の表示範囲外に移動した場合(表示形式:リストビュースタイル)
・結合したセルの日付がカレンダー上で折り返して表示されている場合(表示形式:月スタイル/週スタイル/複数列スタイル)
回避方法
この問題はService Pack 2(v1.0.2015.1106)で修正されました。
不具合を修正した最新のサービスパックは、アップデートページ からダウンロードできます。

また、代替手段として、ToolTipTextプロパティは使用せずに.NET Frameworkのタイマー機能を利用して、セルのTagプロパティに設定した文字列をツールチップとして表示する方法が考えられます。

[Visual Basic]
Imports GrapeCity.Win.CalendarGrid

Public Class Form1

  Dim ToolTip1 As New ToolTip()
  Dim WithEvents Timer1 As New Timer()
  Dim ToolTipText As String

  Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    GcCalendarGrid1.Content(CDate("2015/1/15"))(1, 0).Value = "AAA"
    GcCalendarGrid1.Content(CDate("2015/1/15"))(1, 0).CellStyle.BackColor = Color.AliceBlue
    GcCalendarGrid1.Content(CDate("2015/1/15"))(1, 0).ColumnSpan = 6

    ' ToolTipTextの設定を無効にする
    'GcCalendarGrid1.Content(CDate("2015/1/15"))(1, 0).ToolTipText = "ツールチップ"
    GcCalendarGrid1.Content(CDate("2015/1/15"))(1, 0).Tag = "ツールチップ"
  End Sub

  Private Sub GcCalendarGrid1_CellMouseEnter(sender As Object, e As GrapeCity.Win.CalendarGrid.CalendarCellEventArgs) Handles GcCalendarGrid1.CellMouseEnter
    If (Not e.CellPosition.IsEmpty And e.CellPosition.Scope = CalendarTableScope.Content) Then
      Dim text = GcCalendarGrid1.Content(e.CellPosition.Date)(e.CellPosition.RowIndex, e.CellPosition.ColumnIndex).Tag
      If (text <> Nothing) Then
        Me.ToolTipText = text
        Timer1.Interval = 500
        Timer1.Start()
      Else
        Me.ToolTipText = Nothing
        ToolTip1.Hide(GcCalendarGrid1)
        Timer1.Stop()
      End If
    End If
  End Sub

  Private Sub GcCalendarGrid1_CellMouseLeave(sender As Object, e As GrapeCity.Win.CalendarGrid.CalendarCellEventArgs) Handles GcCalendarGrid1.CellMouseLeave
    ToolTip1.Hide(GcCalendarGrid1)
    Timer1.Stop()
  End Sub

  Private Sub OnTimerTick(sender As Object, e As EventArgs) Handles Timer1.Tick
    Dim point = GcCalendarGrid1.PointToClient(Control.MousePosition)
    point.Y += 20
    ToolTip1.Show(Me.ToolTipText, GcCalendarGrid1, point, 5000)
    Timer1.Stop()
  End Sub
End Class

[C#]
using GrapeCity.Win.CalendarGrid;

  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();
    }
    
    ToolTip ToolTip1 = new ToolTip();
    Timer Timer1 = new Timer();    
    String ToolTipText;

    private void Form1_Load(object sender, EventArgs e)
    {
      gcCalendarGrid1.Content[Convert.ToDateTime("2015/1/15")][1, 0].Value = "AAA";
      gcCalendarGrid1.Content[Convert.ToDateTime("2015/1/15")][1, 0].CellStyle.BackColor = Color.AliceBlue;
      gcCalendarGrid1.Content[Convert.ToDateTime("2015/1/15")][1, 0].ColumnSpan = 6;
      //ToolTipTextの設定を無効にする
      //gcCalendarGrid1.Content[Convert.ToDateTime("2015/1/15")][1, 0].ToolTipText = "ツールチップ";
      gcCalendarGrid1.Content[Convert.ToDateTime("2015/1/15")][1, 0].Tag = "ツールチップ";

      Timer1.Tick += new System.EventHandler(this.OnTimerTick);

    }

    private void gcCalendarGrid1_CellMouseEnter(object sender, GrapeCity.Win.CalendarGrid.CalendarCellEventArgs e)
    {
      if ((!e.CellPosition.IsEmpty & e.CellPosition.Scope == CalendarTableScope.Content))
      {
        object text = gcCalendarGrid1.Content[e.CellPosition.Date][e.CellPosition.RowIndex, e.CellPosition.ColumnIndex].Tag;
        if ((text != null))
        {
          this.ToolTipText = text.ToString();
          Timer1.Interval = 500;
          Timer1.Start();
        }
        else
        {
          this.ToolTipText = null;
          ToolTip1.Hide(gcCalendarGrid1);
          Timer1.Stop();
        }
      }
    }

    private void gcCalendarGrid1_CellMouseLeave(object sender, GrapeCity.Win.CalendarGrid.CalendarCellEventArgs e)
    {
      ToolTip1.Hide(gcCalendarGrid1);
      Timer1.Stop();
    }

    private void OnTimerTick(object sender, EventArgs e)
    {
      Point point = gcCalendarGrid1.PointToClient(Control.MousePosition);
      point.Y += 20;
      ToolTip1.Show(this.ToolTipText, gcCalendarGrid1, point, 5000);
      Timer1.Stop();
    }

  }

キーワード
CLDG10948