/
Form1.cs
26 lines (23 loc) · 865 Bytes
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System;
using System.Collections.Generic;
using System.Linq;
using DevExpress.XtraSpreadsheet.Services;
namespace SpreadsheetCustomCommand
{
public partial class Form1 : DevExpress.XtraBars.Ribbon.RibbonForm
{
#region #substituteservice
private void SubstituteService() {
ISpreadsheetCommandFactoryService service = (ISpreadsheetCommandFactoryService)spreadsheetControl1.GetService(typeof(ISpreadsheetCommandFactoryService));
CustomService customService = new CustomService(service);
spreadsheetControl1.ReplaceService<ISpreadsheetCommandFactoryService>(customService);
customService.Control = spreadsheetControl1;
}
#endregion #substituteservice
public Form1()
{
InitializeComponent();
SubstituteService();
}
}
}