|
| 1 | +--- |
| 2 | +title: Hide different elements in RadSpreadsheet for WinForms |
| 3 | +description: Learn how to hide different elements in RadSpreadsheet. |
| 4 | +type: how-to |
| 5 | +page_title: How to Hide Different Elements in RadSpreadsheet Control |
| 6 | +meta_title: How to Hide Different Elements in RadSpreadsheet Control |
| 7 | +slug: spreadsheet-hide-different-elements |
| 8 | +tags: spreadsheet, winforms, radspreadsheet, customization, readonly, zoom, trackbar, plus sign,FormulaBar,ContextMenu |
| 9 | +res_type: kb |
| 10 | +ticketid: 1695769 |
| 11 | +--- |
| 12 | + |
| 13 | +## Environment |
| 14 | + |
| 15 | +|Product Version|Product|Author| |
| 16 | +|----|----|----| |
| 17 | +|2025.3.812|RadSpreadsheet for WinForms|[Dinko Krastev](https://www.telerik.com/blogs/author/dinko-krastev)| |
| 18 | + |
| 19 | +## Description |
| 20 | + |
| 21 | +In this tutorial, we will demonstrate how you can hide different parts of the RadSpreadsheet control. |
| 22 | + |
| 23 | +## Solution |
| 24 | + |
| 25 | +#### **Hide Formula Bar** |
| 26 | + |
| 27 | +````C# |
| 28 | + |
| 29 | +this.radSpreadsheet1.SpreadsheetElement.FormulaBarHeight = 0; |
| 30 | +this.radSpreadsheet1.SpreadsheetElement.FormulaBar.Visibility = Telerik.WinControls.ElementVisibility.Collapsed; |
| 31 | + |
| 32 | +```` |
| 33 | + |
| 34 | +#### **Hide the zoom track bar and the scale button at the bottom** |
| 35 | + |
| 36 | +````C# |
| 37 | + |
| 38 | +(this.radSpreadsheet1.SpreadsheetElement.StatusBar.Children[1]).Visibility = Telerik.WinControls.ElementVisibility.Collapsed; |
| 39 | +(this.radSpreadsheet1.SpreadsheetElement.StatusBar.Children[2] as RadTrackBarElement).Visibility = Telerik.WinControls.ElementVisibility.Collapsed; |
| 40 | + |
| 41 | +```` |
| 42 | + |
| 43 | +#### **Suppress Context Menu** |
| 44 | + |
| 45 | +Subscribe to the `ContextMenuShowing` event and set the `Menu` property to `null`: |
| 46 | + |
| 47 | +````C# |
| 48 | + |
| 49 | +radSpreadsheet1.SpreadsheetElement.ContextMenuShowing += SpreadsheetElement_ContextMenuShowing; |
| 50 | + |
| 51 | +private void SpreadsheetElement_ContextMenuShowing(object sender, SpreadsheetContextMenuOpeningEventArgs e) |
| 52 | +{ |
| 53 | + e.Menu = null; |
| 54 | +} |
| 55 | + |
| 56 | +```` |
| 57 | + |
| 58 | +#### **Disable Selection Rectangle** |
| 59 | + |
| 60 | +The control does not provide a way to fully disable the selection. A possible solution here will be to disable the presenter in the editor: |
| 61 | + |
| 62 | + |
| 63 | +````C# |
| 64 | + |
| 65 | +protected override void OnLoad(EventArgs e) |
| 66 | +{ |
| 67 | + base.OnLoad(e); |
| 68 | + if (this.radSpreadsheet1.SpreadsheetElement.ActiveWorksheetEditor.ActivePresenter is NormalWorksheetEditorPresenter worksheetEditorPresenter) |
| 69 | + { |
| 70 | + worksheetEditorPresenter.Enabled = false; |
| 71 | + } |
| 72 | +} |
| 73 | + |
| 74 | +```` |
| 75 | + |
| 76 | +#### **Suppress Protected Worksheet Message** |
| 77 | + |
| 78 | +In general, the messages shown in the control will trigger the **MessageShowing** event. In thе event handler, you can check the NotificationType and handle the event. |
| 79 | + |
| 80 | +````C# |
| 81 | + |
| 82 | +private void SpreadsheetElement_MessageShowing(object sender, Telerik.WinForms.Controls.Spreadsheet.MessageShowingEventArgs e) |
| 83 | +{ |
| 84 | + if (e.NotificationType == Telerik.WinForms.Controls.Spreadsheet.Dialogs.MessageBoxNotificationType.ProtectedWorksheetError) |
| 85 | + { |
| 86 | + e.IsHandled = true; |
| 87 | + } |
| 88 | +} |
| 89 | + |
| 90 | +```` |
| 91 | + |
| 92 | +#### **Hide + Sign for Adding Worksheets** |
| 93 | + |
| 94 | +````C# |
| 95 | + |
| 96 | +protected override void OnLoad(EventArgs e) |
| 97 | +{ |
| 98 | + base.OnLoad(e); |
| 99 | + this.radSpreadsheet1.SpreadsheetElement.SheetSelector.Children[4].Children[1].Visibility = ElementVisibility.Collapsed; |
| 100 | +} |
| 101 | + |
| 102 | +```` |
| 103 | +## See Also |
| 104 | + |
| 105 | +* [RadSpreadsheet Overview](https://docs.telerik.com/devtools/winforms/controls/spreadsheet/overview) |
0 commit comments