コード例 #1
0
        public static void InitializeSpreadsheet(this SpreadsheetControl spreadsheetControl)
        {
            SpreadsheetUtils.InitializeWorkbook(spreadsheetControl.Document);
            spreadsheetControl.Options.Behavior.FunctionNameCulture = FunctionNameCulture.English;

            spreadsheetControl.DocumentLoaded += (s, e) =>
                                                 SpreadsheetUtils.InitializeWorkbook(((SpreadsheetControl)s).Document);

            spreadsheetControl.EmptyDocumentCreated += (s, e) =>
                                                       SpreadsheetUtils.InitializeWorkbook(((SpreadsheetControl)s).Document);

            spreadsheetControl.CellBeginEdit    += SpreadRichTextEditForm.SpreadsheetControl_CellBeginEdit;
            spreadsheetControl.PopupMenuShowing += SpreadRichTextEditForm.SpreadsheetControl_PopupMenuShowing;

            spreadsheetControl.KeyDown += SpreadsheetControl_KeyDown;

            spreadsheetControl.BeforeDragRange += SpreadsheetControl_BeforeDragRange;
            spreadsheetControl.DragOver        += SpreadsheetControl_DragOver;
            spreadsheetControl.DragDrop        += SpreadsheetControl_DragDrop;

            var oldMouseHandler = (IMouseHandlerService)spreadsheetControl.GetService(typeof(IMouseHandlerService));

            if (oldMouseHandler != null)
            {
                spreadsheetControl.RemoveService(typeof(IMouseHandlerService));
            }
            var newMouseHandler = new SCMouseHandlerService(spreadsheetControl, oldMouseHandler);

            spreadsheetControl.AddService(typeof(IMouseHandlerService), newMouseHandler);
        }