回复 3楼lonely红茶的帖子
相关代码如下:
- menuItem = new MenuItem();
- menuItem.Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.ContextMenu_Headers;
- menuItem.Click += new RoutedEventHandler(HeadersmenuItem_Click);
- contextMenu.Items.Add(menuItem);
复制代码
- private ContextMenu GetColumnHeaderContextMenu()
- {
- ContextMenu contextMenu = new System.Windows.Controls.ContextMenu();
- Image icon = new Image() { Source = new BitmapImage(new Uri(@"pack://application:,,,/SpreadSheetDesigner;component/Images/Cut.png")) };
- MenuItem menuItem = new MenuItem() { Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.ContextMenu_Cut, Command = DesignerCommands.Cut, Icon = icon };
- contextMenu.Items.Add(menuItem);
- icon = new Image() { Source = new BitmapImage(new Uri(@"pack://application:,,,/SpreadSheetDesigner;component/Images/Copy.png")) };
- menuItem = new MenuItem() { Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.ContextMenu_Copy, Command = DesignerCommands.Copy, Icon = icon };
- contextMenu.Items.Add(menuItem);
- icon = new Image() { Source = new BitmapImage(new Uri(@"pack://application:,,,/SpreadSheetDesigner;component/Images/Paste16.png")) };
- menuItem = new MenuItem() { Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.ContextMenu_Paste, Command = DesignerCommands.Paste, CommandParameter = "All", Icon = icon };
- contextMenu.Items.Add(menuItem);
- contextMenu.Items.Add(new Separator());
- menuItem = new MenuItem() { Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.InsertDialog_Title, Command = DesignerCommands.InsertEntireColumn };
- contextMenu.Items.Add(menuItem);
- menuItem = new MenuItem() { Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.DeleteDialog_Delete, Command = DesignerCommands.DeleteEntireColumn };
- contextMenu.Items.Add(menuItem);
- menuItem = new MenuItem() { Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.ContextMenu_ClearContents, Command = DesignerCommands.ClearContents };
- contextMenu.Items.Add(menuItem);
- contextMenu.Items.Add(new Separator());
- icon = new Image() { Source = new BitmapImage(new Uri(@"pack://application:,,,/SpreadSheetDesigner;component/Images/FormatCells.png")) };
- menuItem = new MenuItem() { Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.ContextMenu_FormatCells, Command = DesignerCommands.ShowFormatCellsDialog, CommandParameter = "Number", Icon = icon };
- contextMenu.Items.Add(menuItem);
- menuItem = new MenuItem() { Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.ContextMenu_ColumnWidth };
- menuItem.Click += new RoutedEventHandler(ColumnWidthMenuItem_Click);
- contextMenu.Items.Add(menuItem);
- menuItem = new MenuItem() { Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.ContextMenu_Hide, Command = DesignerCommands.HideColumns };
- contextMenu.Items.Add(menuItem);
- menuItem = new MenuItem() { Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.ContextMenu_Unhide, Command = DesignerCommands.UnhideColumns };
- contextMenu.Items.Add(menuItem);
- menuItem = new MenuItem();
- menuItem.Header = GrapeCity.Windows.SpreadSheet.Design.Properties.Resources.ContextMenu_Headers;
- menuItem.Click += new RoutedEventHandler(HeadersmenuItem_Click);
- contextMenu.Items.Add(menuItem);
- return contextMenu;
- }
复制代码 |