1

Windows フォーム アプリケーションの UltraGrid コントロールを評価しています。集計行が個別に表示され、数式から取得された値が別の行に表示されることがわかりました。

これらの2行をマージする方法を知っている人はいますか?
たとえば、小計 value1 value2 value3

ありがとう、
ビジェイ

4

1 に答える 1

0

私はそれが可能だとは思わない。問題の 1 つは、キャプション テキストを配置する列を選択することです。ユーザーが列を移動するとどうなるでしょうか。キャプションが複数の列にまたがる場合はどうなりますか?

考えられる回避策として、カスタム サマリーを定義し、空の文字列を計算の戻り値として設定し、DisplayFormat プロパティを使用してテキストをキャプションとして使用するように設定することができます。

SummarySettings ss = grid.DisplayLayout.Bands[0].Summaries.Add("SummaryKeyName", 
                     SummaryType.Custom, new FakeCaptionSummary(), 
                     grid.DisplayLayout.Bands[0].Columns["ColumnUsedForCaption"],  
                     SummaryPosition.UseSummaryPositionColumn, 
                     grid.DisplayLayout.Bands[0].Columns["ColumnUsedForCaption"]);
ss.DisplayFormat = "Subtotals";

ICustomSummaryCalculator次に、インターフェースを実装するクラスを構築します

internal class FakeCaptionSummary : ICustomSummaryCalculator
{
    public FakeCaptionSummary()
    {
         // Empty constructor
    }
    // Called at the start of the custom summary calculation
    public void BeginCustomSummary(SummarySettings summarySettings, RowsCollection rows)
    {}
    // Called for each row in band of this summary
    public void AggregateCustomSummary(SummarySettings summarySettings, UltraGridRow row)
    {}
    // Called to get the return value to put in the SummaryRpw at the specified column
    public object EndCustomSummary(SummarySettings summarySettings, RowsCollection rows)
    {
        return "";
    }
}

ただし、このソリューションには、この回答の冒頭で概説したすべての欠点があることに注意してください。

于 2012-10-24T20:41:39.407 に答える