MultiRow内のセルにバルーンチップを表示する方法
対象製品
PlusPak for Windows Forms 6.0J
詳細
Service Pack 1 より提供された、GcBalloonTipのShow(Control, Rectangle, TipPosition, BalloonTipInformation)メソッドを使用して、グリッドコンポーネントのMultiRowのセルにバルーンチップを表示することが可能です。
以下のサンプルコードは、現在のセルを離れるときにバルーンチップを表示する方法を示しています。この方法は、SPREAD、DataGridViewなどのグリッドコントロールでも適用できます。
Service Pack 1 は、こちらからダウンロードできます。
Service Pack 1 を適用していない場合、次のようにShow(Point, BalloonTipInformation)メソッドを使用してください。
注意事項
以下のサンプルコードは、現在のセルを離れるときにバルーンチップを表示する方法を示しています。この方法は、SPREAD、DataGridViewなどのグリッドコントロールでも適用できます。
Service Pack 1 は、こちらからダウンロードできます。
[VB]
Imports GrapeCity.Win.Components
Private Sub GcMultiRow1_CellValidating(ByVal sender As System.Object, ByVal e As GrapeCity.Win.MultiRow.CellValidatingEventArgs) Handles GcMultiRow1.CellValidating
If e.FormattedValue = Nothing Then
Dim bound As Rectangle = GcMultiRow1.GetCellDisplayRectangle(e.RowIndex, e.CellIndex)
Dim balloon As New BalloonTipInformation
balloon.Text = "入力を確認してください。"
GcBalloonTip1.Show(GcMultiRow1, bound, TipPosition.BottomCenter, balloon)
End If
End Sub
Imports GrapeCity.Win.Components
Private Sub GcMultiRow1_CellValidating(ByVal sender As System.Object, ByVal e As GrapeCity.Win.MultiRow.CellValidatingEventArgs) Handles GcMultiRow1.CellValidating
If e.FormattedValue = Nothing Then
Dim bound As Rectangle = GcMultiRow1.GetCellDisplayRectangle(e.RowIndex, e.CellIndex)
Dim balloon As New BalloonTipInformation
balloon.Text = "入力を確認してください。"
GcBalloonTip1.Show(GcMultiRow1, bound, TipPosition.BottomCenter, balloon)
End If
End Sub
[C#]
using GrapeCity.Win.Components;
private void gcMultiRow1_CellValidating(object sender, GrapeCity.Win.MultiRow.CellValidatingEventArgs e)
{
if (e.FormattedValue == null)
{
Rectangle bound = gcMultiRow1.GetCellDisplayRectangle(e.RowIndex, e.CellIndex);
BalloonTipInformation balloon = new BalloonTipInformation();
balloon.Text = "入力を確認してください。";
gcBalloonTip1.Show(gcMultiRow1, bound, TipPosition.BottomCenter, balloon);
}
}
using GrapeCity.Win.Components;
private void gcMultiRow1_CellValidating(object sender, GrapeCity.Win.MultiRow.CellValidatingEventArgs e)
{
if (e.FormattedValue == null)
{
Rectangle bound = gcMultiRow1.GetCellDisplayRectangle(e.RowIndex, e.CellIndex);
BalloonTipInformation balloon = new BalloonTipInformation();
balloon.Text = "入力を確認してください。";
gcBalloonTip1.Show(gcMultiRow1, bound, TipPosition.BottomCenter, balloon);
}
}
Service Pack 1 を適用していない場合、次のようにShow(Point, BalloonTipInformation)メソッドを使用してください。
[VB]
Imports GrapeCity.Win.Components
Private Sub GcMultiRow1_CellValidating(ByVal sender As System.Object, ByVal e As GrapeCity.Win.MultiRow.CellValidatingEventArgs) Handles GcMultiRow1.CellValidating
If e.FormattedValue = Nothing Then
Dim balloon As New BalloonTipInformation
balloon.Text = "入力を確認してください。"
Dim pos As Point = GcMultiRow1.PointToScreen(GcMultiRow1.GetCellDisplayRectangle(GcMultiRow1.CurrentCell.RowIndex, GcMultiRow1.CurrentCell.CellIndex).Location)
GcBalloonTip1.Show(pos, balloon)
End If
End Sub
Imports GrapeCity.Win.Components
Private Sub GcMultiRow1_CellValidating(ByVal sender As System.Object, ByVal e As GrapeCity.Win.MultiRow.CellValidatingEventArgs) Handles GcMultiRow1.CellValidating
If e.FormattedValue = Nothing Then
Dim balloon As New BalloonTipInformation
balloon.Text = "入力を確認してください。"
Dim pos As Point = GcMultiRow1.PointToScreen(GcMultiRow1.GetCellDisplayRectangle(GcMultiRow1.CurrentCell.RowIndex, GcMultiRow1.CurrentCell.CellIndex).Location)
GcBalloonTip1.Show(pos, balloon)
End If
End Sub
[C#]
using GrapeCity.Win.Components;
private void gcMultiRow1_CellValidating(object sender, GrapeCity.Win.MultiRow.CellValidatingEventArgs e)
{
if (e.FormattedValue == null)
{
BalloonTipInformation balloon = new BalloonTipInformation();
balloon.Text = "入力を確認してください。";
Point pos = gcMultiRow1.PointToScreen(gcMultiRow1.GetCellDisplayRectangle(e.RowIndex, e.CellIndex).Location);
gcBalloonTip1.Show(pos, balloon);
}
}
using GrapeCity.Win.Components;
private void gcMultiRow1_CellValidating(object sender, GrapeCity.Win.MultiRow.CellValidatingEventArgs e)
{
if (e.FormattedValue == null)
{
BalloonTipInformation balloon = new BalloonTipInformation();
balloon.Text = "入力を確認してください。";
Point pos = gcMultiRow1.PointToScreen(gcMultiRow1.GetCellDisplayRectangle(e.RowIndex, e.CellIndex).Location);
gcBalloonTip1.Show(pos, balloon);
}
}
注意事項
- グリッドでスクロールが発生したとき、Service Packの有無に関係なく表示位置がずれる場合があります。
この文書は、以前は次のFAQ IDで公開されていました : 12684