0

現在、非常に古い VB 6 アプリケーションを .NET 4.5 WPF に移行しています。このアプリケーションは、古い Farpoint Spread 7.0 コンポーネントを使用しています。古いスプレッドシートはCellTypeButton広範囲に使用しますが、Spread for WTF はこのセル タイプを提供しません。また、WPF で Spread のカスタム セル タイプを作成する方法に関するサンプル コード、チュートリアル、ブログも見つかりませんでした。

Spread for WPFでボタンを作成することはできますか? 誰もこれを以前にやったことがありますか?これを行う方法に関するヒント、リソース、smaples またはブログへのリンクはありますか?

どうもありがとうございました!

4

1 に答える 1

0

CustomFloatingObjectを使用できます

次のコードは、浮動オブジェクトを作成します。

  • カスタム CustomFloatingObject クラスを実装します。
  • フローティング オブジェクト コンテンツを作成します。
  • フローティング オブジェクトをシートに追加します。

参照: http://helpcentral.componentone.com/NetHelp/SpreadWPF/webframe.html#floating.html

public class MyFloatingObject : GrapeCity.Windows.SpreadSheet.UI.CustomFloatingObject
    {
        public MyFloatingObject(string name, double x, double y, double width, double height)
            : base(name, x, y, width, height)
        {
        }

        public override FrameworkElement Content
        {
            get
            {
                Border border = new Border();

                StackPanel sp = new StackPanel();
                sp.Children.Add(new Button() { Content = "Button" });

                border.BorderThickness = new Thickness(1);
                border.BorderBrush = new SolidColorBrush(Colors.Black);
                border.Child = sp;
                return border;
            }
        }
    }

この浮動オブジェクトのインスタンスをワークシートに追加するには

MyFloatingObject mf = new MyFloatingObject("mf1", 10, 10, 200, 100);
gcSpreadSheet1.ActiveSheet.FloatingObjects.Add(mf);
于 2014-10-15T05:07:42.303 に答える