ホーム
ブログ
フォーラムとナレッジベース
フォーラム
»
NetAdvantage Windows Forms
»
グリッドとツリー
»
【KBJ10034】全ての行を子行を含みループさせるには
【KBJ10034】全ての行を子行を含みループさせるには
0 ユーザーが評価
この投稿には確認済みの回答があります。 0 返信 | 1 サポーター
投稿
26
返信
[IG] 池原 大然
投稿済み: 2009/10/14 11:20
0 ユーザーが評価
【概要】
子行も含んだ全ての行をループさせる効率的な方法は再帰呼び出しを使用することです。このトピックでは実際の実装方法を紹介します。
【該当するコンポーネント】
WinGrid
【該当するバージョン】
6.1
【記事の種類】
How-to
【詳細】
子行も含んだ全ての行をループさせる効率的な方法は再帰呼び出しを使用することです。このトピックでは実際の実装として、TraverseAllRowsHelper を実装します。
In VB
Imports
Infragistics.Shared
Imports
Infragistics.Win
Imports
Infragistics.Win.UltraWinGrid
Private
Sub
Button40_Click(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
button40.Click
Dim
rowsCount
As
Integer
= 0
Dim
groupByRowsCount
As
Integer
= 0
'
ヘルパーメソッドを呼び出します
Me
.TraverseAllRowsHelper(
Me
.ultraGrid1.Rows, rowsCount, groupByRowsCount)
MessageBox.Show(
"UltraGrid
の行数: "
& rowsCount &
"
グループ化行: "
& groupByRowsCount)
End
Sub
Private
Sub
TraverseAllRowsHelper(
ByVal
rows
As
RowsCollection,
ByRef
rowsCount
As
Integer
,
ByRef
groupByRowsCount
As
Integer
)
Dim
row
As
UltraGridRow =
Nothing
For
Each
row
In
rows
If
TypeOf
row
Is
UltraGridGroupByRow
Then
Dim
groupByRow
As
UltraGridGroupByRow =
DirectCast
(row, UltraGridGroupByRow)
groupByRowsCount += 1
Else
rowsCount += 1
End
If
If
Not
Nothing
Is
row.ChildBands
Then
Dim
childBand
As
UltraGridChildBand =
Nothing
For
Each
childBand
In
row.ChildBands
Me
.TraverseAllRowsHelper(childBand.Rows, rowsCount, groupByRowsCount)
Next
End
If
Next
End
Sub
In C#
using
Infragistics.Shared;
using
Infragistics.Win;
using
Infragistics.Win.UltraWinGrid;
using
System.Diagnostics;
private
void
button40_Click(
object
sender, System.EventArgs e)
{
int
rowsCount = 0;
int
groupByRowsCount = 0;
//
ヘルパーメソッドを呼び出します
this
.TraverseAllRowsHelper(
this
.ultraGrid1.Rows,
ref
rowsCount,
ref
groupByRowsCount );
MessageBox.Show(
"UltraGrid
の行数: "
+ rowsCount.ToString() &
"
グループ化行: "
& groupByRowsCount.ToString());
}
private
void
TraverseAllRowsHelper( RowsCollection rows,
ref
int
rowsCount,
ref
int
groupByRowsCount )
{
foreach
( UltraGridRow row
in
rows )
{
if
( row
is
UltraGridGroupByRow )
{
UltraGridGroupByRow groupByRow = (UltraGridGroupByRow)row;
groupByRowsCount++;
}
else
{
rowsCount++;
}
if
(
null
!= row.ChildBands )
{
foreach
( UltraGridChildBand childBand
in
row.ChildBands )
{
this
.TraverseAllRowsHelper( childBand.Rows,
ref
rowsCount,
ref
groupByRowsCount );
}
}
}
}
以下に保存:
KB
,
UltraWinGrid
前へ
|
次へ
ページ 1 / 1 (1 項目) |
RSS
インフラジスティックス ジャパン