From 25dd9714a55662b5e2cda4583be4ab9b1303870c Mon Sep 17 00:00:00 2001 From: Smurf-IV Date: Sun, 9 Jul 2023 11:41:32 +0100 Subject: [PATCH] - completing checks for `?.Invoke(` usages - more nullable work --- .../Control Docking/KryptonAutoHiddenGroup.cs | 9 +- .../KryptonAutoHiddenProxyPage.cs | 1 + .../KryptonAutoHiddenSlidePanel.cs | 38 +- .../KryptonDockableNavigator.cs | 14 +- .../KryptonDockableWorkspace.cs | 4 +- .../Control Docking/KryptonFloatingWindow.cs | 34 +- .../Control Docking/KryptonSpace.cs | 72 +-- .../Control Docking/KryptonStorePage.cs | 2 +- .../Dragging/DockingDragManager.cs | 6 +- .../Dragging/DragTargetControlEdge.cs | 2 +- .../Elements Base/DockingElement.cs | 6 +- .../DockingElementOpenCollection.cs | 15 +- .../KryptonDockingAutoHiddenGroup.cs | 50 +- .../Elements Impl/KryptonDockingControl.cs | 11 +- .../Elements Impl/KryptonDockingDockspace.cs | 14 +- .../KryptonDockingEdgeAutoHidden.cs | 28 +- .../Elements Impl/KryptonDockingEdgeDocked.cs | 6 +- .../Elements Impl/KryptonDockingFloating.cs | 4 +- .../KryptonDockingFloatingWindow.cs | 8 +- .../Elements Impl/KryptonDockingFloatspace.cs | 2 +- .../Elements Impl/KryptonDockingManager.cs | 59 +- .../Elements Impl/KryptonDockingNavigator.cs | 22 +- .../Elements Impl/KryptonDockingSpace.cs | 34 +- .../Elements Impl/KryptonDockingWorkspace.cs | 2 +- .../Event Args/CancelUniqueNameEventArgs.cs | 2 +- .../Krypton.Docking/General/Definitions.cs | 2 +- .../Krypton.Docking/General/DockingHelper.cs | 11 +- .../General/DockingMultiUpdate.cs | 4 +- .../Palette/DockingManagerStrings.cs | 5 +- .../ButtonSpecs/ButtonSpecNavFixed.cs | 5 +- .../ButtonSpecNavFixedConverter.cs | 2 +- .../ButtonSpecs/ButtonSpecNavFormClose.cs | 8 +- .../ButtonSpecs/ButtonSpecNavFormMaximize.cs | 2 +- .../ButtonSpecs/ButtonSpecNavFormMinimize.cs | 15 +- .../ButtonSpecNavManagerLayoutHeaderBar.cs | 4 +- .../ButtonSpecs/ButtonSpecNavigator.cs | 5 +- .../Controller/DragViewController.cs | 10 +- .../Controller/OutlookMiniController.cs | 14 +- .../Controls Navigator/KryptonNavigator.cs | 208 ++---- .../Controls Visuals/VisualPopupPage.cs | 8 +- .../Dragging/DragFeedbackDocking.cs | 7 +- .../Dragging/DragFeedbackSolid.cs | 6 +- .../Krypton.Navigator/Dragging/DragManager.cs | 15 +- .../Krypton.Navigator/Dragging/DragTarget.cs | 6 +- .../Dragging/DragTargetNavigatorTransfer.cs | 2 +- .../Dragging/DropDockingIndicatorsRounded.cs | 13 +- .../Dragging/DropSolidWindow.cs | 4 +- .../Navigator/KryptonNavigatorActionList.cs | 2 +- .../Navigator/KryptonNavigatorDesigner.cs | 34 +- .../Navigator/KryptonPageDesigner.cs | 4 +- .../NavigatorPageCollectionEditor.cs | 7 +- .../Krypton.Navigator/Page/KryptonPage.cs | 88 +-- .../Palette/HeaderGroupMappingBase.cs | 15 +- .../Krypton.Navigator/Palette/NavigatorBar.cs | 70 +- .../Palette/NavigatorButton.cs | 62 +- .../Palette/NavigatorOutlook.cs | 35 +- .../Palette/NavigatorOutlookFull.cs | 30 +- .../Palette/NavigatorOutlookMini.cs | 30 +- .../Palette/NavigatorStack.cs | 35 +- .../Palette/NavigatorToolTips.cs | 61 +- .../Palette/PaletteBarRedirect.cs | 45 +- .../Palette/PaletteMetrics.cs | 10 +- .../Palette/PaletteNavContent.cs | 15 +- .../Palette/PaletteRibbonGeneralRedirect.cs | 15 +- .../ViewBuilderBarCheckButtonGroupInside.cs | 12 +- .../ViewBuilderBarCheckButtonGroupOnly.cs | 12 +- .../ViewBuilderBarCheckButtonGroupOutside.cs | 10 +- .../ViewBuilderBarCheckButtonOnly.cs | 10 +- .../View Builder/ViewBuilderBarItemBase.cs | 15 +- .../View Builder/ViewBuilderBarTabBase.cs | 2 +- .../View Builder/ViewBuilderBase.cs | 30 +- .../View Builder/ViewBuilderGroup.cs | 5 +- .../ViewBuilderHeaderBarCheckButtonBase.cs | 6 +- .../ViewBuilderHeaderBarTabGroup.cs | 45 +- .../View Builder/ViewBuilderHeaderGroup.cs | 5 +- .../View Builder/ViewBuilderItemBase.cs | 44 +- .../View Builder/ViewBuilderOutlookBase.cs | 41 +- .../View Builder/ViewBuilderOutlookFull.cs | 5 +- .../View Builder/ViewBuilderPanel.cs | 5 +- .../ViewBuilderStackCheckButtonBase.cs | 27 +- .../View Builder/ViewletHeaderGroup.cs | 43 +- .../View Builder/ViewletHeaderGroupOutlook.cs | 6 +- .../View Draw/ViewDrawNavCheckButtonBase.cs | 40 +- .../View Draw/ViewDrawNavOutlookMini.cs | 8 +- .../View Draw/ViewDrawNavRibbonTab.cs | 42 +- .../View Layout/ViewLayoutBar.cs | 7 +- .../View Layout/ViewLayoutBarForTabs.cs | 4 +- .../View Layout/ViewLayoutPageShow.cs | 6 +- .../ButtonSpec/ButtonSpecViewAppButton.cs | 6 +- .../ButtonSpec/ButtonSpecViewRibbon.cs | 4 +- .../Controller/AppButtonController.cs | 14 +- .../Controller/AppTabController.cs | 14 +- .../ButtonSpecAppButtonController.cs | 5 +- .../Controller/ButtonSpecRibbonController.cs | 4 +- .../Controller/CollapsedGroupController.cs | 19 +- .../Controller/ComboBoxController.cs | 3 +- .../Controller/ContextClickController.cs | 5 +- .../Controller/ContextTitleController.cs | 8 +- .../Controller/DomainUpDownController.cs | 3 +- .../Controller/GalleryButtonController.cs | 20 +- .../Controller/GalleryItemController.cs | 20 +- .../Controller/GroupButtonController.cs | 45 +- .../Controller/GroupCheckBoxController.cs | 29 +- .../Controller/GroupRadioButtonController.cs | 29 +- .../Controller/LeftDownButtonController.cs | 16 +- .../Controller/LeftUpButtonController.cs | 14 +- .../Controller/MaskedTextBoxController.cs | 3 +- .../Controller/NumericUpDownController.cs | 3 +- .../Controller/QATButtonController.cs | 5 +- .../Controller/RecentDocController.cs | 30 +- .../Controller/RepeatButtonController.cs | 14 +- .../Controller/RibbonTabController.cs | 12 +- .../Controller/RibbonTabsController.cs | 5 +- .../Controller/RichTextBoxController.cs | 3 +- .../Controller/TextBoxController.cs | 3 +- .../Controller/ViewHighlightController.cs | 25 +- .../Controls Ribbon/KryptonGallery.cs | 50 +- .../Controls Ribbon/KryptonGalleryRange.cs | 5 +- .../Controls Ribbon/KryptonRibbon.cs | 90 +-- .../Controls Ribbon/KryptonRibbonContext.cs | 10 +- .../Controls Ribbon/KryptonRibbonGroup.cs | 15 +- .../Controls Ribbon/KryptonRibbonQATButton.cs | 45 +- .../Controls Ribbon/KryptonRibbonRecentDoc.cs | 15 +- .../Controls Ribbon/KryptonRibbonTab.cs | 35 +- .../Controls Visuals/KeyTipControl.cs | 6 +- .../Controls Visuals/VisualPopupAppMenu.cs | 51 +- .../Controls Visuals/VisualPopupGroup.cs | 5 +- .../Controls Visuals/VisualPopupMinimized.cs | 6 +- .../VisualPopupQATOverflow.cs | 6 +- ...yptonRibbonGroupClusterCollectionEditor.cs | 5 +- ...tonRibbonGroupContainerCollectionEditor.cs | 6 +- ...KryptonRibbonGroupLinesCollectionEditor.cs | 5 +- ...ryptonRibbonGroupTripleCollectionEditor.cs | 5 +- .../KryptonRibbonQATButtonCollectionEditor.cs | 7 +- .../KryptonRibbonRecentDocCollectionEditor.cs | 5 +- .../Designers/KryptonGalleryDesigner.cs | 2 +- .../Designers/KryptonRibbonDesigner.cs | 30 +- .../KryptonRibbonGroupButtonDesigner.cs | 5 +- .../KryptonRibbonGroupCheckBoxDesigner.cs | 5 +- ...KryptonRibbonGroupClusterButtonDesigner.cs | 17 +- ...onRibbonGroupClusterColorButtonDesigner.cs | 17 +- .../KryptonRibbonGroupClusterDesigner.cs | 27 +- .../KryptonRibbonGroupColorButtonDesigner.cs | 5 +- .../KryptonRibbonGroupComboBoxDesigner.cs | 17 +- ...KryptonRibbonGroupCustomControlDesigner.cs | 17 +- ...ryptonRibbonGroupDateTimePickerDesigner.cs | 17 +- .../Designers/KryptonRibbonGroupDesigner.cs | 29 +- .../KryptonRibbonGroupDomainUpDownDesigner.cs | 17 +- .../KryptonRibbonGroupGalleryDesigner.cs | 17 +- .../KryptonRibbonGroupLabelDesigner.cs | 5 +- .../KryptonRibbonGroupLinesDesigner.cs | 49 +- ...KryptonRibbonGroupMaskedTextBoxDesigner.cs | 17 +- ...KryptonRibbonGroupNumericUpDownDesigner.cs | 15 +- .../KryptonRibbonGroupRadioButtonDesigner.cs | 5 +- .../KryptonRibbonGroupRichTextBoxDesigner.cs | 17 +- .../KryptonRibbonGroupSeparatorDesigner.cs | 9 +- .../KryptonRibbonGroupTextBoxDesigner.cs | 17 +- .../KryptonRibbonGroupTrackBarDesigner.cs | 17 +- .../KryptonRibbonGroupTripleDesigner.cs | 43 +- .../Designers/KryptonRibbonTabDesigner.cs | 11 +- .../General/AppButtonMenuProvider.cs | 5 +- .../Krypton.Ribbon/General/KeyTipInfo.cs | 5 +- .../KryptonRibbonGroupButton.cs | 63 +- .../KryptonRibbonGroupCheckBox.cs | 51 +- .../KryptonRibbonGroupCluster.cs | 30 +- .../KryptonRibbonGroupClusterButton.cs | 63 +- .../KryptonRibbonGroupClusterColorButton.cs | 87 +-- .../KryptonRibbonGroupColorButton.cs | 103 +-- .../KryptonRibbonGroupComboBox.cs | 254 ++------ .../KryptonRibbonGroupCustomControl.cs | 39 +- .../KryptonRibbonGroupDateTimePicker.cs | 224 ++----- .../KryptonRibbonGroupDomainUpDown.cs | 139 +--- .../KryptonRibbonGroupGallery.cs | 100 +-- .../Group Contents/KryptonRibbonGroupItem.cs | 5 +- .../Group Contents/KryptonRibbonGroupLabel.cs | 24 +- .../Group Contents/KryptonRibbonGroupLines.cs | 95 +-- .../KryptonRibbonGroupMaskedTextBox.cs | 189 ++---- .../KryptonRibbonGroupNumericUpDown.cs | 119 +--- .../KryptonRibbonGroupRadioButton.cs | 50 +- .../KryptonRibbonGroupRichTextBox.cs | 309 ++------- .../KryptonRibbonGroupSeparator.cs | 20 +- .../KryptonRibbonGroupTextBox.cs | 229 ++----- .../KryptonRibbonGroupTrackBar.cs | 69 +- .../KryptonRibbonGroupTriple.cs | 90 +-- .../Palette/PaletteGalleryRedirect.cs | 4 +- .../Palette/PaletteRibbonContextBack.cs | 5 +- .../Palette/PaletteRibbonContextDouble.cs | 5 +- .../Palette/PaletteRibbonDisabled.cs | 4 +- .../Palette/PaletteRibbonJustTab.cs | 14 +- .../Palette/PaletteRibbonRedirect.cs | 4 +- .../Krypton.Ribbon/Palette/RibbonAppButton.cs | 5 +- .../Palette/RibbonRecentDocsTitleToContent.cs | 5 +- .../Krypton.Ribbon/Palette/RibbonShortcuts.cs | 15 +- .../Palette/RibbonThemeManager.cs | 6 +- .../Krypton.Ribbon/Utilities/BiDictionary.cs | 5 +- .../View Base/ViewRibbonManager.cs | 15 +- .../View Base/ViewRibbonMinimizedManager.cs | 19 +- .../View Base/ViewRibbonPopupGroupManager.cs | 13 +- .../View Base/ViewRibbonQATOverflowManager.cs | 8 +- .../View Draw/ViewDrawRibbonAppMenuDocs.cs | 5 +- .../View Draw/ViewDrawRibbonAppMenuInner.cs | 7 +- .../ViewDrawRibbonAppMenuRecentDoc.cs | 14 +- .../View Draw/ViewDrawRibbonCaptionArea.cs | 24 +- .../View Draw/ViewDrawRibbonComposition.cs | 4 +- .../View Draw/ViewDrawRibbonContextTitle.cs | 8 +- .../View Draw/ViewDrawRibbonDesignCluster.cs | 10 +- .../View Draw/ViewDrawRibbonDesignGroup.cs | 5 +- .../ViewDrawRibbonDesignGroupContainer.cs | 20 +- .../ViewDrawRibbonDesignGroupLines.cs | 75 +-- .../ViewDrawRibbonDesignGroupTriple.cs | 70 +- .../View Draw/ViewDrawRibbonDesignTab.cs | 4 +- .../View Draw/ViewDrawRibbonDropArrow.cs | 12 +- .../View Draw/ViewDrawRibbonGalleryButton.cs | 10 +- .../View Draw/ViewDrawRibbonGalleryItem.cs | 5 +- .../View Draw/ViewDrawRibbonGroup.cs | 17 +- .../View Draw/ViewDrawRibbonGroupButton.cs | 47 +- .../ViewDrawRibbonGroupButtonBackBorder.cs | 15 +- .../View Draw/ViewDrawRibbonGroupCheckBox.cs | 65 +- .../ViewDrawRibbonGroupClusterButton.cs | 35 +- .../ViewDrawRibbonGroupClusterColorButton.cs | 35 +- .../ViewDrawRibbonGroupColorButton.cs | 47 +- .../View Draw/ViewDrawRibbonGroupComboBox.cs | 27 +- .../ViewDrawRibbonGroupCustomControl.cs | 26 +- .../ViewDrawRibbonGroupDateTimePicker.cs | 26 +- .../ViewDrawRibbonGroupDomainUpDown.cs | 33 +- .../View Draw/ViewDrawRibbonGroupGallery.cs | 48 +- .../View Draw/ViewDrawRibbonGroupImage.cs | 4 +- .../View Draw/ViewDrawRibbonGroupImageBase.cs | 4 +- .../View Draw/ViewDrawRibbonGroupLabel.cs | 30 +- .../ViewDrawRibbonGroupMaskedTextBox.cs | 26 +- .../ViewDrawRibbonGroupNumericUpDown.cs | 27 +- .../ViewDrawRibbonGroupRadioButton.cs | 63 +- .../ViewDrawRibbonGroupRichTextBox.cs | 27 +- .../View Draw/ViewDrawRibbonGroupSeparator.cs | 20 +- .../View Draw/ViewDrawRibbonGroupTextBox.cs | 27 +- .../View Draw/ViewDrawRibbonGroupTitle.cs | 5 +- .../View Draw/ViewDrawRibbonGroupTrackBar.cs | 27 +- .../ViewDrawRibbonGroupsBorderSynch.cs | 4 +- .../View Draw/ViewDrawRibbonQATBorder.cs | 2 +- .../View Draw/ViewDrawRibbonQATButton.cs | 9 +- .../View Draw/ViewDrawRibbonQATExtraButton.cs | 30 +- .../View Draw/ViewDrawRibbonQATOverflow.cs | 5 +- .../View Draw/ViewDrawRibbonTab.cs | 5 +- .../ViewLayoutRibbonContextTitles.cs | 2 +- .../ViewLayoutRibbonGalleryButtons.cs | 2 +- .../ViewLayoutRibbonGalleryItems.cs | 4 +- .../ViewLayoutRibbonGroupCluster.cs | 8 +- .../ViewLayoutRibbonGroupContent.cs | 2 +- .../View Layout/ViewLayoutRibbonGroupLines.cs | 6 +- .../ViewLayoutRibbonGroupTriple.cs | 8 +- .../View Layout/ViewLayoutRibbonGroups.cs | 6 +- .../ViewLayoutRibbonQATContents.cs | 10 +- .../View Layout/ViewLayoutRibbonQATMini.cs | 4 +- .../View Layout/ViewLayoutRibbonRowCenter.cs | 6 +- .../View Layout/ViewLayoutRibbonScrollPort.cs | 14 +- .../View Layout/ViewLayoutRibbonScroller.cs | 5 +- .../View Layout/ViewLayoutRibbonTabs.cs | 11 +- .../View Layout/ViewLayoutRibbonTabsArea.cs | 12 +- .../AccurateText/AccurateText.cs | 18 +- .../Krypton.Toolkit/ButtonSpec/ButtonSpec.cs | 17 +- .../ButtonSpec/ButtonSpecAny.cs | 7 +- .../ButtonSpec/ButtonSpecFormWindowClose.cs | 8 +- .../ButtonSpec/ButtonSpecFormWindowMax.cs | 2 +- .../ButtonSpec/ButtonSpecFormWindowMin.cs | 2 +- .../ButtonSpec/ButtonSpecManagerBase.cs | 45 +- .../ButtonSpecRemapByContentCache.cs | 10 +- .../ButtonSpec/ButtonSpecView.cs | 8 +- .../ContextMenu/KryptonContextMenuCheckBox.cs | 5 +- .../KryptonContextMenuCollections.cs | 12 +- .../ContextMenu/KryptonContextMenuComboBox.cs | 10 +- .../ContextMenu/KryptonContextMenuItemBase.cs | 2 +- .../KryptonContextMenuMonthCalendar.cs | 60 +- .../KryptonContextMenuRadioButton.cs | 5 +- .../Controller/ButtonController.cs | 7 +- .../Controller/TrackBarController.cs | 5 +- .../Controller/TrackPositionController.cs | 2 +- .../Controls Toolkit/KryptonBorderEdge.cs | 9 +- .../Controls Toolkit/KryptonBreadCrumb.cs | 29 +- .../Controls Toolkit/KryptonButton.cs | 11 +- .../Controls Toolkit/KryptonCheckBox.cs | 5 +- .../Controls Toolkit/KryptonCheckSet.cs | 4 +- .../Controls Toolkit/KryptonCheckedListBox.cs | 32 +- .../Controls Toolkit/KryptonColorButton.cs | 45 +- .../Controls Toolkit/KryptonColorDialog.cs | 2 +- .../Controls Toolkit/KryptonComboBox.cs | 54 +- .../Controls Toolkit/KryptonCommand.cs | 30 +- .../Controls Toolkit/KryptonContextMenu.cs | 19 +- .../KryptonCustomPaletteBase.cs | 51 +- .../Controls Toolkit/KryptonDataGridView.cs | 25 +- .../KryptonDataGridViewButtonCell.cs | 4 +- .../KryptonDataGridViewButtonColumn.cs | 2 +- .../KryptonDataGridViewCheckBoxCell.cs | 4 +- .../KryptonDataGridViewComboBoxCell.cs | 2 +- .../KryptonDataGridViewComboBoxColumn.cs | 2 +- ...yptonDataGridViewComboBoxEditingControl.cs | 11 +- .../KryptonDataGridViewDateTimePickerCell.cs | 6 +- ...KryptonDataGridViewDateTimePickerColumn.cs | 2 +- ...ataGridViewDateTimePickerEditingControl.cs | 11 +- .../KryptonDataGridViewDomainUpDownColumn.cs | 2 +- .../KryptonDataGridViewIconColumn.cs | 2 +- .../KryptonDataGridViewLinkCell.cs | 2 +- .../KryptonDataGridViewLinkColumn.cs | 2 +- .../KryptonDataGridViewMaskedTextBoxCell.cs | 13 +- .../KryptonDataGridViewMaskedTextBoxColumn.cs | 2 +- .../KryptonDataGridViewNumericUpDownCell.cs | 17 +- .../KryptonDataGridViewNumericUpDownColumn.cs | 2 +- .../KryptonDataGridViewTextBoxCell.cs | 2 +- .../KryptonDataGridViewTextBoxColumn.cs | 2 +- .../Controls Toolkit/KryptonDateTimePicker.cs | 100 +-- .../Controls Toolkit/KryptonDomainUpDown.cs | 17 +- .../Controls Toolkit/KryptonDropButton.cs | 33 +- .../KryptonFolderBrowserDialog.cs | 12 +- .../Controls Toolkit/KryptonFontDialog.cs | 2 +- .../Controls Toolkit/KryptonForm.cs | 42 +- .../Controls Toolkit/KryptonGroupBox.cs | 44 +- .../Controls Toolkit/KryptonGroupBoxPanel.cs | 6 +- .../Controls Toolkit/KryptonGroupPanel.cs | 10 +- .../Controls Toolkit/KryptonHeader.cs | 15 +- .../Controls Toolkit/KryptonHeaderGroup.cs | 53 +- .../Controls Toolkit/KryptonHelpCommand.cs | 6 +- .../Controls Toolkit/KryptonLabel.cs | 9 +- .../Controls Toolkit/KryptonLinkLabel.cs | 5 +- .../Controls Toolkit/KryptonLinkWrapLabel.cs | 8 +- .../Controls Toolkit/KryptonListBox.cs | 12 +- .../Controls Toolkit/KryptonListView.cs | 23 +- .../Controls Toolkit/KryptonMaskedTextBox.cs | 28 +- .../Controls Toolkit/KryptonMonthCalendar.cs | 11 +- .../Controls Toolkit/KryptonNumericUpDown.cs | 17 +- .../Controls Toolkit/KryptonOpenFileDialog.cs | 10 +- .../Controls Toolkit/KryptonPanel.cs | 9 +- .../Controls Toolkit/KryptonPrintDialog.cs | 2 +- .../Controls Toolkit/KryptonRadioButton.cs | 10 +- .../Controls Toolkit/KryptonRichTextBox.cs | 29 +- .../Controls Toolkit/KryptonSaveFileDialog.cs | 10 +- .../Controls Toolkit/KryptonScrollBar.cs | 36 +- .../Controls Toolkit/KryptonSeparator.cs | 10 +- .../Controls Toolkit/KryptonSplitContainer.cs | 12 +- .../KryptonTableLayoutPanel.cs | 10 +- .../Controls Toolkit/KryptonTaskDialog.cs | 5 +- .../KryptonTaskDialogCommand.cs | 15 +- .../Controls Toolkit/KryptonTextBox.cs | 85 +-- .../Controls Toolkit/KryptonTrackBar.cs | 16 +- .../Controls Toolkit/KryptonTreeView.cs | 16 +- .../Controls Toolkit/KryptonWebBrowser.cs | 8 +- .../Controls Toolkit/KryptonWrapLabel.cs | 8 +- .../Controls Visuals/CommonDialogHandler.cs | 5 +- .../Controls Visuals/KryptonMessageBoxForm.cs | 2 +- .../KryptonMultilineStringEditorForm.cs | 4 +- .../Controls Visuals/VisualBlur.cs | 8 +- .../VisualContainerControlBase.cs | 23 +- .../Controls Visuals/VisualContextMenu.cs | 8 +- .../Controls Visuals/VisualControlBase.cs | 34 +- .../Controls Visuals/VisualForm.cs | 34 +- .../Controls Visuals/VisualPanel.cs | 14 +- .../Controls Visuals/VisualPopup.cs | 2 +- .../Controls Visuals/VisualPopupManager.cs | 44 +- .../Controls Visuals/VisualShadowBase.cs | 8 +- .../Controls Visuals/VisualTaskDialog.cs | 24 +- .../ButtonSpecFormFixedConverter.cs | 2 +- .../Converters/PaletteDrawBordersConverter.cs | 2 +- .../Action Lists/KryptonButtonActionList.cs | 2 +- .../KryptonHeaderGroupActionList.cs | 2 +- .../Designers/KryptonBreadCrumbDesigner.cs | 2 +- .../KryptonBreadCrumbItemDesigner.cs | 4 +- .../Designers/KryptonComboBoxDesigner.cs | 2 +- .../Designers/KryptonContextMenuDesigner.cs | 4 +- .../KryptonContextMenuItemDesigner.cs | 4 +- .../KryptonContextMenuItemsDesigner.cs | 4 +- .../KryptonDateTimePickerColumnDesigner.cs | 2 +- .../Designers/KryptonGroupDesigner.cs | 2 +- .../Designers/KryptonGroupPanelDesigner.cs | 2 +- .../Designers/KryptonMonthCalendarDesigner.cs | 4 +- .../Designers/KryptonNumericUpDownDesigner.cs | 4 +- .../KryptonSplitContainerDesigner.cs | 7 +- .../Designers/KryptonSplitterPanelDesigner.cs | 6 +- .../Designers/KryptonTextBoxDesigner.cs | 2 +- .../Designers/ScrollBarControlDesigner.cs | 2 +- .../Editors/KryptonBreadCrumbItemsEditor.cs | 32 +- .../KryptonCheckButtonCollectionEditor.cs | 4 +- .../KryptonContextMenuCollectionEditor.cs | 5 +- .../KryptonContextMenuItemCollectionEditor.cs | 5 +- .../Editors/PaletteDrawBordersEditor.cs | 2 +- .../Other/KryptonSplitContainerBehavior.cs | 2 +- .../OverrideComboBoxStyleDropDownStyle.cs | 2 +- .../Other/PaletteDrawBordersSelector.cs | 2 +- .../UX/KryptonCheckButtonCollectionForm.cs | 2 +- .../UX/KryptonContextMenuCollectionForm.cs | 36 +- .../Krypton.Toolkit/General/BlurManager.cs | 4 +- .../Krypton.Toolkit/General/CommonHelper.cs | 35 +- .../Krypton.Toolkit/General/PlatformInvoke.cs | 6 +- .../General/Scroll Bars/HScrollSkin.cs | 12 +- .../General/Scroll Bars/VScrollSkin.cs | 20 +- .../Krypton.Toolkit/General/ShadowManager.cs | 2 +- .../General/TypedRestrictCollection.cs | 6 +- .../Krypton.Toolkit/General/XmlHelper.cs | 4 +- .../Palette Base/PaletteBack/PaletteBack.cs | 11 +- .../PaletteBack/PaletteBackColor1.cs | 4 +- .../PaletteBack/PaletteBackInheritRedirect.cs | 5 +- .../PaletteBorder/PaletteBorder.cs | 5 +- .../PaletteBorderInheritRedirect.cs | 5 +- .../PaletteContent/PaletteContent.cs | 10 +- .../PaletteContentInheritRedirect.cs | 5 +- .../PaletteDragDrop/PaletteDragDrop.cs | 66 +- .../PaletteElementColor.cs | 5 +- .../PaletteElementColorInheritRedirect.cs | 5 +- .../PaletteMetric/PaletteMetricRedirect.cs | 5 +- .../PaletteRedirect/PaletteRedirect.cs | 5 +- .../Palette Builtin/Base/PaletteBase.cs | 30 +- .../Bases/PaletteMicrosoft365Base.cs | 13 +- .../PaletteMicrosoft365BlackDarkMode.cs | 270 ++++---- .../PaletteMicrosoft365BlueDarkMode.cs | 260 ++++---- .../PaletteMicrosoft365BlueLightMode.cs | 260 ++++---- .../PaletteMicrosoft365SilverDarkMode.cs | 260 ++++---- .../PaletteMicrosoft365SilverLightMode.cs | 260 ++++---- .../PaletteMicrosoft365Blue.cs | 245 ++++--- .../PaletteMicrosoft365Black.cs | 270 ++++---- .../PaletteMicrosoft365DarkGray.cs | 249 ++++--- .../PaletteMicrosoft365LightGray.cs | 5 +- .../PaletteMicrosoft365Silver.cs | 245 ++++--- .../PaletteMicrosoft365White.cs | 249 ++++--- .../Bases/PaletteOffice2007Base.cs | 13 +- .../PaletteOffice2007BlackDarkMode.cs | 115 ++-- .../PaletteOffice2007BlueDarkMode.cs | 105 ++- .../PaletteOffice2007BlueLightMode.cs | 105 ++- .../PaletteOffice2007SilverDarkMode.cs | 105 ++- .../PaletteOffice2007SilverLightMode.cs | 105 ++- .../PaletteOffice2007DarkGray.cs | 88 ++- .../PaletteOffice2007LightGray.cs | 5 +- .../PaletteOffice2007White.cs | 92 ++- .../Official Themes/PaletteOffice2007Black.cs | 102 ++- .../Official Themes/PaletteOffice2007Blue.cs | 92 ++- .../PaletteOffice2007Silver.cs | 92 ++- .../Bases/PaletteOffice2010Base.cs | 13 +- .../PaletteOffice2010BlackDarkMode.cs | 104 ++- .../PaletteOffice2010BlueDarkMode.cs | 94 ++- .../PaletteOffice2010BlueLightMode.cs | 94 ++- .../PaletteOffice2010SilverDarkMode.cs | 94 ++- .../PaletteOffice2010SilverLightMode.cs | 94 ++- .../PaletteOffice2010DarkGray.cs | 81 ++- .../PaletteOffice2010LightGray.cs | 5 +- .../PaletteOffice2010White.cs | 81 ++- .../Official Themes/PaletteOffice2010Black.cs | 91 ++- .../Official Themes/PaletteOffice2010Blue.cs | 81 ++- .../PaletteOffice2010Silver.cs | 81 ++- .../Bases/PaletteOffice2013Base.cs | 13 +- .../PaletteOffice2013DarkGray.cs | 81 ++- .../Official Themes/PaletteOffice2013White.cs | 94 ++- .../PaletteProfessionalOffice2003.cs | 27 +- .../Professional/PaletteProfessionalSystem.cs | 27 +- .../Sparkle/Base/PaletteSparkleBase.cs | 13 +- .../PaletteSparkleBlueDarkMode.cs | 13 +- .../Palette Component/KryptonPaletteCargo.cs | 25 +- .../KryptonPaletteHeaderGroupState.cs | 25 +- .../KryptonPaletteImagesCheckBox.cs | 69 +- .../KryptonPaletteImagesContextMenu.cs | 19 +- .../KryptonPaletteImagesDropDownButton.cs | 29 +- .../KryptonPaletteImagesGalleryButton.cs | 29 +- .../KryptonPaletteImagesRadioButton.cs | 49 +- .../KryptonPaletteImagesTreeView.cs | 14 +- .../KryptonPaletteNavigatorStateBar.cs | 45 +- .../Palette Component/KryptonPaletteTMS.cs | 5 +- .../KryptonPaletteTMSButton.cs | 115 +--- .../KryptonPaletteTMSGrip.cs | 10 +- .../KryptonPaletteTMSMenu.cs | 75 +-- .../KryptonPaletteTMSMenuStrip.cs | 20 +- .../KryptonPaletteTMSRafting.cs | 10 +- .../KryptonPaletteTMSSeparator.cs | 10 +- .../KryptonPaletteTMSStatusStrip.cs | 20 +- .../KryptonPaletteTMSToolStrip.cs | 55 +- .../KryptonDataGridViewStyles.cs | 25 +- .../PaletteBorderEdgeRedirect.cs | 7 +- .../PaletteContentInheritNode.cs | 2 +- .../PaletteDataGridViewBackInherit.cs | 13 +- .../PaletteDataGridViewContentCommon.cs | 5 +- .../PaletteDataGridViewContentInherit.cs | 73 +-- .../PaletteDataGridViewContentStates.cs | 5 +- .../PaletteHeaderButtonRedirect.cs | 10 +- .../PaletteHeaderPaddingRedirect.cs | 5 +- .../Palette Controls/PaletteHeaderRedirect.cs | 10 +- .../PaletteInputControlBackStates.cs | 9 +- .../PaletteInputControlContentStates.cs | 5 +- .../PaletteSeparatorPadding.cs | 5 +- .../PaletteSeparatorPaddingRedirect.cs | 5 +- .../Rendering/RenderExpertHelpers.cs | 33 +- .../Rendering/RenderGlassHelpers.cs | 67 +- .../Rendering/RenderMementos.cs | 22 +- .../Rendering/RenderStandard.cs | 612 +++++++++--------- .../ShellDialogs/LocalCallWndProc.cs | 4 +- .../ShellDialogs/LocalCbtHook.cs | 6 +- .../ShellDialogs/ShellBrowserDialogTFM.cs | 12 +- .../ShellDialogs/ShellDialogWrapper.cs | 2 +- .../Krypton.Toolkit/Utilities/BiDictionary.cs | 5 +- .../Utilities/GraphicsExtensions.cs | 2 +- .../Utilities/RoundedRectangleF.cs | 2 +- .../Values/ButtonImageStates.cs | 20 +- .../Krypton.Toolkit/Values/ButtonValues.cs | 20 +- .../Krypton.Toolkit/Values/CheckBoxImages.cs | 65 +- .../Values/CheckButtonImageStates.cs | 15 +- .../Values/ColorButtonValues.cs | 33 +- .../Values/ContextMenuImages.cs | 15 +- .../Values/DropDownButtonImages.cs | 25 +- .../Values/GalleryButtonImages.cs | 25 +- .../Values/HeaderValuesBase.cs | 20 +- .../Krypton.Toolkit/Values/LabelValues.cs | 20 +- .../Values/PopupPositionValues.cs | 15 +- .../Values/RadioButtonImages.cs | 45 +- .../Krypton.Toolkit/Values/ShadowValues.cs | 30 +- .../Krypton.Toolkit/Values/TreeViewImages.cs | 10 +- .../InternalKryptonStringCollectionEditor.cs | 4 +- .../Krypton.Toolkit/View Base/ViewBase.cs | 6 +- .../View Base/ViewComposite.cs | 2 +- .../View Base/ViewContextMenuManager.cs | 14 +- .../View Draw/ViewDrawBorderEdge.cs | 2 +- .../View Draw/ViewDrawButton.cs | 4 +- .../View Draw/ViewDrawContent.cs | 8 +- .../View Draw/ViewDrawDateTimeText.cs | 25 +- .../View Draw/ViewDrawDocker.cs | 36 +- .../View Draw/ViewDrawGroupBoxDocker.cs | 4 +- .../View Draw/ViewDrawMenuColorBlock.cs | 9 +- .../View Draw/ViewDrawMenuMonthCalendar.cs | 4 +- .../View Draw/ViewDrawMonthDayNames.cs | 2 +- .../View Draw/ViewDrawMonthDays.cs | 4 +- .../View Layout/ViewLayoutCrumbs.cs | 20 +- .../View Layout/ViewLayoutDocker.cs | 2 +- .../View Layout/ViewLayoutMenuItemSelect.cs | 4 +- .../View Layout/ViewLayoutMetricSpacer.cs | 5 +- .../View Layout/ViewLayoutMonths.cs | 8 +- .../View Layout/ViewLayoutStack.cs | 2 +- .../View Layout/ViewLayoutViewport.cs | 13 +- .../Controls Workspace/KryptonWorkspace.cs | 223 ++----- .../KryptonWorkspaceCell.cs | 19 +- .../KryptonWorkspaceCollection.cs | 22 +- .../KryptonWorkspaceSequence.cs | 37 +- .../KryptonWorkspaceSequenceConverter.cs | 2 +- .../Dragging/DragTargetWorkspace.cs | 2 +- .../General/CellPageNotify.cs | 15 +- .../Krypton.Workspace/General/Definitions.cs | 4 +- .../Palette/WorkspacePageMenu.cs | 85 +-- .../View Draw/ViewDrawWorkspaceSeparator.cs | 5 +- .../Workspace/KryptonWorkspaceCellDesigner.cs | 4 +- .../KryptonWorkspaceCollectionEditor.cs | 80 +-- .../Workspace/KryptonWorkspaceDesigner.cs | 21 +- .../KryptonWorkspaceSequenceDesigner.cs | 6 +- Source/Krypton Components/TestForm/Form1.cs | 128 +--- Source/Krypton Components/TestForm/Program.cs | 4 +- 545 files changed, 5521 insertions(+), 10561 deletions(-) diff --git a/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonAutoHiddenGroup.cs b/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonAutoHiddenGroup.cs index 5ec75118e..620981d59 100644 --- a/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonAutoHiddenGroup.cs +++ b/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonAutoHiddenGroup.cs @@ -110,7 +110,7 @@ public void StorePages(string[]? uniqueNames) { // If a matching page exists and it is not a store placeholder already KryptonPage? page = Pages[uniqueName]; - if ((page is { } and not KryptonStorePage)) + if ((page is not null and not KryptonStorePage)) { // Notify that we are storing a page, so handlers can ensure it will be unique to the auto hidden location OnStoringPage(new UniqueNameEventArgs(page.UniqueName)); @@ -132,7 +132,7 @@ public void RestorePages(KryptonPage[] pages) foreach (KryptonPage page in pages) { // If a matching page exists and it is not a store placeholder already - if (page.UniqueName != null) + if (!string.IsNullOrWhiteSpace(page.UniqueName)) { KryptonPage? storePage = Pages[page.UniqueName]; if (storePage is KryptonStorePage) @@ -151,10 +151,7 @@ public void RestorePages(KryptonPage[] pages) /// Raises the StoringPage event. /// /// An StorePageEventArgs containing the event data. - protected virtual void OnStoringPage(UniqueNameEventArgs e) - { - StoringPage?.Invoke(this, e); - } + protected virtual void OnStoringPage(UniqueNameEventArgs e) => StoringPage?.Invoke(this, e); /// /// Raises the TabCountChanged event. diff --git a/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonAutoHiddenProxyPage.cs b/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonAutoHiddenProxyPage.cs index 581f76353..534312f73 100644 --- a/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonAutoHiddenProxyPage.cs +++ b/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonAutoHiddenProxyPage.cs @@ -240,6 +240,7 @@ public override KryptonContextMenu? KryptonContextMenu /// /// Gets and sets the unique name of the page. /// + [DisallowNull] public override string UniqueName { get => Page?.UniqueName ?? string.Empty; diff --git a/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonAutoHiddenSlidePanel.cs b/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonAutoHiddenSlidePanel.cs index 65edb6b67..f95e52118 100644 --- a/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonAutoHiddenSlidePanel.cs +++ b/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonAutoHiddenSlidePanel.cs @@ -41,8 +41,8 @@ public class KryptonAutoHiddenSlidePanel : KryptonPanel, private readonly KryptonAutoHiddenPanel _panel; private KryptonAutoHiddenGroup? _group; private readonly KryptonDockspaceSlide _dockspaceSlide; - private readonly EventHandler _checkMakeHidden; - private readonly KryptonPanel _inner; + private readonly EventHandler? _checkMakeHidden; + private readonly KryptonPanel? _inner; private readonly Button _dummyTarget; private DockingAutoHiddenShowState _state; private Rectangle _startRect; @@ -587,7 +587,9 @@ protected override void OnLeave(EventArgs e) // during its operation. Doing so can cause problems with the mouse down not working when // that is the cause of the leave event. Plus the focus might enter here again before the // next windows message. - if (IsHandleCreated) + if (IsHandleCreated + && _checkMakeHidden != null + ) { BeginInvoke(_checkMakeHidden); } @@ -913,6 +915,7 @@ private void OnDockspaceCellLosesFocus(object sender, WorkspaceCellEventArgs e) case DockingAutoHiddenShowState.SlidingIn: // No sliding required, nothing to do break; + case DockingAutoHiddenShowState.SlidingOut: case DockingAutoHiddenShowState.Showing: MakeSlideIn(); @@ -920,21 +923,13 @@ private void OnDockspaceCellLosesFocus(object sender, WorkspaceCellEventArgs e) } } - private void OnControlSizeChanged(object sender, EventArgs e) - { + private void OnControlSizeChanged(object sender, EventArgs e) => // Change in parent control size means we always hide MakeHidden(); - } - private void OnDockspaceSeparatorMoving(object sender, SplitterCancelEventArgs e) - { - SplitterMoving?.Invoke(sender, e); - } + private void OnDockspaceSeparatorMoving(object sender, SplitterCancelEventArgs e) => SplitterMoving?.Invoke(sender, e); - private void OnDockspaceSeparatorMoved(object sender, SplitterEventArgs e) - { - SplitterMoved?.Invoke(sender, e); - } + private void OnDockspaceSeparatorMoved(object sender, SplitterEventArgs e) => SplitterMoved?.Invoke(sender, e); private void OnDockspaceSeparatorMoveRect(object sender, SplitterMoveRectMenuArgs e) { @@ -947,15 +942,9 @@ private void OnDockspaceSeparatorMoveRect(object sender, SplitterMoveRectMenuArg SplitterMoveRect?.Invoke(sender, e); } - private void OnDockspacePageCloseClicked(object sender, UniqueNameEventArgs e) - { - PageCloseClicked?.Invoke(sender, e); - } + private void OnDockspacePageCloseClicked(object sender, UniqueNameEventArgs e) => PageCloseClicked?.Invoke(sender, e); - private void OnDockspacePageAutoHiddenClicked(object sender, UniqueNameEventArgs e) - { - PageAutoHiddenClicked?.Invoke(sender, e); - } + private void OnDockspacePageAutoHiddenClicked(object sender, UniqueNameEventArgs e) => PageAutoHiddenClicked?.Invoke(sender, e); private void OnDockspacePageDropDownClicked(object sender, CancelDropDownEventArgs e) { @@ -966,10 +955,7 @@ private void OnDockspacePageDropDownClicked(object sender, CancelDropDownEventAr PageDropDownClicked?.Invoke(sender, e); } - private void OnAutoHiddenShowingStateChanged(AutoHiddenShowingStateEventArgs e) - { - AutoHiddenShowingStateChanged?.Invoke(this, e); - } + private void OnAutoHiddenShowingStateChanged(AutoHiddenShowingStateEventArgs e) => AutoHiddenShowingStateChanged?.Invoke(this, e); #endregion } } diff --git a/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonDockableNavigator.cs b/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonDockableNavigator.cs index 6227ab69e..e0634672e 100644 --- a/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonDockableNavigator.cs +++ b/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonDockableNavigator.cs @@ -51,27 +51,19 @@ public KryptonDockableNavigator() /// Raises the CellPageInserting event. /// /// An KryptonPageEventArgs containing the event data. - protected virtual void OnCellPageInserting(KryptonPageEventArgs e) - { - CellPageInserting?.Invoke(this, e); - } + protected virtual void OnCellPageInserting(KryptonPageEventArgs e) => CellPageInserting?.Invoke(this, e); /// /// Raises the PageDropDownClicked event. /// /// An CancelDropDownEventArgs containing the event data. - protected virtual void OnPageDropDownClicked(CancelDropDownEventArgs e) - { - PageDropDownClicked?.Invoke(this, e); - } + protected virtual void OnPageDropDownClicked(CancelDropDownEventArgs e) => PageDropDownClicked?.Invoke(this, e); #endregion #region Private - private void OnPagesInserting(object sender, TypedCollectionEventArgs e) - { + private void OnPagesInserting(object sender, TypedCollectionEventArgs e) => // Generate event so the docking element can decide on extra actions to be taken OnCellPageInserting(new KryptonPageEventArgs(e.Item, e.Index)); - } private void OnShowContextMenu(object sender, ShowContextMenuArgs e) { diff --git a/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonDockableWorkspace.cs b/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonDockableWorkspace.cs index 487299836..2d1f2064f 100644 --- a/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonDockableWorkspace.cs +++ b/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonDockableWorkspace.cs @@ -101,9 +101,9 @@ protected override void OnActiveCellChanged(ActiveCellChangedEventArgs e) #region Implementation private void OnCellCloseAction(object sender, CloseActionEventArgs e) { - if (e.Item?.UniqueName != null) + if (!string.IsNullOrWhiteSpace(e.Item?.UniqueName)) { - OnPageCloseClicked(new UniqueNameEventArgs(e.Item.UniqueName)); + OnPageCloseClicked(new UniqueNameEventArgs(e.Item!.UniqueName)); } } #endregion diff --git a/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonFloatingWindow.cs b/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonFloatingWindow.cs index c95e729c6..34d81f0c1 100644 --- a/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonFloatingWindow.cs +++ b/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonFloatingWindow.cs @@ -141,19 +141,13 @@ protected override void WndProc(ref Message m) /// Raises the WindowCloseClicked event. /// /// An UniqueNamesEventArgs that contains the event data. - protected virtual void OnWindowCloseClicked(UniqueNamesEventArgs e) - { - WindowCloseClicked?.Invoke(this, e); - } + protected virtual void OnWindowCloseClicked(UniqueNamesEventArgs e) => WindowCloseClicked?.Invoke(this, e); /// /// Raises the WindowCaptionDragging event. /// /// An ScreenAndOffsetEventArgs that contains the event data. - protected virtual void OnWindowCaptionDragging(ScreenAndOffsetEventArgs e) - { - WindowCaptionDragging?.Invoke(this, e); - } + protected virtual void OnWindowCaptionDragging(ScreenAndOffsetEventArgs e) => WindowCaptionDragging?.Invoke(this, e); /// /// Raises the Load event. @@ -217,21 +211,15 @@ protected override void OnDeactivate(EventArgs e) private void OnFloatspaceCellCountChanged(object sender, EventArgs e) { // When all the cells (and so pages) have been removed we kill ourself - if (FloatspaceControl != null && FloatspaceControl.CellCount == 0) + if (FloatspaceControl is { CellCount: 0 }) { FloatspaceControl.Dispose(); } } - private void OnFloatspaceCellVisibleCountChanged(object sender, EventArgs e) - { - UpdateCellSettings(); - } + private void OnFloatspaceCellVisibleCountChanged(object sender, EventArgs e) => UpdateCellSettings(); - private void OnTabVisibleCountChanged(object sender, EventArgs e) - { - UpdateCellSettings(); - } + private void OnTabVisibleCountChanged(object sender, EventArgs e) => UpdateCellSettings(); private void OnFloatspaceCellAdding(object sender, WorkspaceCellEventArgs e) { @@ -242,15 +230,9 @@ private void OnFloatspaceCellAdding(object sender, WorkspaceCellEventArgs e) ClientSize = MinimumSize; } - private void OnFloatspaceCellRemoved(object sender, WorkspaceCellEventArgs e) - { - e.Cell.TabVisibleCountChanged -= OnTabVisibleCountChanged!; - } + private void OnFloatspaceCellRemoved(object sender, WorkspaceCellEventArgs e) => e.Cell.TabVisibleCountChanged -= OnTabVisibleCountChanged!; - private void OnLayoutWorkspace(object sender, EventArgs e) - { - FloatspaceControl?.PerformNeedPaint(true); - } + private void OnLayoutWorkspace(object sender, EventArgs e) => FloatspaceControl?.PerformNeedPaint(true); private void UpdateCellSettings() { @@ -258,7 +240,7 @@ private void UpdateCellSettings() if (cell != null) { // If there is only a single cell inside the floating window - if (FloatspaceControl.CellVisibleCount <= 1) + if (FloatspaceControl!.CellVisibleCount <= 1) { // Cell display mode depends on the number of tabs in the cell cell.NavigatorMode = cell.Pages.VisibleCount == 1 ? NavigatorMode.HeaderGroup : NavigatorMode.HeaderGroupTab; diff --git a/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonSpace.cs b/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonSpace.cs index 3d58a8359..2551d56aa 100644 --- a/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonSpace.cs +++ b/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonSpace.cs @@ -229,10 +229,7 @@ public string DropDownTooltip /// /// Requests the visible state be updated. /// - public void UpdateVisible() - { - UpdateVisible(false); - } + public void UpdateVisible() => UpdateVisible(false); /// /// Requests the visible state be updated. @@ -296,8 +293,8 @@ public override void WritePageElement(XmlWriter xmlWriter, KryptonPage page) page = args.Page; // Add recreated page to the looking dictionary - if (page?.UniqueName != null - && !existingPages.ContainsKey(page.UniqueName)) + if (!string.IsNullOrWhiteSpace(page?.UniqueName) + && !existingPages.ContainsKey(page!.UniqueName)) { existingPages.Add(page.UniqueName, page); } @@ -359,64 +356,43 @@ public override void WritePageElement(XmlWriter xmlWriter, KryptonPage page) /// Raises the CellGainsFocus event. /// /// An WorkspaceCellEventArgs containing the event data. - protected virtual void OnCellGainsFocus(WorkspaceCellEventArgs e) - { - CellGainsFocus?.Invoke(this, e); - } + protected virtual void OnCellGainsFocus(WorkspaceCellEventArgs e) => CellGainsFocus?.Invoke(this, e); /// /// Raises the CellLosesFocus event. /// /// An WorkspaceCellEventArgs containing the event data. - protected virtual void OnCellLosesFocus(WorkspaceCellEventArgs e) - { - CellLosesFocus?.Invoke(this, e); - } + protected virtual void OnCellLosesFocus(WorkspaceCellEventArgs e) => CellLosesFocus?.Invoke(this, e); /// /// Raises the CellPageInserting event. /// /// An KryptonPageEventArgs containing the event data. - protected virtual void OnCellPageInserting(KryptonPageEventArgs e) - { - CellPageInserting?.Invoke(this, e); - } + protected virtual void OnCellPageInserting(KryptonPageEventArgs e) => CellPageInserting?.Invoke(this, e); /// /// Raises the PageCloseClicked event. /// /// An UniqueNameEventArgs containing the event data. - protected virtual void OnPageCloseClicked(UniqueNameEventArgs e) - { - PageCloseClicked?.Invoke(this, e); - } + protected virtual void OnPageCloseClicked(UniqueNameEventArgs e) => PageCloseClicked?.Invoke(this, e); /// /// Raises the PageAutoHiddenClicked event. /// /// An UniqueNameEventArgs containing the event data. - protected virtual void OnPageAutoHiddenClicked(UniqueNameEventArgs e) - { - PageAutoHiddenClicked?.Invoke(this, e); - } + protected virtual void OnPageAutoHiddenClicked(UniqueNameEventArgs e) => PageAutoHiddenClicked?.Invoke(this, e); /// /// Raises the PageDropDownClicked event. /// /// An CancelDropDownEventArgs containing the event data. - protected virtual void OnPageDropDownClicked(CancelDropDownEventArgs e) - { - PageDropDownClicked?.Invoke(this, e); - } + protected virtual void OnPageDropDownClicked(CancelDropDownEventArgs e) => PageDropDownClicked?.Invoke(this, e); /// /// Raises the PagesDoubleClicked event. /// /// An UniqueNamesEventArgs containing the event data. - protected virtual void OnPagesDoubleClicked(UniqueNamesEventArgs e) - { - PagesDoubleClicked?.Invoke(this, e); - } + protected virtual void OnPagesDoubleClicked(UniqueNamesEventArgs e) => PagesDoubleClicked?.Invoke(this, e); /// /// Initialize a new cell. @@ -609,17 +585,13 @@ private void FocusMonitorControl(Control c, bool adding) } } - private void OnFocusControlAdded(object sender, ControlEventArgs e) - { + private void OnFocusControlAdded(object sender, ControlEventArgs e) => // Add focus monitoring to the control FocusMonitorControl(e.Control, true); - } - private void OnFocusControlRemoved(object sender, ControlEventArgs e) - { + private void OnFocusControlRemoved(object sender, ControlEventArgs e) => // Remove focus monitoring from the control FocusMonitorControl(e.Control, true); - } private void OnFocusChanged(object sender, EventArgs e) { @@ -746,7 +718,7 @@ private void OnCellPrimaryHeaderLeftClicked(object sender, EventArgs e) if (ApplyDockingAppearance) { // Set the focus into the active page - KryptonWorkspaceCell cell = (KryptonWorkspaceCell)sender; + var cell = (KryptonWorkspaceCell)sender; cell.SelectedPage?.SelectNextControl(cell.SelectedPage, true, true, true, false); } } @@ -756,7 +728,7 @@ private void OnCellPrimaryHeaderRightClicked(object sender, EventArgs e) // Should we apply docking specific change of focus when the primary header is clicked? if (ApplyDockingAppearance) { - KryptonWorkspaceCell? cell = sender as KryptonWorkspaceCell; + var cell = sender as KryptonWorkspaceCell; if (cell?.SelectedPage != null) { // Set the focus into the active page @@ -784,7 +756,7 @@ private void OnCellPrimaryHeaderDoubleClicked(object sender, EventArgs e) var uniqueNames = new List(); // Create list of visible pages that are not placeholders - KryptonWorkspaceCell cell = (KryptonWorkspaceCell)sender; + var cell = (KryptonWorkspaceCell)sender; foreach (KryptonPage page in cell.Pages) { if (page.LastVisibleSet && page is not KryptonStorePage) @@ -843,7 +815,7 @@ private void OnCellSelectedPageChanged(object sender, EventArgs e) if (ApplyDockingCloseAction || ApplyDockingPinAction) { // Get access to the cached state for this cell - KryptonWorkspaceCell? cell = sender as KryptonWorkspaceCell; + var cell = sender as KryptonWorkspaceCell; if (cell != null) { CachedCellState cellState = _lookupCellState[cell]; @@ -872,7 +844,7 @@ private void OnCellSelectedPageFlagsChanged(object sender, KryptonPageFlagsEvent if (ApplyDockingCloseAction || ApplyDockingPinAction) { // Only need to process the change in flags if the page in question is a selected page - KryptonPage page = (KryptonPage)sender; + var page = (KryptonPage)sender; KryptonWorkspaceCell? cell = CellForPage(page); if (cell?.SelectedPage == page) { @@ -886,7 +858,7 @@ private void OnCellCloseAction(object sender, EventArgs e) if (ApplyDockingCloseAction) { // Find the page associated with the cell that fired this button spec - ButtonSpec buttonSpec = (ButtonSpec)sender; + var buttonSpec = (ButtonSpec)sender; foreach (CachedCellState cellState in _lookupCellState.Values.Where(cellState => cellState.CloseButtonSpec == buttonSpec)) { if (cellState.Cell?.SelectedPage != null) @@ -904,7 +876,7 @@ private void OnCellAutoHiddenAction(object sender, EventArgs e) if (ApplyDockingPinAction) { // Find the page associated with the cell that fired this button spec - ButtonSpec buttonSpec = (ButtonSpec)sender; + var buttonSpec = (ButtonSpec)sender; foreach (CachedCellState cellState in _lookupCellState.Values.Where(cellState => cellState.PinButtonSpec == buttonSpec)) { if (cellState.Cell?.SelectedPage != null) @@ -922,7 +894,7 @@ private void OnCellDropDownOpening(object sender, CancelEventArgs e) if (ApplyDockingDropDownAction) { // Search for the cell that contains the button spec that has this context menu - KryptonContextMenu kcm = (KryptonContextMenu)sender; + var kcm = (KryptonContextMenu)sender; foreach (CachedCellState cellState in _lookupCellState.Values.Where(cellState => (cellState.DropDownButtonSpec != null) && (cellState.DropDownButtonSpec.KryptonContextMenu == kcm)) ) @@ -941,11 +913,9 @@ private void OnCellDropDownOpening(object sender, CancelEventArgs e) } } - private void OnCellPagesInserting(object sender, TypedCollectionEventArgs e) - { + private void OnCellPagesInserting(object sender, TypedCollectionEventArgs e) => // Generate event so the docking element can decide on extra actions to be taken OnCellPageInserting(new KryptonPageEventArgs(e.Item, e.Index)); - } private void UpdateTooltips() { diff --git a/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonStorePage.cs b/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonStorePage.cs index e754ae980..00d5bc41e 100644 --- a/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonStorePage.cs +++ b/Source/Krypton Components/Krypton.Docking/Control Docking/KryptonStorePage.cs @@ -26,7 +26,7 @@ public class KryptonStorePage : KryptonPage /// /// UniqueName of the page this is placeholding. /// Storage name associated with this page location. - public KryptonStorePage(string uniqueName, string storeName) + public KryptonStorePage([DisallowNull] string uniqueName, string storeName) { Visible = false; UniqueName = uniqueName; diff --git a/Source/Krypton Components/Krypton.Docking/Dragging/DockingDragManager.cs b/Source/Krypton Components/Krypton.Docking/Dragging/DockingDragManager.cs index d99c2173e..af39a1b7c 100644 --- a/Source/Krypton Components/Krypton.Docking/Dragging/DockingDragManager.cs +++ b/Source/Krypton Components/Krypton.Docking/Dragging/DockingDragManager.cs @@ -184,11 +184,9 @@ public bool OnKEYDOWN(ref Message m) /// /// Processes the WM_MOUSEMOVE from the floating window. /// - public void OnMOUSEMOVE() - { + public void OnMOUSEMOVE() => // Update feedback to reflect the current mouse position DragMove(Control.MousePosition); - } /// /// Processes the WM_LBUTTONUP from the floating window. @@ -223,7 +221,7 @@ public bool PreFilterMessage(ref Message m) case PI.WM_.KEYDOWN: { // Extract the keys being pressed - Keys keys = (Keys)(int)m.WParam.ToInt64(); + var keys = (Keys)(int)m.WParam.ToInt64(); // Pressing escape ends dragging if (keys == Keys.Escape) diff --git a/Source/Krypton Components/Krypton.Docking/Dragging/DragTargetControlEdge.cs b/Source/Krypton Components/Krypton.Docking/Dragging/DragTargetControlEdge.cs index 16921b006..1f4440408 100644 --- a/Source/Krypton Components/Krypton.Docking/Dragging/DragTargetControlEdge.cs +++ b/Source/Krypton Components/Krypton.Docking/Dragging/DragTargetControlEdge.cs @@ -128,7 +128,7 @@ public override bool PerformDrop(Point screenPt, PageDragEndData? data) } // Find the docked edge - KryptonDockingEdgeDocked? dockedEdge = dockingEdge?[@"Docked"] as KryptonDockingEdgeDocked; + var dockedEdge = dockingEdge?[@"Docked"] as KryptonDockingEdgeDocked; KryptonDockingManager? manager = dockedEdge?.DockingManager; if (manager != null) { diff --git a/Source/Krypton Components/Krypton.Docking/Elements Base/DockingElement.cs b/Source/Krypton Components/Krypton.Docking/Elements Base/DockingElement.cs index 2c897fc21..be14109b6 100644 --- a/Source/Krypton Components/Krypton.Docking/Elements Base/DockingElement.cs +++ b/Source/Krypton Components/Krypton.Docking/Elements Base/DockingElement.cs @@ -144,9 +144,9 @@ public virtual IDockingElement? Parent /// /// Action that is requested to be performed. /// Array of unique names of the pages the action relates to. - public virtual void PropogateAction(DockingPropogateAction action, string?[] uniqueNames) + public virtual void PropogateAction(DockingPropogateAction action, string[]? uniqueNames) { - int countToUse = Math.Min(Count, uniqueNames?.Length ?? 0); + var countToUse = Math.Min(Count, uniqueNames?.Length ?? 0); // Propagate the action request to all the child elements // (use reverse order so if element removes itself we still have a valid loop) for (var i = countToUse - 1; i >= 0; i--) @@ -298,7 +298,7 @@ public virtual void PropogateDragTargets(KryptonFloatingWindow? floatingWindow, public virtual DockingLocation FindPageLocation(string uniqueName) { // Default to not finding the page - DockingLocation location = DockingLocation.None; + var location = DockingLocation.None; // Search all child docking elements for (var i = 0; i < Count; i++) diff --git a/Source/Krypton Components/Krypton.Docking/Elements Base/DockingElementOpenCollection.cs b/Source/Krypton Components/Krypton.Docking/Elements Base/DockingElementOpenCollection.cs index 67b5b7e8e..3f25dc371 100644 --- a/Source/Krypton Components/Krypton.Docking/Elements Base/DockingElementOpenCollection.cs +++ b/Source/Krypton Components/Krypton.Docking/Elements Base/DockingElementOpenCollection.cs @@ -33,20 +33,14 @@ protected DockingElementOpenCollection(string name) /// Append a docking element to the collection. /// /// IDockingElement reference. - public virtual void Add(IDockingElement item) - { - InternalAdd(item); - } + public virtual void Add(IDockingElement item) => InternalAdd(item); /// /// Append a docking element to the collection. /// /// Insert index. /// IDockingElement reference. - public virtual void Insert(int index, IDockingElement item) - { - InternalInsert(index, item); - } + public virtual void Insert(int index, IDockingElement item) => InternalInsert(index, item); /// /// Removes first occurrence of specified docking element. @@ -58,10 +52,7 @@ public virtual void Insert(int index, IDockingElement item) /// /// Remove all docking elements from the collection. /// - public virtual void Clear() - { - InternalClear(); - } + public virtual void Clear() => InternalClear(); #endregion } } diff --git a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingAutoHiddenGroup.cs b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingAutoHiddenGroup.cs index 60a1a52a8..af5e51200 100644 --- a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingAutoHiddenGroup.cs +++ b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingAutoHiddenGroup.cs @@ -97,11 +97,9 @@ public KryptonDockingEdgeDocked? EdgeDockedElement /// Add a KryptonPage to the end of the auto hidden group. /// /// KryptonPage to be added. - public void Append(KryptonPage page) - { + public void Append(KryptonPage page) => // Use existing array adding method to prevent duplication of code Append(new[] { page }); - } /// /// Add the KryptonPage array to the end of the auto hidden group. @@ -123,7 +121,7 @@ public void Append(KryptonPage[]? pages) /// /// Action that is requested to be performed. /// Array of unique names of the pages the action relates to. - public override void PropogateAction(DockingPropogateAction action, string?[] uniqueNames) + public override void PropogateAction(DockingPropogateAction action, string[] uniqueNames) { switch (action) { @@ -135,7 +133,7 @@ public override void PropogateAction(DockingPropogateAction action, string?[] un // Update visible state of pages that are not placeholders foreach (KryptonPage? page in uniqueNames .Select(uniqueName => AutoHiddenGroupControl.Pages[uniqueName]) - .Where(static page => (page is { } and not KryptonStorePage)) + .Where(static page => (page is not null and not KryptonStorePage)) ) { page!.Visible = newVisible; @@ -155,7 +153,7 @@ public override void PropogateAction(DockingPropogateAction action, string?[] un { foreach (KryptonPage? page in uniqueNames .Select(uniqueName => AutoHiddenGroupControl.Pages[uniqueName]) - .Where(static page => (page is { } and not KryptonStorePage)) + .Where(static page => (page is not null and not KryptonStorePage)) ) { AutoHiddenGroupControl.Pages.Remove(page!); @@ -178,7 +176,7 @@ public override void PropogateAction(DockingPropogateAction action, string?[] un { // Only remove the actual page and not placeholders KryptonPage? page = AutoHiddenGroupControl.Pages[i]; - if ((page is { } and not KryptonStorePage)) + if ((page is not null and not KryptonStorePage)) { AutoHiddenGroupControl.Pages.RemoveAt(i); @@ -329,10 +327,10 @@ public override void PropogatePageList(DockingPropogatePageList state, KryptonPa { // Only add real pages and not just placeholders KryptonPage? page = AutoHiddenGroupControl.Pages[i]; - if (page is { } and not KryptonStorePage) + if (page is not null and not KryptonStorePage) { // Remember the real page is inside a proxy! - KryptonAutoHiddenProxyPage? proxyPage = page as KryptonAutoHiddenProxyPage; + var proxyPage = page as KryptonAutoHiddenProxyPage; if (proxyPage?.Page != null) { pages.Add(proxyPage.Page); @@ -496,28 +494,19 @@ public override void LoadElementFromXml(XmlReader xmlReader, KryptonPageCollecti /// Raises the PageClicked event. /// /// An KryptonPageEventArgs containing the event data. - protected virtual void OnPageClicked(KryptonPageEventArgs e) - { - PageClicked?.Invoke(this, e); - } + protected virtual void OnPageClicked(KryptonPageEventArgs e) => PageClicked?.Invoke(this, e); /// /// Raises the PageHoverStart event. /// /// An KryptonPageEventArgs containing the event data. - protected virtual void OnPageHoverStart(KryptonPageEventArgs e) - { - PageHoverStart?.Invoke(this, e); - } + protected virtual void OnPageHoverStart(KryptonPageEventArgs e) => PageHoverStart?.Invoke(this, e); /// /// Raises the PageHoverEnd event. /// /// An EventArgs containing the event data. - protected virtual void OnPageHoverEnd(EventArgs e) - { - PageHoverEnd?.Invoke(this, e); - } + protected virtual void OnPageHoverEnd(EventArgs e) => PageHoverEnd?.Invoke(this, e); /// /// Gets the xml element name to use when saving. @@ -543,9 +532,9 @@ protected override void LoadChildDockingElement(XmlReader xmlReader, } // Get the unique name of the page - string uniqueName = xmlReader.GetAttribute(@"UN") ?? string.Empty; - string boolStore = xmlReader.GetAttribute(@"S") ?? string.Empty; - string boolVisible = xmlReader.GetAttribute(@"V") ?? string.Empty; + var uniqueName = xmlReader.GetAttribute(@"UN") ?? string.Empty; + var boolStore = xmlReader.GetAttribute(@"S") ?? string.Empty; + var boolVisible = xmlReader.GetAttribute(@"V") ?? string.Empty; KryptonPage? page; @@ -654,16 +643,14 @@ private void AppendPagesToControl(KryptonPage[] pages) AutoHiddenGroupControl.Pages.AddRange(pages); } - private void OnAutoHiddenGroupStoringPage(object sender, UniqueNameEventArgs e) - { + private void OnAutoHiddenGroupStoringPage(object sender, UniqueNameEventArgs e) => // We only allow a single 'store' page in this docking location at a time DockingManager?.PropogateAction(DockingPropogateAction.ClearAutoHiddenStoredPages, new[] { e.UniqueName }); - } private void OnAutoHiddenGroupTabClicked(object sender, KryptonPageEventArgs e) { // The auto hidden group contains proxy pages and not the real pages - KryptonAutoHiddenProxyPage? proxyPage = e.Item as KryptonAutoHiddenProxyPage; + var proxyPage = e.Item as KryptonAutoHiddenProxyPage; if (proxyPage != null) { OnPageClicked(new KryptonPageEventArgs(proxyPage.Page, e.Index)); @@ -673,17 +660,14 @@ private void OnAutoHiddenGroupTabClicked(object sender, KryptonPageEventArgs e) private void OnAutoHiddenGroupHoverStart(object sender, KryptonPageEventArgs e) { // The auto hidden group contains proxy pages and not the real pages - KryptonAutoHiddenProxyPage? proxyPage = e.Item as KryptonAutoHiddenProxyPage; + var proxyPage = e.Item as KryptonAutoHiddenProxyPage; if (proxyPage != null) { OnPageHoverStart(new KryptonPageEventArgs(proxyPage.Page, e.Index)); } } - private void OnAutoHiddenGroupHoverEnd(object sender, EventArgs e) - { - OnPageHoverEnd(e); - } + private void OnAutoHiddenGroupHoverEnd(object sender, EventArgs e) => OnPageHoverEnd(e); private void OnAutoHiddenGroupTabVisibleCountChanged(object sender, EventArgs e) { diff --git a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingControl.cs b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingControl.cs index 57dc1a198..8a84f48e1 100644 --- a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingControl.cs +++ b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingControl.cs @@ -124,7 +124,7 @@ public Size InnerMinimum /// /// Action that is requested to be performed. /// Array of unique names of the pages the action relates to. - public override void PropogateAction(DockingPropogateAction action, string?[] uniqueNames) + public override void PropogateAction(DockingPropogateAction action, string[]? uniqueNames) { switch (action) { @@ -145,6 +145,7 @@ public override void PropogateAction(DockingPropogateAction action, string?[] un */ } break; + case DockingPropogateAction.EndUpdate: // Only final matching 'EndUpdate' needs to reverse start action if ((_updateCount > 0) @@ -159,15 +160,15 @@ public override void PropogateAction(DockingPropogateAction action, string?[] un //_obscure.Visible = false; } break; + case DockingPropogateAction.ShowPages: case DockingPropogateAction.ShowAllPages: // Let base class perform actual requested actions base.PropogateAction(action, uniqueNames); - // Ensure that showing extra pages does not trespass on the inner minimum EnforceInnerMinimum(); - break; + default: // Let base class perform actual requested actions base.PropogateAction(action, uniqueNames); @@ -226,7 +227,7 @@ public override void PropogateDragTargets(KryptonFloatingWindow? floatingWindow, case null: { // Find the inner rectangle after taking docked controls into account - Size tl = Size.Empty; + var tl = Size.Empty; Size br = Control.ClientSize; foreach (Control c in Control.Controls.Cast().Where(static c => c.Visible)) { @@ -450,7 +451,7 @@ private void EnforceInnerMinimum(int remove, Orientation orientation) KryptonDockspace dockspace = controls[i]; // Find how much we can subtract from the dockspace without violating the minimum size - int dockDelta = orientation == Orientation.Horizontal + var dockDelta = orientation == Orientation.Horizontal ? dockspace.Width - Math.Max(dockspace.MinimumSize.Width, dockspace.Width - delta) : dockspace.Height - Math.Max(dockspace.MinimumSize.Height, dockspace.Height - delta); diff --git a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingDockspace.cs b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingDockspace.cs index d040243e6..55ba6cad3 100644 --- a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingDockspace.cs +++ b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingDockspace.cs @@ -157,11 +157,9 @@ public override void PropogateAction(DockingPropogateAction action, int value) /// /// Integer state that is requested to be recovered. /// Value discovered from matching - public override void PropogateIntState(DockingPropogateIntState state, ref int value) - { + public override void PropogateIntState(DockingPropogateIntState state, ref int value) => // User our value if it is the largest encountered so far value = Math.Max(value, Order); - } /// /// Propagates a request for drag targets down the hierarchy of docking elements. @@ -332,19 +330,13 @@ protected override void RaiseSpacePageDrop(object sender, PageDropEventArgs e) /// Raises the HasVisibleCells event. /// /// An EventArgs containing the event data. - protected virtual void OnHasVisibleCells(EventArgs e) - { - HasVisibleCells?.Invoke(this, e); - } + protected virtual void OnHasVisibleCells(EventArgs e) => HasVisibleCells?.Invoke(this, e); /// /// Raises the HasNoVisibleCells event. /// /// An EventArgs containing the event data. - protected virtual void OnHasNoVisibleCells(EventArgs e) - { - HasNoVisibleCells?.Invoke(this, e); - } + protected virtual void OnHasNoVisibleCells(EventArgs e) => HasNoVisibleCells?.Invoke(this, e); /// /// Gets the xml element name to use when saving. diff --git a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingEdgeAutoHidden.cs b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingEdgeAutoHidden.cs index f4e686f89..9a684bb38 100644 --- a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingEdgeAutoHidden.cs +++ b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingEdgeAutoHidden.cs @@ -119,7 +119,7 @@ public KryptonDockingAutoHiddenGroup InsertAutoHiddenGroup(int index) => /// /// Action that is requested to be performed. /// Array of unique names of the pages the action relates to. - public override void PropogateAction(DockingPropogateAction action, string?[] uniqueNames) + public override void PropogateAction(DockingPropogateAction action, string[]? uniqueNames) { switch (action) { @@ -198,10 +198,7 @@ public override void PropogateAction(DockingPropogateAction action, KryptonPage[ /// /// Page to slide into view. /// True to select the page; otherwise false. - public void SlidePageOut(KryptonPage page, bool select) - { - SlidePageOut(page.UniqueName, select); - } + public void SlidePageOut(KryptonPage page, bool select) => SlidePageOut(page.UniqueName, select); /// /// Slide the specified page into view and optionally select. @@ -303,7 +300,7 @@ private KryptonDockingAutoHiddenGroup CreateAndInsertAutoHiddenGroup(int index, private void OnDockingAutoHiddenGroupDisposed(object sender, EventArgs e) { // Cast to correct type and unhook event handlers so garbage collection can occur - KryptonDockingAutoHiddenGroup groupElement = (KryptonDockingAutoHiddenGroup)sender; + var groupElement = (KryptonDockingAutoHiddenGroup)sender; groupElement.PageClicked -= OnDockingAutoHiddenGroupClicked!; groupElement.PageHoverStart -= OnDockingAutoHiddenGroupHoverStart!; groupElement.PageHoverEnd -= OnDockingAutoHiddenGroupHoverEnd!; @@ -372,29 +369,24 @@ private void OnSlidePanelDisposed(object sender, EventArgs e) private void OnDockingAutoHiddenGroupClicked(object sender, KryptonPageEventArgs e) { // Request the sliding panel slide itself into view with the provided page - KryptonDockingAutoHiddenGroup dockingGroup = (KryptonDockingAutoHiddenGroup)sender; + var dockingGroup = (KryptonDockingAutoHiddenGroup)sender; _slidePanel.SlideOut(e.Item, dockingGroup.AutoHiddenGroupControl, true); } private void OnDockingAutoHiddenGroupHoverStart(object sender, KryptonPageEventArgs e) { // Request the sliding panel slide itself into view with the provided page - KryptonDockingAutoHiddenGroup dockingGroup = (KryptonDockingAutoHiddenGroup)sender; + var dockingGroup = (KryptonDockingAutoHiddenGroup)sender; _slidePanel.SlideOut(e.Item, dockingGroup.AutoHiddenGroupControl, false); } - private void OnDockingAutoHiddenGroupHoverEnd(object sender, EventArgs e) - { + private void OnDockingAutoHiddenGroupHoverEnd(object sender, EventArgs e) => // Request the sliding panel slide itself out of view when appropriate // (will not retract whilst the mouse is over the slide out dockspace) // (will not retract whilst slide out dockspace has the focus) _slidePanel.SlideIn(); - } - private void OnSlidePanelSeparatorMoved(object sender, SplitterEventArgs e) - { - _slidePanel.UpdateSize(e.SplitX, e.SplitY); - } + private void OnSlidePanelSeparatorMoved(object sender, SplitterEventArgs e) => _slidePanel.UpdateSize(e.SplitX, e.SplitY); private void OnSlidePanelSeparatorMoving(object sender, SplitterCancelEventArgs e) { @@ -403,7 +395,7 @@ private void OnSlidePanelSeparatorMoving(object sender, SplitterCancelEventArgs private void OnSlidePanelSeparatorMoveRect(object sender, SplitterMoveRectMenuArgs e) { // Cast to correct type and grab associated dockspace control - KryptonDockspaceSeparator separatorControl = (KryptonDockspaceSeparator)sender; + var separatorControl = (KryptonDockspaceSeparator)sender; KryptonDockspace dockspaceControl = _slidePanel.DockspaceControl; KryptonPage? page = _slidePanel.Page; @@ -438,7 +430,7 @@ private void OnSlidePanelPageDropDownClicked(object sender, CancelDropDownEventA // Generate event so that the appropriate context menu options are presented and actioned KryptonDockingManager? dockingManager = DockingManager; if (dockingManager != null - && e is { Page: { }, KryptonContextMenu: { } } + && e is { Page: not null, KryptonContextMenu: not null } ) { e.Cancel = !dockingManager.ShowPageContextMenuRequest(e.Page, e.KryptonContextMenu); @@ -488,7 +480,7 @@ private Rectangle FindMovementRect(Rectangle moveRect) var expandHeight = Math.Max(innerSize.Height - _slidePanel.Height, 0); // Create movement rectangle based on the initial rectangle and the allowed range - Rectangle retRect = Rectangle.Empty; + var retRect = Rectangle.Empty; switch (Edge) { case DockingEdge.Left: diff --git a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingEdgeDocked.cs b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingEdgeDocked.cs index 075d1045c..8311f3316 100644 --- a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingEdgeDocked.cs +++ b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingEdgeDocked.cs @@ -276,7 +276,7 @@ private void OnDockspaceSeparatorMoved(object sender, SplitterEventArgs e) if (_update) { // Inform our owning control that the update has ended, allowing the client area to be drawn - KryptonDockingControl? c = GetParentType(typeof(KryptonDockingControl)) as KryptonDockingControl; + var c = GetParentType(typeof(KryptonDockingControl)) as KryptonDockingControl; c?.PropogateAction(DockingPropogateAction.EndUpdate, null as string[]); _update = false; } @@ -287,7 +287,7 @@ private void OnDockspaceSeparatorNotMoved(object sender, EventArgs e) if (_update) { // Inform our owning control that the update has ended, allowing the client area to be drawn - KryptonDockingControl? c = GetParentType(typeof(KryptonDockingControl)) as KryptonDockingControl; + var c = GetParentType(typeof(KryptonDockingControl)) as KryptonDockingControl; c?.PropogateAction(DockingPropogateAction.EndUpdate, null as string[]); _update = false; } @@ -359,7 +359,7 @@ private Rectangle FindMovementRect(KryptonDockingDockspace dockspaceElement, Rec var reduceHeight = Math.Max(dockspaceElement.DockspaceControl.Height - dockspaceMinimum.Height, 0); // Get the minimum size requested for the inner area of the control - Size innerMinimum = Size.Empty; + var innerMinimum = Size.Empty; if (GetParentType(typeof(KryptonDockingControl)) is KryptonDockingControl dockingControl) { innerMinimum = dockingControl.InnerMinimum; diff --git a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingFloating.cs b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingFloating.cs index 8a90b20b5..3dbf38bc1 100644 --- a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingFloating.cs +++ b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingFloating.cs @@ -73,7 +73,7 @@ public KryptonDockingFloatingWindow AddFloatingWindow() => // Only interested in floating window elements if (child is KryptonDockingFloatingWindow floatingWindow) { - bool? ret = floatingWindow.PropogateBoolState(DockingPropogateBoolState.ContainsStorePage, uniqueName); + var ret = floatingWindow.PropogateBoolState(DockingPropogateBoolState.ContainsStorePage, uniqueName); if (ret.HasValue && ret.Value) { return floatingWindow; @@ -145,7 +145,7 @@ private KryptonDockingFloatingWindow CreateFloatingWindow(string? name) private void OnDockingFloatingWindowDisposed(object sender, EventArgs e) { // Cast to correct type and unhook event handlers so garbage collection can occur - KryptonDockingFloatingWindow floatingWindowElement = (KryptonDockingFloatingWindow)sender; + var floatingWindowElement = (KryptonDockingFloatingWindow)sender; floatingWindowElement.Disposed -= OnDockingFloatingWindowDisposed; // Remove the element from our child collection as it is no longer valid diff --git a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingFloatingWindow.cs b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingFloatingWindow.cs index ade23c4af..afd5164a7 100644 --- a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingFloatingWindow.cs +++ b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingFloatingWindow.cs @@ -97,7 +97,7 @@ public override IDockingElement? Parent /// /// Action that is requested to be performed. /// Array of unique names of the pages the action relates to. - public override void PropogateAction(DockingPropogateAction action, string?[] uniqueNames) + public override void PropogateAction(DockingPropogateAction action, string[]? uniqueNames) { switch (action) { @@ -106,7 +106,7 @@ public override void PropogateAction(DockingPropogateAction action, string?[] un if (_updateCount++ == 0) { // Do not layout the floatspace until all changes have been made - FloatingWindow.FloatspaceControl.SuspendWorkspaceLayout(); + FloatingWindow.FloatspaceControl?.SuspendWorkspaceLayout(); // Place the obscuring control at the top of the z-order FloatingWindow.Controls.SetChildIndex(_obscure, 0); @@ -118,14 +118,16 @@ public override void PropogateAction(DockingPropogateAction action, string?[] un _obscure.Visible = true; } break; + case DockingPropogateAction.EndUpdate: // Only final matching 'EndUpdate' needs to reverse start action if ((_updateCount > 0) && (_updateCount-- == 1)) { - FloatingWindow.FloatspaceControl.ResumeWorkspaceLayout(); + FloatingWindow.FloatspaceControl?.ResumeWorkspaceLayout(); _obscure.Visible = false; } break; + default: // Let base class perform actual requested actions base.PropogateAction(action, uniqueNames); diff --git a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingFloatspace.cs b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingFloatspace.cs index d98778068..eb8bf00e1 100644 --- a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingFloatspace.cs +++ b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingFloatspace.cs @@ -291,7 +291,7 @@ private void OnFloatspaceDropDownClicked(object sender, CancelDropDownEventArgs KryptonDockingManager? dockingManager = DockingManager; if (dockingManager != null) { - if (e.Page != null && e.KryptonContextMenu != null) + if (e is { Page: not null, KryptonContextMenu: not null }) { e.Cancel = !dockingManager.ShowPageContextMenuRequest(e.Page, e.KryptonContextMenu); } diff --git a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingManager.cs b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingManager.cs index 4eee8edb4..f9fa6314a 100644 --- a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingManager.cs +++ b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingManager.cs @@ -633,7 +633,7 @@ public void HidePage([DisallowNull] KryptonPage page) public void HidePage([DisallowNull] string uniqueName) { // Cannot hide a null reference - if (uniqueName == null) + if (string.IsNullOrWhiteSpace(uniqueName)) { throw new ArgumentNullException(nameof(uniqueName)); } @@ -741,7 +741,7 @@ public bool IsPageShowing([DisallowNull] KryptonPage page) public bool IsPageShowing([DisallowNull] string uniqueName) { // Cannot search for a null reference - if (uniqueName == null) + if (string.IsNullOrWhiteSpace(uniqueName)) { throw new ArgumentNullException(nameof(uniqueName)); } @@ -899,7 +899,7 @@ public bool ContainsPage([DisallowNull] KryptonPage page) public bool ContainsPage([DisallowNull] string uniqueName) { // Cannot find a null reference - if (uniqueName == null) + if (string.IsNullOrWhiteSpace(uniqueName)) { throw new ArgumentNullException(nameof(uniqueName)); } @@ -1148,7 +1148,7 @@ public DockingLocation FindPageLocation([DisallowNull] KryptonPage? page) public override DockingLocation FindPageLocation([DisallowNull] string uniqueName) { // Cannot replace a null reference - if (uniqueName == null) + if (string.IsNullOrWhiteSpace(uniqueName)) { throw new ArgumentNullException(nameof(uniqueName)); } @@ -1187,7 +1187,7 @@ public override DockingLocation FindPageLocation([DisallowNull] string uniqueNam public override IDockingElement? FindPageElement([DisallowNull] string uniqueName) { // Cannot replace a null reference - if (uniqueName == null) + if (string.IsNullOrWhiteSpace(uniqueName)) { throw new ArgumentNullException(nameof(uniqueName)); } @@ -1228,7 +1228,7 @@ public override DockingLocation FindPageLocation([DisallowNull] string uniqueNam public override IDockingElement? FindStorePageElement(DockingLocation location, [DisallowNull] string uniqueName) { // Cannot replace a null reference - if (uniqueName == null) + if (string.IsNullOrWhiteSpace(uniqueName)) { throw new ArgumentNullException(nameof(uniqueName)); } @@ -1267,7 +1267,7 @@ public override DockingLocation FindPageLocation([DisallowNull] string uniqueNam public override KryptonDockingEdgeDocked? FindDockingEdgeDocked(string uniqueName) { // Try and find as an existing page inside the hierarchy - DockingElement? element = FindPageElement(uniqueName) as DockingElement; + var element = FindPageElement(uniqueName) as DockingElement; switch (element) { @@ -1327,7 +1327,7 @@ public override DockingLocation FindPageLocation([DisallowNull] string uniqueNam public override KryptonDockingEdgeAutoHidden? FindDockingEdgeAutoHidden(string uniqueName) { // Try and find as an existing page inside the hierarchy - DockingElement? element = FindPageElement(uniqueName) as DockingElement; + var element = FindPageElement(uniqueName) as DockingElement; switch (element) { @@ -1438,7 +1438,7 @@ public virtual void CloseRequest([DisallowNull] IReadOnlyList uniqueName foreach (var uniqueName in uniqueNames) { // Raise event that allows the action to be defined by handlers - CloseRequestEventArgs e = new CloseRequestEventArgs(uniqueName, DefaultCloseRequest); + var e = new CloseRequestEventArgs(uniqueName, DefaultCloseRequest); OnPageCloseRequest(e); switch (e.CloseRequest) @@ -1446,6 +1446,7 @@ public virtual void CloseRequest([DisallowNull] IReadOnlyList uniqueName case DockingCloseRequest.None: // Nothing to do! break; + case DockingCloseRequest.RemovePage: case DockingCloseRequest.RemovePageAndDispose: PropogateAction(e.CloseRequest == DockingCloseRequest.RemovePageAndDispose ? @@ -1453,6 +1454,7 @@ public virtual void CloseRequest([DisallowNull] IReadOnlyList uniqueName DockingPropogateAction.RemovePages, new[] { uniqueName }); break; + case DockingCloseRequest.HidePage: PropogateAction(DockingPropogateAction.HidePages, new[] { uniqueName }); break; @@ -1576,7 +1578,7 @@ public virtual void MakeDockedRequest([DisallowNull] string uniqueName) KryptonWorkspaceCell? cell = restoreElement.CellForPage(uniqueName); if (cell != null) { - int pageIndex = cell.Pages.IndexOf(cell.Pages[uniqueName]!); + var pageIndex = cell.Pages.IndexOf(cell.Pages[uniqueName]!); // Insert the page at the same index as the restore page restoreElement.CellInsert(cell, pageIndex, new[] { page }); @@ -1605,7 +1607,7 @@ public virtual void MakeDockedRequest([DisallowNull] string uniqueName) public virtual void MakeFloatingRequest([DisallowNull] string uniqueName) { // Cannot process a null reference - if (uniqueName == null) + if (string.IsNullOrWhiteSpace(uniqueName)) { throw new ArgumentNullException(nameof(uniqueName)); } @@ -1652,7 +1654,7 @@ public virtual void MakeFloatingRequest([DisallowNull] string uniqueName) KryptonWorkspaceCell? cell = restoreElement.CellForPage(uniqueName); if (cell != null) { - int pageIndex = cell.Pages.IndexOf(cell.Pages[uniqueName]!); + var pageIndex = cell.Pages.IndexOf(cell.Pages[uniqueName]!); // Insert the page at the same index as the restore page restoreElement.FloatspaceElement.CellInsert(cell, pageIndex, new[] { page }); @@ -1933,7 +1935,7 @@ public virtual bool ShowPageContextMenuRequest([DisallowNull] KryptonPage? page, } // Let events customize the context menu - ContextPageEventArgs args = new ContextPageEventArgs(page, kcm, !retDisplay); + var args = new ContextPageEventArgs(page, kcm, !retDisplay); OnShowPageContextMenu(args); return !args.Cancel; } @@ -2065,7 +2067,7 @@ public virtual bool ShowPageContextMenuRequest([DisallowNull] KryptonPage? page, // Use events to determine which pages should be switched var switchUniqueNames = new List(); var switchPages = new List(); - string? selectedPage = null; + string selectedPage = null; foreach (var uniqueName in uniqueNames) { // Does the provided unique name exist and is in the required 'docked' state @@ -2122,7 +2124,7 @@ public virtual bool ShowPageContextMenuRequest([DisallowNull] KryptonPage? page, KryptonWorkspaceCell? cell = restoreElement.CellForPage(switchUniqueName); if (cell != null) { - int pageIndex = cell.Pages.IndexOf(cell.Pages[switchUniqueName]!); + var pageIndex = cell.Pages.IndexOf(cell.Pages[switchUniqueName]!); // Insert the set of pages at the same index as the restore page restoreElement.FloatspaceElement.CellInsert(cell, pageIndex, switchPages.ToArray()); @@ -2192,7 +2194,7 @@ public virtual bool ShowPageContextMenuRequest([DisallowNull] KryptonPage? page, // Use events to determine which pages should be switched var switchUniqueNames = new List(); var switchPages = new List(); - string? selectedPage = null; + string selectedPage = null; foreach (var uniqueName in uniqueNames) { // Does the provided unique name exist and is in the required 'floating' state @@ -2249,7 +2251,7 @@ public virtual bool ShowPageContextMenuRequest([DisallowNull] KryptonPage? page, KryptonWorkspaceCell? cell = restoreElement.CellForPage(switchUniqueName); if (cell != null) { - int pageIndex = cell.Pages.IndexOf(cell.Pages[switchUniqueName]!); + var pageIndex = cell.Pages.IndexOf(cell.Pages[switchUniqueName]!); // Insert the set of pages at the same index as the restore page restoreElement.CellInsert(cell, pageIndex, switchPages[i]); @@ -2334,7 +2336,7 @@ public virtual bool ShowPageContextMenuRequest([DisallowNull] KryptonPage? page, // Use events to determine which pages should be switched var switchUniqueNames = new List(); var switchPages = new List(); - string? selectedPage = null; + string selectedPage = null; foreach (var uniqueName in uniqueNames) { // Does the provided unique name exist and is in the required 'floating' state @@ -2372,7 +2374,7 @@ public virtual bool ShowPageContextMenuRequest([DisallowNull] KryptonPage? page, { using var update = new DockingMultiUpdate(this); // Grab the current element that contains one of the pages being moved - KryptonDockingFloatspace? currentElement = FindPageElement(switchPages[0]) as KryptonDockingFloatspace; + var currentElement = FindPageElement(switchPages[0]) as KryptonDockingFloatspace; // Remove the pages from the existing floating window PropogateAction(DockingPropogateAction.RemovePages, switchUniqueNames.ToArray()); @@ -3055,7 +3057,7 @@ public virtual void DoDragDrop(Point screenPoint, Point elementOffset, Control c } // Create docking specific drag manager for moving the pages around - DockingDragManager dragManager = new DockingDragManager(this, c) + var dragManager = new DockingDragManager(this, c) { FloatingWindowOffset = elementOffset }; @@ -3193,7 +3195,7 @@ public virtual void DoDragDrop(Point screenPoint, Point elementOffset, Control? } // Create a list of all the visible pages inside the floating window - KryptonPageCollection pages = new KryptonPageCollection(); + var pages = new KryptonPageCollection(); KryptonWorkspaceCell? cell = window.FloatspaceElement.FloatspaceControl.FirstVisibleCell(); while (cell != null) { @@ -3251,10 +3253,7 @@ public byte[] SaveConfigToArray(Encoding encoding) /// Saves docking configuration information into a named file using Unicode Encoding. /// /// Name of file to save to. - public void SaveConfigToFile(string filename) - { - SaveConfigToFile(filename, Encoding.Unicode); - } + public void SaveConfigToFile(string filename) => SaveConfigToFile(filename, Encoding.Unicode); /// /// Saves docking configuration information into a named file. @@ -3678,20 +3677,20 @@ public virtual KryptonWorkspaceCell[] CellsWorkspace case DockingLocation.Docked: { // Unique name page must be inside a Dockspace instance - KryptonDockingDockspace? dockspace = FindPageElement(uniqueName) as KryptonDockingDockspace; + var dockspace = FindPageElement(uniqueName) as KryptonDockingDockspace; // Find the cell containing the unique name page return dockspace?.CellForPage(uniqueName); } case DockingLocation.Floating: { // Unique name page must be inside a Dockspace instance - KryptonDockingFloatspace? floatspace = FindPageElement(uniqueName) as KryptonDockingFloatspace; + var floatspace = FindPageElement(uniqueName) as KryptonDockingFloatspace; // Find the cell containing the unique name page return floatspace?.CellForPage(uniqueName); } case DockingLocation.Workspace: { - KryptonDockingWorkspace? workspace = FindPageElement(uniqueName) as KryptonDockingWorkspace; + var workspace = FindPageElement(uniqueName) as KryptonDockingWorkspace; // Find the cell containing the unique name page return workspace?.CellForPage(uniqueName); } @@ -4094,11 +4093,9 @@ private static void RemoveControlStorePages(DockingElement element, string[] uni } } - private void OnStringPropertyChanged(object sender, PropertyChangedEventArgs e) - { + private void OnStringPropertyChanged(object sender, PropertyChangedEventArgs e) => // Piggy back the name of the changed property in the unique name parameter PropogateAction(DockingPropogateAction.StringChanged, new[] { e.PropertyName }); - } private void OnDropDownWorkspaceClicked(object sender, EventArgs e) { diff --git a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingNavigator.cs b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingNavigator.cs index 54045e591..795403cd7 100644 --- a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingNavigator.cs +++ b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingNavigator.cs @@ -88,11 +88,9 @@ public override IDockingElement? Parent /// Add a KryptonPage to the navigator. /// /// KryptonPage to be added. - public void Append(KryptonPage page) - { + public void Append(KryptonPage page) => // Use existing array adding method to prevent duplication of code Append(new[] { page }); - } /// /// Add a KryptonPage array to the navigator. @@ -108,7 +106,7 @@ public void Append(KryptonPage[]? pages) DockableNavigatorControl.Pages.AddRange(pages); } - Size childMinSize = Size.Empty; + var childMinSize = Size.Empty; foreach (var page in DockableNavigatorControl.Pages) { if (childMinSize.Height < page.MinimumSize.Height) @@ -154,10 +152,10 @@ public void ShowPage(KryptonPage page) /// Show all display elements of the provided page. /// /// Unique name of the page that should be shown. - public void ShowPage(string uniqueName) + public void ShowPage([DisallowNull] string uniqueName) { // Cannot show a null reference - if (uniqueName == null) + if (string.IsNullOrWhiteSpace(uniqueName)) { throw new ArgumentNullException(nameof(uniqueName)); } @@ -199,7 +197,7 @@ public void ShowPages(KryptonPage[] pages) /// Show all display elements of the provided pages. /// /// Array of unique names of the pages that should be shown. - public void ShowPages(string[] uniqueNames) + public void ShowPages([DisallowNull] string[] uniqueNames) { // Cannot show a null reference if (uniqueNames == null) @@ -448,7 +446,7 @@ public void RemoveAllPages(bool disposePage) /// /// Action that is requested to be performed. /// Array of unique names of the pages the action relates to. - public override void PropogateAction(DockingPropogateAction action, string?[] uniqueNames) + public override void PropogateAction(DockingPropogateAction action, string[] uniqueNames) { KryptonPageCollection pageCollection = DockableNavigatorControl.Pages; switch (action) @@ -487,7 +485,7 @@ public override void PropogateAction(DockingPropogateAction action, string?[] un { // Swap pages that are not placeholders to become placeholders KryptonPage? page = pageCollection[i]; - if (page is { } and not KryptonStorePage) + if (page is not null and not KryptonStorePage) { // Replace the existing page with a placeholder that has the same unique name var placeholder = new KryptonStorePage(page.UniqueName, _storeName); @@ -622,7 +620,7 @@ public override void PropogatePageList(DockingPropogatePageList state, KryptonPa { // Only add real pages and not placeholders KryptonPage? page = DockableNavigatorControl.Pages[i]; - if (page is { } and not KryptonStorePage) + if (page is not null and not KryptonStorePage) { pages.Add(page); } @@ -797,7 +795,7 @@ public override void LoadElementFromXml(XmlReader xmlReader, KryptonPageCollecti // Grab the element attributes var elementName = xmlReader.GetAttribute(@"N"); - string elementCount = xmlReader.GetAttribute(@"C") ?? string.Empty; + var elementCount = xmlReader.GetAttribute(@"C") ?? string.Empty; // Check the name matches up if (elementName != Name) @@ -851,7 +849,7 @@ public override void LoadElementFromXml(XmlReader xmlReader, KryptonPageCollecti manager.RaiseRecreateLoadingPage(args); - if (args is { Cancel: false, Page: { } }) + if (args is { Cancel: false, Page: not null }) { page = args.Page; } diff --git a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingSpace.cs b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingSpace.cs index 686bd7638..f1a0e8e13 100644 --- a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingSpace.cs +++ b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingSpace.cs @@ -47,11 +47,9 @@ protected KryptonDockingSpace(string name, string storeName) /// Add a KryptonPage to the currently active cell or create a new cell is no cell is currently active. /// /// KryptonPage to be added. - public void Append(KryptonPage page) - { + public void Append(KryptonPage page) => // Use existing array adding method to prevent duplication of code Append(new[] { page }); - } /// /// Add a KryptonPage array to the currently active cell or create a new cell is no cell is currently active. @@ -112,11 +110,9 @@ private void ObserveAutoHiddenSlideSize(KryptonPage[] pages) /// /// Reference to existing workspace cell. /// KryptonPage instance to be added. - public void CellAppend(KryptonWorkspaceCell cell, KryptonPage page) - { + public void CellAppend(KryptonWorkspaceCell cell, KryptonPage page) => // Use existing array adding method to prevent duplication of code CellAppend(cell, new[] { page }); - } /// /// Add a KryptonPage array into an existing cell. @@ -165,11 +161,9 @@ public void CellAppend(KryptonWorkspaceCell cell, KryptonPage[]? pages) /// Reference to existing workspace cell. /// Index for inserting new pages. /// KryptonPage instance to be added. - public void CellInsert(KryptonWorkspaceCell cell, int index, KryptonPage page) - { + public void CellInsert(KryptonWorkspaceCell cell, int index, KryptonPage page) => // Use existing array adding method to prevent duplication of code CellInsert(cell, index, new[] { page }); - } /// /// Add a KryptonPage array into an existing cell starting at the provided index. @@ -244,7 +238,7 @@ public override IDockingElement? Parent /// /// Action that is requested to be performed. /// Array of unique names of the pages the action relates to. - public override void PropogateAction(DockingPropogateAction action, string?[] uniqueNames) + public override void PropogateAction(DockingPropogateAction action, string[]? uniqueNames) { if (SpaceControl == null) { @@ -277,7 +271,7 @@ public override void PropogateAction(DockingPropogateAction action, string?[] un } foreach (KryptonPage? page in uniqueNames .Select(uniqueName => SpaceControl.PageForUniqueName(uniqueName)) - .Where(static page => page is { } and not KryptonStorePage)) + .Where(static page => page is not null and not KryptonStorePage)) { page!.Visible = newVisible; } @@ -299,7 +293,7 @@ public override void PropogateAction(DockingPropogateAction action, string?[] un { // If the named page exists and is not placeholder then remove it KryptonPage? removePage = SpaceControl.PageForUniqueName(uniqueName); - if (removePage is { } and not KryptonStorePage) + if (removePage is not null and not KryptonStorePage) { // Find the cell that contains the target so we can remove the page KryptonWorkspaceCell? cell = SpaceControl.CellForPage(removePage); @@ -328,7 +322,7 @@ public override void PropogateAction(DockingPropogateAction action, string?[] un { // Only remove the actual page and not placeholders KryptonPage? page = cell.Pages[i]; - if (page is { } and not KryptonStorePage) + if (page is not null and not KryptonStorePage) { cell.Pages.RemoveAt(i); @@ -355,7 +349,7 @@ public override void PropogateAction(DockingPropogateAction action, string?[] un { // Swap pages that are not placeholders to become placeholders KryptonPage? page = SpaceControl.PageForUniqueName(uniqueName); - if (page is { } and not KryptonStorePage) + if (page is not null and not KryptonStorePage) { // Replace the existing page with a placeholder that has the same unique name KryptonWorkspaceCell? cell = SpaceControl.CellForPage(page); @@ -379,7 +373,7 @@ public override void PropogateAction(DockingPropogateAction action, string?[] un { // Swap pages that are not placeholders to become placeholders KryptonPage? page = cell.Pages[i]; - if (page is { } and not KryptonStorePage) + if (page is not null and not KryptonStorePage) { // Replace the existing page with a placeholder that has the same unique name var placeholder = new KryptonStorePage(page.UniqueName, _storeName); @@ -493,7 +487,7 @@ public override void PropogateAction(DockingPropogateAction action, KryptonPage[ { // Return the definitive answer 'true' if the control contains the named page KryptonPage? page = SpaceControl?.PageForUniqueName(uniqueName); - if (page is { } and not KryptonStorePage) + if (page is not null and not KryptonStorePage) { return true; } @@ -513,7 +507,7 @@ public override void PropogateAction(DockingPropogateAction action, KryptonPage[ { // If we have the requested page then return the visible state of the page KryptonPage? page = SpaceControl?.PageForUniqueName(uniqueName); - if (page is { } and not KryptonStorePage) + if (page is not null and not KryptonStorePage) { return page.LastVisibleSet; } @@ -539,7 +533,7 @@ public override void PropogateAction(DockingPropogateAction action, KryptonPage[ { // If we have the requested name page and it is not a placeholder then we have found it KryptonPage? page = SpaceControl?.PageForUniqueName(uniqueName); - if (page is { } and not KryptonStorePage) + if (page is not null and not KryptonStorePage) { return page; } @@ -579,7 +573,7 @@ public override void PropogatePageList(DockingPropogatePageList state, KryptonPa { // Only add real pages and not placeholders KryptonPage? page = cell.Pages[i]; - if (page is { } and not KryptonStorePage) + if (page is not null and not KryptonStorePage) { pages.Add(page); } @@ -937,7 +931,7 @@ private void OnSpaceCellAdding(object sender, WorkspaceCellEventArgs e) private void OnSpaceCellRemoved(object sender, EventArgs e) { // Remove event hooks so cell can be garbage collected - KryptonWorkspaceCell cell = (KryptonWorkspaceCell)sender; + var cell = (KryptonWorkspaceCell)sender; cell.Disposed -= OnSpaceCellRemoved; RaiseCellRemoved(cell); diff --git a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingWorkspace.cs b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingWorkspace.cs index 296e0a301..eca36952a 100644 --- a/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingWorkspace.cs +++ b/Source/Krypton Components/Krypton.Docking/Elements Impl/KryptonDockingWorkspace.cs @@ -393,7 +393,7 @@ public void RemoveAllPages(bool disposePage) /// /// Action that is requested to be performed. /// Array of unique names of the pages the action relates to. - public override void PropogateAction(DockingPropogateAction action, string?[] uniqueNames) + public override void PropogateAction(DockingPropogateAction action, string[]? uniqueNames) { switch (action) { diff --git a/Source/Krypton Components/Krypton.Docking/Event Args/CancelUniqueNameEventArgs.cs b/Source/Krypton Components/Krypton.Docking/Event Args/CancelUniqueNameEventArgs.cs index e9e2e9e18..445206b7c 100644 --- a/Source/Krypton Components/Krypton.Docking/Event Args/CancelUniqueNameEventArgs.cs +++ b/Source/Krypton Components/Krypton.Docking/Event Args/CancelUniqueNameEventArgs.cs @@ -23,7 +23,7 @@ public class CancelUniqueNameEventArgs : UniqueNameEventArgs /// /// Unique name of page. /// Initial value for the cancel property. - public CancelUniqueNameEventArgs(string uniqueName, bool cancel) + public CancelUniqueNameEventArgs([DisallowNull] string uniqueName, bool cancel) : base(uniqueName) => Cancel = cancel; diff --git a/Source/Krypton Components/Krypton.Docking/General/Definitions.cs b/Source/Krypton Components/Krypton.Docking/General/Definitions.cs index ac7867198..4e086be22 100644 --- a/Source/Krypton Components/Krypton.Docking/General/Definitions.cs +++ b/Source/Krypton Components/Krypton.Docking/General/Definitions.cs @@ -45,7 +45,7 @@ public interface IDockingElement : IEnumerable /// /// Action that is requested to be performed. /// Array of unique names of the pages the action relates to. - void PropogateAction(DockingPropogateAction action, string?[] uniqueNames); + void PropogateAction(DockingPropogateAction action, string[]? uniqueNames); /// /// Propagates an action request down the hierarchy of docking elements. diff --git a/Source/Krypton Components/Krypton.Docking/General/DockingHelper.cs b/Source/Krypton Components/Krypton.Docking/General/DockingHelper.cs index 30766ed5b..d717f5cb3 100644 --- a/Source/Krypton Components/Krypton.Docking/General/DockingHelper.cs +++ b/Source/Krypton Components/Krypton.Docking/General/DockingHelper.cs @@ -48,14 +48,11 @@ public static DockStyle DockStyleFromDockEdge(DockingEdge edge, bool opposite) /// /// DockEdge value to convert. /// Orientation value. - public static Orientation OrientationFromDockEdge(DockingEdge edge) + public static Orientation OrientationFromDockEdge(DockingEdge edge) => edge switch { - return edge switch - { - DockingEdge.Left or DockingEdge.Right => Orientation.Vertical, - _ => Orientation.Horizontal - }; - } + DockingEdge.Left or DockingEdge.Right => Orientation.Vertical, + _ => Orientation.Horizontal + }; /// /// Find the inner space that occupied by the edge docking controls. diff --git a/Source/Krypton Components/Krypton.Docking/General/DockingMultiUpdate.cs b/Source/Krypton Components/Krypton.Docking/General/DockingMultiUpdate.cs index c805c4204..7425f103f 100644 --- a/Source/Krypton Components/Krypton.Docking/General/DockingMultiUpdate.cs +++ b/Source/Krypton Components/Krypton.Docking/General/DockingMultiUpdate.cs @@ -31,7 +31,7 @@ public DockingMultiUpdate(IDockingElement dockingElement) // Inform docking elements that a multi-part update is starting _dockingElement = dockingElement ?? throw new ArgumentNullException(nameof(dockingElement)); - _dockingElement.PropogateAction(DockingPropogateAction.StartUpdate, (string[])null); + _dockingElement.PropogateAction(DockingPropogateAction.StartUpdate, null as string[]); } /// @@ -40,7 +40,7 @@ public DockingMultiUpdate(IDockingElement dockingElement) public void Dispose() { // Inform docking elements that a multi-part update has ended - _dockingElement.PropogateAction(DockingPropogateAction.EndUpdate, (string[])null); + _dockingElement.PropogateAction(DockingPropogateAction.EndUpdate, null as string[]); GC.SuppressFinalize(this); } #endregion diff --git a/Source/Krypton Components/Krypton.Docking/Palette/DockingManagerStrings.cs b/Source/Krypton Components/Krypton.Docking/Palette/DockingManagerStrings.cs index 5dd8769df..6423860f5 100644 --- a/Source/Krypton Components/Krypton.Docking/Palette/DockingManagerStrings.cs +++ b/Source/Krypton Components/Krypton.Docking/Palette/DockingManagerStrings.cs @@ -321,10 +321,7 @@ public string TextWindowLocation /// Raises the PropertyChanged event. /// /// Name of the property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion } } diff --git a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFixed.cs b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFixed.cs index e626ca6f9..9895250a4 100644 --- a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFixed.cs +++ b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFixed.cs @@ -91,10 +91,7 @@ public HeaderLocation HeaderLocation /// /// Resets the HeaderLocation property to its default value. /// - public void ResetHeaderLocation() - { - HeaderLocation = HeaderLocation.PrimaryHeader; - } + public void ResetHeaderLocation() => HeaderLocation = HeaderLocation.PrimaryHeader; #endregion #region IButtonSpecValues diff --git a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFixedConverter.cs b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFixedConverter.cs index d7d270b38..c1d1cb7ea 100644 --- a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFixedConverter.cs +++ b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFixedConverter.cs @@ -45,7 +45,7 @@ public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destina if (destinationType == typeof(string)) { // Cast to correct type - ButtonSpecNavFixed buttonSpec = (ButtonSpecNavFixed)value!; + var buttonSpec = (ButtonSpecNavFixed)value!; // Ask the button spec for the correct string return buttonSpec.ToString(); diff --git a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormClose.cs b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormClose.cs index ba1c6b9f9..744253fa1 100644 --- a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormClose.cs +++ b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormClose.cs @@ -46,7 +46,7 @@ public bool Enabled if (_enabled != value) { _enabled = value; - IntPtr hSystemMenu = PI.GetSystemMenu(_navigator.Owner!.Handle, false); + var hSystemMenu = PI.GetSystemMenu(_navigator.Owner!.Handle, false); if (hSystemMenu != IntPtr.Zero) { PI.EnableMenuItem(hSystemMenu, PI.SC_.CLOSE, _enabled ? PI.MF_.ENABLED : PI.MF_.DISABLED); @@ -84,9 +84,9 @@ protected override void OnClick(EventArgs e) { if (GetViewEnabled()) { - if (_navigator.Owner != null && !_navigator.Owner.InertForm) + if (_navigator.Owner is { InertForm: false }) { - MouseEventArgs mea = (MouseEventArgs)e; + var mea = (MouseEventArgs)e; if (GetView()!.ClientRectangle.Contains(mea.Location)) { @@ -100,7 +100,7 @@ protected override void OnClick(EventArgs e) Point screenPosition = Control.MousePosition; - IntPtr lParam = (IntPtr)(PI.MAKELOWORD(screenPosition.X) | PI.MAKEHIWORD(screenPosition.Y)); + var lParam = (IntPtr)(PI.MAKELOWORD(screenPosition.X) | PI.MAKEHIWORD(screenPosition.Y)); // Note: Do I need to make 'SC_' public? //? Navigator.Owner.SendSysCommand(PI.SC_.CLOSE, lParam); diff --git a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormMaximize.cs b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormMaximize.cs index e97a6c728..5b08f8429 100644 --- a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormMaximize.cs +++ b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormMaximize.cs @@ -76,7 +76,7 @@ protected override void OnClick(EventArgs e) if (!_navigator.Owner!.InertForm) { // Only if the mouse is still within the button bounds do we perform action - MouseEventArgs mea = (MouseEventArgs)e; + var mea = (MouseEventArgs)e; if (GetView()!.ClientRectangle.Contains(mea.Location)) { // Toggle between maximized and restored diff --git a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormMinimize.cs b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormMinimize.cs index d52457c01..9bd624fe4 100644 --- a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormMinimize.cs +++ b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavFormMinimize.cs @@ -15,19 +15,10 @@ public ButtonSpecNavFormMinimize(KryptonNavigator navigator) : base(navigator, P { } - public override bool GetVisible(PaletteBase? palette) - { - throw new NotImplementedException(); - } + public override bool GetVisible(PaletteBase? palette) => throw new NotImplementedException(); - public override ButtonCheckState GetChecked(PaletteBase? palette) - { - throw new NotImplementedException(); - } + public override ButtonCheckState GetChecked(PaletteBase? palette) => throw new NotImplementedException(); - public override ButtonEnabled GetEnabled(PaletteBase? palette) - { - throw new NotImplementedException(); - } + public override ButtonEnabled GetEnabled(PaletteBase? palette) => throw new NotImplementedException(); } } \ No newline at end of file diff --git a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavManagerLayoutHeaderBar.cs b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavManagerLayoutHeaderBar.cs index 5aa549ad6..ed8ac85e4 100644 --- a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavManagerLayoutHeaderBar.cs +++ b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavManagerLayoutHeaderBar.cs @@ -80,7 +80,7 @@ public void UpdateRemapping(IPaletteContent? paletteContent, foreach (ButtonSpecView view in ButtonSpecViews) { // Cast the remapping palette to the correct type - ButtonSpecRemapByContentCache remapPalette = (ButtonSpecRemapByContentCache)view.RemapPalette!; + var remapPalette = (ButtonSpecRemapByContentCache)view.RemapPalette!; remapPalette.SetPaletteContent(_paletteContent); remapPalette.SetPaletteState(_paletteState); } @@ -115,7 +115,7 @@ protected override void ButtonSpecCreated(ButtonSpec buttonSpec, int viewDockerIndex) { // Cast the remapping palette to the correct type - ButtonSpecRemapByContentCache remapPalette = (ButtonSpecRemapByContentCache)buttonView.RemapPalette!; + var remapPalette = (ButtonSpecRemapByContentCache)buttonView.RemapPalette!; // Update button with the foreground used for color mapping remapPalette.SetPaletteContent(_paletteContent); diff --git a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavigator.cs b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavigator.cs index 16e01a7c7..6993b7589 100644 --- a/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavigator.cs +++ b/Source/Krypton Components/Krypton.Navigator/ButtonSpecs/ButtonSpecNavigator.cs @@ -61,10 +61,7 @@ public PaletteNavButtonSpecStyle TypeRestricted /// /// Resets the TypeRestricted property to its default value. /// - public void ResetTypeRestricted() - { - TypeRestricted = PaletteNavButtonSpecStyle.Generic; - } + public void ResetTypeRestricted() => TypeRestricted = PaletteNavButtonSpecStyle.Generic; #endregion #region Implementation diff --git a/Source/Krypton Components/Krypton.Navigator/Controller/DragViewController.cs b/Source/Krypton Components/Krypton.Navigator/Controller/DragViewController.cs index bd90f38a1..0b610fca9 100644 --- a/Source/Krypton Components/Krypton.Navigator/Controller/DragViewController.cs +++ b/Source/Krypton Components/Krypton.Navigator/Controller/DragViewController.cs @@ -395,19 +395,13 @@ protected virtual void OnLeftMouseDown(EventArgs e) /// Raises the RightMouseDown event. /// /// An EventArgs containing the event data. - protected virtual void OnRightMouseDown(EventArgs e) - { - RightMouseDown?.Invoke(this, e); - } + protected virtual void OnRightMouseDown(EventArgs e) => RightMouseDown?.Invoke(this, e); /// /// Raises the LeftDoubleClick event. /// /// An EventArgs containing the event data. - protected virtual void OnLeftDoubleClick(EventArgs e) - { - LeftDoubleClick?.Invoke(this, e); - } + protected virtual void OnLeftDoubleClick(EventArgs e) => LeftDoubleClick?.Invoke(this, e); /// /// Raises the DragStart event. diff --git a/Source/Krypton Components/Krypton.Navigator/Controller/OutlookMiniController.cs b/Source/Krypton Components/Krypton.Navigator/Controller/OutlookMiniController.cs index 31f0919fd..73ee78421 100644 --- a/Source/Krypton Components/Krypton.Navigator/Controller/OutlookMiniController.cs +++ b/Source/Krypton Components/Krypton.Navigator/Controller/OutlookMiniController.cs @@ -92,11 +92,9 @@ public virtual void MouseEnter(Control c) /// /// Reference to the source control instance. /// Mouse position relative to control. - public virtual void MouseMove(Control c, Point pt) - { + public virtual void MouseMove(Control c, Point pt) => // Update the visual state UpdateTargetState(pt); - } /// /// Mouse button has been pressed in the view. @@ -323,10 +321,7 @@ public NeedPaintHandler? NeedPaint /// Fires the NeedPaint event. /// /// Does the palette change require a layout. - public void PerformNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout); - } + public void PerformNeedPaint(bool needLayout) => OnNeedPaint(needLayout); #endregion #region Protected @@ -400,10 +395,7 @@ protected void UpdateTargetState(Point pt) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, _target.ClientRectangle)); - } + protected virtual void OnNeedPaint(bool needLayout) => _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, _target.ClientRectangle)); #endregion } diff --git a/Source/Krypton Components/Krypton.Navigator/Controls Navigator/KryptonNavigator.cs b/Source/Krypton Components/Krypton.Navigator/Controls Navigator/KryptonNavigator.cs index 102c367d8..a0660dfc3 100644 --- a/Source/Krypton Components/Krypton.Navigator/Controls Navigator/KryptonNavigator.cs +++ b/Source/Krypton Components/Krypton.Navigator/Controls Navigator/KryptonNavigator.cs @@ -731,10 +731,7 @@ public NavigatorMode NavigatorMode /// /// Resets the Mode property to its default value. /// - public void ResetNavigatorMode() - { - NavigatorMode = NavigatorMode.BarTabGroup; - } + public void ResetNavigatorMode() => NavigatorMode = NavigatorMode.BarTabGroup; /// /// Gets and sets the page background style. @@ -914,36 +911,24 @@ public void DismissPopups() /// /// Set the visible state of all the pages in the navigator to hidden. /// - public void HideAllPages() - { - UpdateAllPagesVisible(false, null); - } + public void HideAllPages() => UpdateAllPagesVisible(false, null); /// /// Set the visible state of all the pages in the navigator to hidden. /// /// Ignore pages of the specific type. - public void HideAllPages(Type excludeType) - { - UpdateAllPagesVisible(false, excludeType); - } + public void HideAllPages(Type excludeType) => UpdateAllPagesVisible(false, excludeType); /// /// Set the visible state of all the pages in the navigator to showing. /// - public void ShowAllPages() - { - UpdateAllPagesVisible(true, null); - } + public void ShowAllPages() => UpdateAllPagesVisible(true, null); /// /// Set the visible state of all the pages in the navigator to showing. /// /// Ignore pages of the specific type. - public void ShowAllPages(Type? excludeType) - { - UpdateAllPagesVisible(true, excludeType); - } + public void ShowAllPages(Type? excludeType) => UpdateAllPagesVisible(true, excludeType); /// /// Gets the KryptonPage associated with the provided point. @@ -1028,10 +1013,7 @@ public bool SelectPreviousPage(KryptonPage? page, bool wrap) => /// /// Generates a ContextAction event for a Navigator. /// - public void PerformContextAction() - { - OnContextAction(); - } + public void PerformContextAction() => OnContextAction(); /// /// Generates a PreviousAction event for a Navigator. @@ -1049,10 +1031,7 @@ public void PerformContextAction() /// Fires the NeedPaint event and also repaints the selected page. /// /// Does the palette change require a layout. - public void PerformNeedPagePaint(bool needLayout) - { - OnNeedPagePaint(this, new NeedLayoutEventArgs(needLayout)); - } + public void PerformNeedPagePaint(bool needLayout) => OnNeedPagePaint(this, new NeedLayoutEventArgs(needLayout)); /// /// Gets the child panel used for displaying actual pages. @@ -1086,12 +1065,10 @@ public bool DesignerGetHitTest(Point pt) => /// Called by the designer to indicate that the mouse has left the control. /// [EditorBrowsable(EditorBrowsableState.Never)] - public void DesignerMouseLeave() - { + public void DesignerMouseLeave() => // Simulate the mouse leaving the control so that the tracking // element that thinks it has the focus is informed it does not OnMouseLeave(EventArgs.Empty); - } /// /// Output debug information about the navigator. @@ -1422,73 +1399,49 @@ protected override void UpdateGlobalEvents(bool attach) /// Raises the Deselecting event. /// /// A KryptonPageCancelEventArgs containing event details. - protected virtual void OnDeselecting(KryptonPageCancelEventArgs e) - { - Deselecting?.Invoke(this, e); - } + protected virtual void OnDeselecting(KryptonPageCancelEventArgs e) => Deselecting?.Invoke(this, e); /// /// Raises the Selecting event. /// /// A KryptonPageCancelEventArgs containing event details. - protected virtual void OnSelecting(KryptonPageCancelEventArgs e) - { - Selecting?.Invoke(this, e); - } + protected virtual void OnSelecting(KryptonPageCancelEventArgs e) => Selecting?.Invoke(this, e); /// /// Raises the Deselected event. /// /// A KryptonPageEventArgs containing event details. - protected virtual void OnDeselected(KryptonPageEventArgs e) - { - Deselected?.Invoke(this, e); - } + protected virtual void OnDeselected(KryptonPageEventArgs e) => Deselected?.Invoke(this, e); /// /// Raises the Selected event. /// /// A KryptonPageEventArgs containing event details. - protected virtual void OnSelected(KryptonPageEventArgs e) - { - Selected?.Invoke(this, e); - } + protected virtual void OnSelected(KryptonPageEventArgs e) => Selected?.Invoke(this, e); /// /// Raises the BeforePageReorder event. /// /// A PageDragCancelEventArgs containing event details. - protected internal virtual void OnBeforePageReorder(PageReorderEventArgs de) - { - BeforePageReorder?.Invoke(this, de); - } + protected internal virtual void OnBeforePageReorder(PageReorderEventArgs de) => BeforePageReorder?.Invoke(this, de); /// /// Raises the BeforePageDrag event. /// /// A PageDragCancelEventArgs containing event details. - protected virtual void OnBeforePageDrag(PageDragCancelEventArgs de) - { - BeforePageDrag?.Invoke(this, de); - } + protected virtual void OnBeforePageDrag(PageDragCancelEventArgs de) => BeforePageDrag?.Invoke(this, de); /// /// Raises the AfterPageDrag event. /// /// A EventArgs containing event details. - protected virtual void OnAfterPageDrag(PageDragEndEventArgs e) - { - AfterPageDrag?.Invoke(this, e); - } + protected virtual void OnAfterPageDrag(PageDragEndEventArgs e) => AfterPageDrag?.Invoke(this, e); /// /// Raises the PageDrop event. /// /// A v containing event details. - protected internal virtual void OnPageDrop(PageDropEventArgs e) - { - PageDrop?.Invoke(this, e); - } + protected internal virtual void OnPageDrop(PageDropEventArgs e) => PageDrop?.Invoke(this, e); /// /// Raises the SelectedPageChanged event. @@ -1544,7 +1497,7 @@ protected virtual void OnSelectedPageChanged(EventArgs e) /// Returns the action that was performed. protected virtual DirectionButtonAction OnPreviousAction() { - DirectionButtonAction dba = DirectionButtonAction.None; + var dba = DirectionButtonAction.None; // Ignore call as view builder is already destructed if (!IsDisposed && (ViewBuilder != null)) @@ -1578,7 +1531,7 @@ protected virtual DirectionButtonAction OnPreviousAction() /// Returns the action that was performed. protected virtual DirectionButtonAction OnNextAction() { - DirectionButtonAction dba = DirectionButtonAction.None; + var dba = DirectionButtonAction.None; // Ignore call as view builder is already destructed if (!IsDisposed && (ViewBuilder != null)) @@ -1622,10 +1575,7 @@ protected virtual void OnContextAction(/*ContextActionEventArgs e*/) /// Raises the CloseAction event. /// /// An CloseActionEventArgs containing the event args. - protected virtual void OnCloseAction(CloseActionEventArgs e) - { - CloseAction?.Invoke(this, e); - } + protected virtual void OnCloseAction(CloseActionEventArgs e) => CloseAction?.Invoke(this, e); /// /// Should the OnInitialized call perform layout. @@ -1639,7 +1589,7 @@ protected virtual void OnCloseAction(CloseActionEventArgs e) /// Returns the action that was performed. protected virtual CloseButtonAction OnCloseAction(KryptonPage? page) { - CloseButtonAction cba = CloseButtonAction.None; + var cba = CloseButtonAction.None; if (page != null && !IsDisposed // Ignore call as view builder is already destructed @@ -1714,145 +1664,97 @@ protected virtual CloseButtonAction OnCloseAction(KryptonPage? page) /// Raises the TabCountChanged event. /// /// An EventArgs containing the event args. - protected virtual void OnTabCountChanged(EventArgs e) - { - TabCountChanged?.Invoke(this, e); - } + protected virtual void OnTabCountChanged(EventArgs e) => TabCountChanged?.Invoke(this, e); /// /// Raises the TabVisibleCountChanged event. /// /// An EventArgs containing the event args. - protected internal virtual void OnTabVisibleCountChanged(EventArgs e) - { - TabVisibleCountChanged?.Invoke(this, e); - } + protected internal virtual void OnTabVisibleCountChanged(EventArgs e) => TabVisibleCountChanged?.Invoke(this, e); /// /// Raises the TabClicked event. /// /// An KryptonPageEventArgs containing the event args. - protected internal virtual void OnTabClicked(KryptonPageEventArgs e) - { - TabClicked?.Invoke(this, e); - } + protected internal virtual void OnTabClicked(KryptonPageEventArgs e) => TabClicked?.Invoke(this, e); /// /// Raises the TabDoubleClicked event. /// /// An KryptonPageEventArgs containing the event args. - protected internal virtual void OnTabDoubleClicked(KryptonPageEventArgs e) - { - TabDoubleClicked?.Invoke(this, e); - } + protected internal virtual void OnTabDoubleClicked(KryptonPageEventArgs e) => TabDoubleClicked?.Invoke(this, e); /// /// Raises the PrimaryHeaderLeftClicked event. /// /// An EventArgs containing the event args. - protected internal virtual void OnPrimaryHeaderLeftClicked(EventArgs e) - { - PrimaryHeaderLeftClicked?.Invoke(this, e); - } + protected internal virtual void OnPrimaryHeaderLeftClicked(EventArgs e) => PrimaryHeaderLeftClicked?.Invoke(this, e); /// /// Raises the PrimaryHeaderRightClicked event. /// /// An EventArgs containing the event args. - protected internal virtual void OnPrimaryHeaderRightClicked(EventArgs e) - { - PrimaryHeaderRightClicked?.Invoke(this, e); - } + protected internal virtual void OnPrimaryHeaderRightClicked(EventArgs e) => PrimaryHeaderRightClicked?.Invoke(this, e); /// /// Raises the PrimaryHeaderDoubleClicked event. /// /// An EventArgs containing the event args. - protected internal virtual void OnPrimaryHeaderDoubleClicked(EventArgs e) - { - PrimaryHeaderDoubleClicked?.Invoke(this, e); - } + protected internal virtual void OnPrimaryHeaderDoubleClicked(EventArgs e) => PrimaryHeaderDoubleClicked?.Invoke(this, e); /// /// Raises the OutlookDropDown event. /// /// Context menu about to be Displayed. - protected internal virtual void OnOutlookDropDown(KryptonContextMenu kcm) - { - OutlookDropDown?.Invoke(this, new KryptonContextMenuEventArgs(SelectedPage, SelectedIndex, kcm)); - } + protected internal virtual void OnOutlookDropDown(KryptonContextMenu kcm) => OutlookDropDown?.Invoke(this, new KryptonContextMenuEventArgs(SelectedPage, SelectedIndex, kcm)); /// /// Raises the DisplayPopupPage event. /// /// A PopupPageEventArgs containing event data. - protected internal virtual void OnDisplayPopupPage(PopupPageEventArgs e) - { - DisplayPopupPage?.Invoke(this, e); - } + protected internal virtual void OnDisplayPopupPage(PopupPageEventArgs e) => DisplayPopupPage?.Invoke(this, e); /// /// Raises the ShowContextMenu event. /// /// A ShowContextMenuArgs containing event data. - protected internal virtual void OnShowContextMenu(ShowContextMenuArgs e) - { - ShowContextMenu?.Invoke(this, e); - } + protected internal virtual void OnShowContextMenu(ShowContextMenuArgs e) => ShowContextMenu?.Invoke(this, e); /// /// Raises the CtrlTabStart event. /// /// An CtrlTabCancelEventArgs containing event details. - protected internal virtual void OnCtrlTabStart(CtrlTabCancelEventArgs e) - { - CtrlTabStart?.Invoke(this, e); - } + protected internal virtual void OnCtrlTabStart(CtrlTabCancelEventArgs e) => CtrlTabStart?.Invoke(this, e); /// /// Raises the CtrlTabWrap event. /// /// An CtrlTabCancelEventArgs containing event details. - protected internal virtual void OnCtrlTabWrap(CtrlTabCancelEventArgs e) - { - CtrlTabWrap?.Invoke(this, e); - } + protected internal virtual void OnCtrlTabWrap(CtrlTabCancelEventArgs e) => CtrlTabWrap?.Invoke(this, e); /// /// Raises the TabMouseHoverStart event. /// /// An KryptonPageEventArgs containing event details. - protected virtual void OnTabMouseHoverStart(KryptonPageEventArgs e) - { - TabMouseHoverStart?.Invoke(this, e); - } + protected virtual void OnTabMouseHoverStart(KryptonPageEventArgs e) => TabMouseHoverStart?.Invoke(this, e); /// /// Raises the TabMouseHoverEnd event. /// /// An EventArgs containing event details. - protected virtual void OnTabMouseHoverEnd(EventArgs e) - { - TabMouseHoverEnd?.Invoke(this, e); - } + protected virtual void OnTabMouseHoverEnd(EventArgs e) => TabMouseHoverEnd?.Invoke(this, e); /// /// Raises the TabMoved event. /// /// An TabMovedEventArgs containing event details. - protected internal virtual void OnTabMoved(TabMovedEventArgs e) - { - TabMoved?.Invoke(this, e); - } + protected internal virtual void OnTabMoved(TabMovedEventArgs e) => TabMoved?.Invoke(this, e); /// /// Raises the ViewBuilderPropertyChanged event. /// /// Name of the property that has changed. - protected internal virtual void OnViewBuilderPropertyChanged(string propertyName) - { - ViewBuilderPropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected internal virtual void OnViewBuilderPropertyChanged(string propertyName) => ViewBuilderPropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion @@ -2002,12 +1904,12 @@ internal bool NextActionValid return null; } - internal KryptonPage? PreviousActionPage(KryptonPage page) + internal KryptonPage? PreviousActionPage([DisallowNull] KryptonPage page) { Debug.Assert(page != null); // Get the index of the page - var pos = Pages.IndexOf(page); + var pos = Pages.IndexOf(page!); // Search backwards towards start of pages collection for (var i = pos - 1; i >= 0; i--) @@ -2022,12 +1924,12 @@ internal bool NextActionValid return null; } - internal KryptonPage? NextActionPage(KryptonPage page) + internal KryptonPage? NextActionPage([DisallowNull] KryptonPage page) { Debug.Assert(page != null); // Get the index of the page - var pos = Pages.IndexOf(page); + var pos = Pages.IndexOf(page!); // Search towards end of pages collection for (var i = pos + 1; i < Pages.Count; i++) @@ -2054,8 +1956,8 @@ internal bool NextActionValid return position; } - internal void ShowPopupPage(KryptonPage? page, - ViewBase? relative, + internal void ShowPopupPage([DisallowNull] KryptonPage? page, + [DisallowNull] ViewBase? relative, EventHandler? finishDelegate) { Debug.Assert(page != null); @@ -2487,7 +2389,7 @@ private void OnPageVisibleChanged(object sender, EventArgs e) DismissPopups(); // Cast to correct type - KryptonPage? page = sender as KryptonPage; + var page = sender as KryptonPage; // Is this page in our collection and a child control if (Pages.Contains(page) @@ -2534,7 +2436,7 @@ private void OnPageEnabledChanged(object sender, EventArgs e) // Inform the view builder that a page has changed enabled state if (ViewBuilder != null) { - KryptonPage? page = sender as KryptonPage; + var page = sender as KryptonPage; ViewBuilder.PageEnabledStateChanged(page); } } @@ -2548,7 +2450,7 @@ private void OnPageAppearanceChanged(object sender, PropertyChangedEventArgs e) ) { // Cast to correct type - KryptonPage? page = sender as KryptonPage; + var page = sender as KryptonPage; // If the page is the currently selected one... if (SelectedPage == page) @@ -2580,7 +2482,7 @@ private void OnPageFlagsChanged(object sender, KryptonPageFlagsEventArgs e) DismissPopups(); // Cast to correct type - KryptonPage? page = sender as KryptonPage; + var page = sender as KryptonPage; // Inform the current view builder of flags change ViewBuilder.PageFlagsChanged(page, e.Flags); @@ -2866,7 +2768,7 @@ private void OnOpeningContextMenu(object sender, CancelEventArgs e) else { // Get access to the menu items for selecting a page - KryptonContextMenu contextMenu = (KryptonContextMenu)sender; + var contextMenu = (KryptonContextMenu)sender; // Kill any existing contents and add a items collection for the page entries contextMenu.Items.Clear(); @@ -2955,9 +2857,9 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e) if (!DesignMode) { IContentValues? sourceContent = null; - LabelStyle toolTipStyle = LabelStyle.ToolTip; + var toolTipStyle = LabelStyle.ToolTip; - bool shadow = true; + var shadow = true; // Find the page associated with the tooltip request KryptonPage? toolTipPage = ViewBuilder.PageFromView(e.Target); @@ -3034,11 +2936,9 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e) } } - private void OnCancelToolTip(object sender, EventArgs e) - { + private void OnCancelToolTip(object sender, EventArgs e) => // Remove any currently showing tooltip _visualPopupToolTip?.Dispose(); - } private void OnStartHover(object sender, ToolTipEventArgs e) { @@ -3080,7 +2980,7 @@ private void OnEndHover(object sender, EventArgs e) private void OnVisualPopupToolTipDisposed(object sender, EventArgs e) { // Unhook events from the specific instance that generated event - VisualPopupToolTip popupToolTip = (VisualPopupToolTip)sender; + var popupToolTip = (VisualPopupToolTip)sender; popupToolTip.Disposed -= OnVisualPopupToolTipDisposed; // Not showing a popup page any more @@ -3090,7 +2990,7 @@ private void OnVisualPopupToolTipDisposed(object sender, EventArgs e) private void OnVisualPopupPageDisposed(object sender, EventArgs e) { // Unhook events from the specific instance that generated event - VisualPopupPage popupPage = (VisualPopupPage)sender; + var popupPage = (VisualPopupPage)sender; popupPage.Disposed -= OnVisualPopupPageDisposed; // Not showing a popup page any more @@ -3299,10 +3199,10 @@ private void ResetCachedKryptonContextMenu() private void OnContextMenuClick(object sender, EventArgs e) { // Cast to correct type - KryptonContextMenuItem? menuItem = sender as KryptonContextMenuItem; + var menuItem = sender as KryptonContextMenuItem; // Get the page this menu item references - KryptonPage? page = menuItem?.Tag as KryptonPage; + var page = menuItem?.Tag as KryptonPage; // Try and select the page if we are allowed selected pages if (AllowTabSelect) diff --git a/Source/Krypton Components/Krypton.Navigator/Controls Visuals/VisualPopupPage.cs b/Source/Krypton Components/Krypton.Navigator/Controls Visuals/VisualPopupPage.cs index d8c97756f..0b665313f 100644 --- a/Source/Krypton Components/Krypton.Navigator/Controls Visuals/VisualPopupPage.cs +++ b/Source/Krypton Components/Krypton.Navigator/Controls Visuals/VisualPopupPage.cs @@ -50,7 +50,7 @@ public VisualPopupPage([DisallowNull] KryptonNavigator navigator, _page = page; // Always var the layout that positions the actual page - ViewLayoutPopupPage layoutPage = new ViewLayoutPopupPage(_navigator, _page); + var layoutPage = new ViewLayoutPopupPage(_navigator, _page); // Create the internal panel used for containing content if (_navigator.StateNormal?.HeaderGroup != null) @@ -107,7 +107,7 @@ public VisualPopupPage([DisallowNull] KryptonNavigator navigator, /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { - if (_navigator is { IsChildPanelBorrowed: true, ChildPanel: { } }) + if (_navigator is { IsChildPanelBorrowed: true, ChildPanel: not null }) { // Remove the child panel from ourself and return it // back to the navigator that it was borrowed from @@ -172,7 +172,7 @@ public void ShowCalculatingSize(Rectangle parentScreenRect) Size popupSize = ViewManager.GetPreferredSize(Renderer, Size.Empty); // Get the resolved position for the popup page - PopupPagePosition? position = _navigator.ResolvePopupPagePosition(); + var position = _navigator.ResolvePopupPagePosition(); // Find the size and position relative to the parent screen rect switch (position) @@ -250,7 +250,7 @@ protected override void OnKeyDown(KeyEventArgs e) if (e.KeyData is Keys.Tab or (Keys.Tab | Keys.Shift)) { // If we do not currently contain the focus - if (_page != null && !_page.ContainsFocus) + if (_page is { ContainsFocus: false }) { // Select the appropriate control on the page TabToNextControl(null, (e.KeyData == Keys.Tab)); diff --git a/Source/Krypton Components/Krypton.Navigator/Dragging/DragFeedbackDocking.cs b/Source/Krypton Components/Krypton.Navigator/Dragging/DragFeedbackDocking.cs index 4f31e9251..e9c8a2778 100644 --- a/Source/Krypton Components/Krypton.Navigator/Dragging/DragFeedbackDocking.cs +++ b/Source/Krypton Components/Krypton.Navigator/Dragging/DragFeedbackDocking.cs @@ -63,7 +63,7 @@ public void Dispose() if (_indicators != null) { - IDisposable? dispose = _indicators as IDisposable; + var dispose = _indicators as IDisposable; dispose?.Dispose(); _indicators = null; } @@ -313,10 +313,7 @@ private void ClearClusters() _clusters.Clear(); } - private DockCluster? FindTargetCluster(DragTarget target) - { - return _clusters.FirstOrDefault(cluster => !cluster.ExcludeCluster && cluster != null && cluster.ScreenRect.Equals(target.ScreenRect)); - } + private DockCluster? FindTargetCluster(DragTarget target) => _clusters.FirstOrDefault(cluster => !cluster.ExcludeCluster && cluster != null && cluster.ScreenRect.Equals(target.ScreenRect)); private DragTarget? FindTarget(Point screenPt, PageDragEndData dragEndData) => // Nothing matches diff --git a/Source/Krypton Components/Krypton.Navigator/Dragging/DragFeedbackSolid.cs b/Source/Krypton Components/Krypton.Navigator/Dragging/DragFeedbackSolid.cs index f8ad5e32b..573dbb024 100644 --- a/Source/Krypton Components/Krypton.Navigator/Dragging/DragFeedbackSolid.cs +++ b/Source/Krypton Components/Krypton.Navigator/Dragging/DragFeedbackSolid.cs @@ -110,11 +110,9 @@ public override void Quit() /// Point in screen coordinates. /// Data to be dropped at destination. /// First target that matches; otherwise null. - protected virtual DragTarget? FindTarget(Point screenPt, PageDragEndData? dragEndData) - { + protected virtual DragTarget? FindTarget(Point screenPt, PageDragEndData? dragEndData) => // Ask each target in turn if they are a match for the given screen point - return DragTargets?.FirstOrDefault(target => target.IsMatch(screenPt, dragEndData)); - } + DragTargets?.FirstOrDefault(target => target.IsMatch(screenPt, dragEndData)); #endregion } } diff --git a/Source/Krypton Components/Krypton.Navigator/Dragging/DragManager.cs b/Source/Krypton Components/Krypton.Navigator/Dragging/DragManager.cs index d9cfa8014..8dd04e546 100644 --- a/Source/Krypton Components/Krypton.Navigator/Dragging/DragManager.cs +++ b/Source/Krypton Components/Krypton.Navigator/Dragging/DragManager.cs @@ -348,20 +348,14 @@ public virtual void DragQuit() /// Source of the page drag; can be null. /// Navigator instance associated with source; can be null. /// Event arguments indicating list of pages being dragged. - public virtual void PageDragStart(object sender, KryptonNavigator? navigator, PageDragCancelEventArgs e) - { - e.Cancel = !DragStart(e.ScreenPoint, new PageDragEndData(sender, navigator, e.Pages)); - } + public virtual void PageDragStart(object sender, KryptonNavigator? navigator, PageDragCancelEventArgs e) => e.Cancel = !DragStart(e.ScreenPoint, new PageDragEndData(sender, navigator, e.Pages)); /// /// Occurs when the mouse moves during the drag operation. /// /// Source of the page drag; can be null. /// Event arguments containing the new screen point of the mouse. - public virtual void PageDragMove(object sender, PointEventArgs e) - { - DragMove(e.Point); - } + public virtual void PageDragMove(object sender, PointEventArgs e) => DragMove(e.Point); /// /// Occurs when drag operation completes with pages being dropped. @@ -375,10 +369,7 @@ public virtual void PageDragMove(object sender, PointEventArgs e) /// Occurs when dragging pages has been cancelled. /// /// Source of the page drag; can be null. - public virtual void PageDragQuit(object sender) - { - DragQuit(); - } + public virtual void PageDragQuit(object sender) => DragQuit(); #endregion #region Protected diff --git a/Source/Krypton Components/Krypton.Navigator/Dragging/DragTarget.cs b/Source/Krypton Components/Krypton.Navigator/Dragging/DragTarget.cs index 883652d0c..3754f222f 100644 --- a/Source/Krypton Components/Krypton.Navigator/Dragging/DragTarget.cs +++ b/Source/Krypton Components/Krypton.Navigator/Dragging/DragTarget.cs @@ -92,11 +92,9 @@ public void Dispose() /// Release unmanaged and optionally managed resources. /// /// Called from Dispose method. - protected virtual void Dispose(bool disposing) - { + protected virtual void Dispose(bool disposing) => // Mark as disposed IsDisposed = true; - } /// /// Gets a value indicating if the view has been disposed. @@ -175,7 +173,7 @@ public virtual bool IsMatch(Point screenPt, PageDragEndData? dragEndData) => var e = new PageDropEventArgs(page); target.OnPageDrop(e); - if (e is { Cancel: false, Page: { } }) + if (e is { Cancel: false, Page: not null }) { target.Pages.Add(e.Page); ret = e.Page; diff --git a/Source/Krypton Components/Krypton.Navigator/Dragging/DragTargetNavigatorTransfer.cs b/Source/Krypton Components/Krypton.Navigator/Dragging/DragTargetNavigatorTransfer.cs index 29b66ebc4..77e6a0a14 100644 --- a/Source/Krypton Components/Krypton.Navigator/Dragging/DragTargetNavigatorTransfer.cs +++ b/Source/Krypton Components/Krypton.Navigator/Dragging/DragTargetNavigatorTransfer.cs @@ -99,7 +99,7 @@ public override bool PerformDrop(Point screenPt, PageDragEndData? data) if (page != null) { // If the navigator is allowed to have a selected page then select it - if (_navigator != null && _navigator.AllowTabSelect) + if (_navigator is { AllowTabSelect: true }) { _navigator.SelectedPage = page; } diff --git a/Source/Krypton Components/Krypton.Navigator/Dragging/DropDockingIndicatorsRounded.cs b/Source/Krypton Components/Krypton.Navigator/Dragging/DropDockingIndicatorsRounded.cs index 5b33dc30e..766c6872f 100644 --- a/Source/Krypton Components/Krypton.Navigator/Dragging/DropDockingIndicatorsRounded.cs +++ b/Source/Krypton Components/Krypton.Navigator/Dragging/DropDockingIndicatorsRounded.cs @@ -138,10 +138,7 @@ public void ShowRelative(Rectangle screenRect) /// /// Hide the window from display. /// - public void Hide() - { - PI.ShowWindow(Handle, PI.ShowWindowCommands.SW_HIDE); - } + public void Hide() => PI.ShowWindow(Handle, PI.ShowWindowCommands.SW_HIDE); /// /// Perform mouse hit testing against a screen point. @@ -227,16 +224,16 @@ private void UpdateLayeredWindow(Rectangle rect) } // Get hold of the screen DC - IntPtr hDC = PI.GetDC(IntPtr.Zero); + var hDC = PI.GetDC(IntPtr.Zero); // Create a memory based DC compatible with the screen DC - IntPtr memoryDC = PI.CreateCompatibleDC(hDC); + var memoryDC = PI.CreateCompatibleDC(hDC); // Get access to the bitmap handle contained in the Bitmap object - IntPtr hBitmap = memoryBitmap.GetHbitmap(Color.FromArgb(0)); + var hBitmap = memoryBitmap.GetHbitmap(Color.FromArgb(0)); // Select this bitmap for updating the window presentation - IntPtr oldBitmap = PI.SelectObject(memoryDC, hBitmap); + var oldBitmap = PI.SelectObject(memoryDC, hBitmap); // New window size PI.SIZE ulwsize; diff --git a/Source/Krypton Components/Krypton.Navigator/Dragging/DropSolidWindow.cs b/Source/Krypton Components/Krypton.Navigator/Dragging/DropSolidWindow.cs index 75296e9cd..41feb570a 100644 --- a/Source/Krypton Components/Krypton.Navigator/Dragging/DropSolidWindow.cs +++ b/Source/Krypton Components/Krypton.Navigator/Dragging/DropSolidWindow.cs @@ -62,11 +62,9 @@ protected override void Dispose(bool disposing) /// /// Show the window without taking activation. /// - public void ShowWithoutActivate() - { + public void ShowWithoutActivate() => // Show the window without activating it (i.e. do not take focus) PI.ShowWindow(Handle, PI.ShowWindowCommands.SW_SHOWNOACTIVATE); - } /// /// Gets and sets the new solid rectangle area. diff --git a/Source/Krypton Components/Krypton.Navigator/Navigator/KryptonNavigatorActionList.cs b/Source/Krypton Components/Krypton.Navigator/Navigator/KryptonNavigatorActionList.cs index 69d17b226..e6f0d4e6b 100644 --- a/Source/Krypton Components/Krypton.Navigator/Navigator/KryptonNavigatorActionList.cs +++ b/Source/Krypton Components/Krypton.Navigator/Navigator/KryptonNavigatorActionList.cs @@ -814,7 +814,7 @@ private void AddConstantActions(DesignerActionItemCollection actions) private void OnVisibleClick(object sender, EventArgs e) { // Cast to the correct type - DesignerVerb? verb = sender as DesignerVerb; + var verb = sender as DesignerVerb; // Find out which verb has been used var headerBar = (verb == _headerBarVisible); diff --git a/Source/Krypton Components/Krypton.Navigator/Navigator/KryptonNavigatorDesigner.cs b/Source/Krypton Components/Krypton.Navigator/Navigator/KryptonNavigatorDesigner.cs index b03d82595..db98ba625 100644 --- a/Source/Krypton Components/Krypton.Navigator/Navigator/KryptonNavigatorDesigner.cs +++ b/Source/Krypton Components/Krypton.Navigator/Navigator/KryptonNavigatorDesigner.cs @@ -203,26 +203,17 @@ public override bool CanParent(Control control) /// /// Add a new page to the navigator. /// - public void AddPage() - { - OnAddPage(this, EventArgs.Empty); - } + public void AddPage() => OnAddPage(this, EventArgs.Empty); /// /// Remove the current page from the navigator. /// - public void RemovePage() - { - OnRemovePage(this, EventArgs.Empty); - } + public void RemovePage() => OnRemovePage(this, EventArgs.Empty); /// /// Remove all pages from the navigator. /// - public void ClearPages() - { - OnClearPages(this, EventArgs.Empty); - } + public void ClearPages() => OnClearPages(this, EventArgs.Empty); #endregion #region Protected Overrides @@ -294,28 +285,19 @@ protected override void OnMouseLeave() /// Called when a drag-and-drop operation enters the control designer view. /// /// A DragEventArgs that provides data for the event. - protected override void OnDragEnter(DragEventArgs de) - { - de.Effect = DragDropEffects.None; - } + protected override void OnDragEnter(DragEventArgs de) => de.Effect = DragDropEffects.None; /// /// Called when a drag-and-drop object is dragged over the control designer view. /// /// A DragEventArgs that provides data for the event. - protected override void OnDragOver(DragEventArgs de) - { - de.Effect = DragDropEffects.None; - } + protected override void OnDragOver(DragEventArgs de) => de.Effect = DragDropEffects.None; /// /// Called when a drag-and-drop object is dropped onto the control designer view. /// /// A DragEventArgs that provides data for the event. - protected override void OnDragDrop(DragEventArgs de) - { - de.Effect = DragDropEffects.None; - } + protected override void OnDragDrop(DragEventArgs de) => de.Effect = DragDropEffects.None; #endregion #region Protected Virtual @@ -336,7 +318,7 @@ protected virtual void OnComponentRemoving(object sender, ComponentEventArgs e) if (e.Component == Navigator) { // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all the button spec instances if (Navigator != null) @@ -385,7 +367,7 @@ private void OnAddPage(object sender, EventArgs e) } // Get designer to create the new page component - KryptonPage page = (KryptonPage)_designerHost.CreateComponent(typeof(KryptonPage)); + var page = (KryptonPage)_designerHost.CreateComponent(typeof(KryptonPage)); // Get access to the Name and Text propertues of the new page PropertyDescriptor? propertyName = TypeDescriptor.GetProperties(page)[@"Name"]; diff --git a/Source/Krypton Components/Krypton.Navigator/Navigator/KryptonPageDesigner.cs b/Source/Krypton Components/Krypton.Navigator/Navigator/KryptonPageDesigner.cs index 91df54f6c..351c6cc9e 100644 --- a/Source/Krypton Components/Krypton.Navigator/Navigator/KryptonPageDesigner.cs +++ b/Source/Krypton Components/Krypton.Navigator/Navigator/KryptonPageDesigner.cs @@ -163,7 +163,7 @@ public void SelectParentControl() { _selectionService.SetSelectedComponents(new object[] { ParentNavigator }, SelectionTypes.Primary); } - else if (_page != null && _page.Parent != null) + else if (_page is { Parent: not null }) { _selectionService.SetSelectedComponents(new object[] { _page.Parent }, SelectionTypes.Primary); } @@ -280,7 +280,7 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) if ((_page != null) && (e.Component == _page)) { // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all the button spec instances for (var i = _page.ButtonSpecs.Count - 1; i >= 0; i--) diff --git a/Source/Krypton Components/Krypton.Navigator/Navigator/NavigatorPageCollectionEditor.cs b/Source/Krypton Components/Krypton.Navigator/Navigator/NavigatorPageCollectionEditor.cs index 3920d865b..063339ec6 100644 --- a/Source/Krypton Components/Krypton.Navigator/Navigator/NavigatorPageCollectionEditor.cs +++ b/Source/Krypton Components/Krypton.Navigator/Navigator/NavigatorPageCollectionEditor.cs @@ -26,10 +26,7 @@ public NavigatorPageCollectionEditor() /// Gets the data types that this collection editor can contain. /// /// An array of data types that this collection can contain. - protected override Type[] CreateNewItemTypes() - { - return new[] { typeof(KryptonPage) }; - } + protected override Type[] CreateNewItemTypes() => new[] { typeof(KryptonPage) }; /// /// Sets the specified array as the items of the collection. @@ -40,7 +37,7 @@ protected override Type[] CreateNewItemTypes() protected override object SetItems(object editValue, object[] value) { // Cast the context into the expected control type - KryptonNavigator navigator = (KryptonNavigator)Context.Instance; + var navigator = (KryptonNavigator)Context.Instance; // Suspend changes until collection has been updated navigator?.SuspendLayout(); diff --git a/Source/Krypton Components/Krypton.Navigator/Page/KryptonPage.cs b/Source/Krypton Components/Krypton.Navigator/Page/KryptonPage.cs index 628cc8781..d27a76e05 100644 --- a/Source/Krypton Components/Krypton.Navigator/Page/KryptonPage.cs +++ b/Source/Krypton Components/Krypton.Navigator/Page/KryptonPage.cs @@ -51,7 +51,7 @@ public class KryptonPage : VisualPanel private string? _textDescription; private string _toolTipTitle; private string _toolTipBody; - private string? _uniqueName; + private string _uniqueName; private Bitmap? _imageSmall; private Bitmap? _imageMedium; private Bitmap? _imageLarge; @@ -150,7 +150,7 @@ public KryptonPage(string text) /// /// Initial text. /// Initial unique name. - public KryptonPage(string text, string? uniqueName) + public KryptonPage(string text, string uniqueName) : this(text, null, uniqueName) { } @@ -165,7 +165,7 @@ public KryptonPage(string text, string? uniqueName) /// /// If Min Size not set in the Embedded control, then will default to 150, 50 /// - public KryptonPage(string text, Bitmap? imageSmall, string? uniqueName) + public KryptonPage(string text, Bitmap? imageSmall, string uniqueName) : this(text, imageSmall, uniqueName, new Size(150, 50)) { @@ -178,7 +178,7 @@ public KryptonPage(string text, Bitmap? imageSmall, string? uniqueName) /// Initial small image. /// Initial unique name. /// Min Size of dragged docked control, if not set by Embedded - public KryptonPage(string text, Bitmap? imageSmall, string? uniqueName, Size minSize) + public KryptonPage(string text, Bitmap? imageSmall, string uniqueName, Size minSize) { // Default properties Text = text; @@ -452,10 +452,7 @@ public virtual string TextTitle /// /// Resets the TextTitle property to its default value. /// - public void ResetTextTitle() - { - TextTitle = null; - } + public void ResetTextTitle() => TextTitle = null; /// /// Gets and sets the description text for the page. @@ -511,10 +508,7 @@ public virtual Bitmap? ImageSmall /// /// Resets the ImageSmall property to its default value. /// - public void ResetImageSmall() - { - ImageSmall = null; - } + public void ResetImageSmall() => ImageSmall = null; /// /// Gets and sets the medium image for the page. @@ -541,10 +535,7 @@ public virtual Bitmap? ImageMedium /// /// Resets the ImageMedium property to its default value. /// - public void ResetImageMedium() - { - ImageMedium = null; - } + public void ResetImageMedium() => ImageMedium = null; /// /// Gets and sets the large image for the page. @@ -571,10 +562,7 @@ public virtual Bitmap? ImageLarge /// /// Resets the ImageLarge property to its default value. /// - public void ResetImageLarge() - { - ImageLarge = null; - } + public void ResetImageLarge() => ImageLarge = null; /// /// Gets and sets the page tooltip image. @@ -602,10 +590,7 @@ public virtual Bitmap? ToolTipImage /// /// Resets the ToolTipImage property to its default value. /// - public void ResetToolTipImage() - { - ToolTipImage = null; - } + public void ResetToolTipImage() => ToolTipImage = null; /// /// Gets and sets the tooltip image transparent color. @@ -732,10 +717,7 @@ public virtual LabelStyle ToolTipStyle private bool ShouldSerializeToolTipShadow() => !ToolTipShadow; - private void ResetToolTipShadow() - { - ToolTipShadow = true; - } + private void ResetToolTipShadow() => ToolTipShadow = true; #endregion /// @@ -743,7 +725,8 @@ private void ResetToolTipShadow() /// [Category(@"Appearance")] [Description(@"The unique name of the page.")] - public virtual string? UniqueName + [DisallowNull] + public virtual string UniqueName { [DebuggerStepThrough] get => _uniqueName; @@ -761,11 +744,9 @@ public virtual string? UniqueName /// Fix the control to a particular palette state. /// /// Palette state to fix. - public virtual void SetFixedState(PaletteState state) - { + public virtual void SetFixedState(PaletteState state) => // Request fixed state from the view _drawPanel.FixedState = state; - } /// /// Gets and sets the preferred size for the page when inside an auto hidden slide panel. @@ -1345,74 +1326,51 @@ protected override void OnEnabledChanged(EventArgs e) /// Raises the DockChanged event. /// /// An EventArgs containing the event data. - protected override void OnDockChanged(EventArgs e) - { - DockChanged?.Invoke(this, e); - } + protected override void OnDockChanged(EventArgs e) => DockChanged?.Invoke(this, e); /// /// Raises the LocationChanged event. /// /// An EventArgs containing the event data. - protected override void OnLocationChanged(EventArgs e) - { - LocationChanged?.Invoke(this, e); - } + protected override void OnLocationChanged(EventArgs e) => LocationChanged?.Invoke(this, e); /// /// Raises the TabIndexChanged event. /// /// An EventArgs containing the event data. - protected override void OnTabIndexChanged(EventArgs e) - { - TabIndexChanged?.Invoke(this, e); - } + protected override void OnTabIndexChanged(EventArgs e) => TabIndexChanged?.Invoke(this, e); /// /// Raises the TabStopChanged event. /// /// An EventArgs containing the event data. - protected override void OnTabStopChanged(EventArgs e) - { + protected override void OnTabStopChanged(EventArgs e) => // https://github.com/Krypton-Suite/Standard-Toolkit/issues/1023#issuecomment-1588810368 TabStopChanged?.Invoke(this, e); - } /// /// Raises the AppearancePropertyChanged event. /// /// Name of the appearance property that has changed. - protected virtual void OnAppearancePropertyChanged(string propertyName) - { - AppearancePropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnAppearancePropertyChanged(string propertyName) => AppearancePropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); /// /// Raises the FlagsChanged event. /// /// Set of flags that have changed. - protected virtual void OnFlagsChanged(KryptonPageFlags changed) - { - FlagsChanged?.Invoke(this, new KryptonPageFlagsEventArgs(changed)); - } + protected virtual void OnFlagsChanged(KryptonPageFlags changed) => FlagsChanged?.Invoke(this, new KryptonPageFlagsEventArgs(changed)); /// /// Raises the AutoHiddenSlideSizeChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnAutoHiddenSlideSizeChanged(EventArgs e) - { - AutoHiddenSlideSizeChanged?.Invoke(this, e); - } + protected virtual void OnAutoHiddenSlideSizeChanged(EventArgs e) => AutoHiddenSlideSizeChanged?.Invoke(this, e); /// /// Raises the Load event. /// /// An EventArgs containing the event data. - protected virtual void OnLoad(EventArgs e) - { - Load?.Invoke(this, e); - } + protected virtual void OnLoad(EventArgs e) => Load?.Invoke(this, e); /// /// Processes the need for a repaint for the disabled palette values. @@ -1444,13 +1402,11 @@ protected virtual void OnNeedNormalPaint(object sender, NeedLayoutEventArgs e) #endregion #region Implementation - private void OnKryptonContextMenuDisposed(object sender, EventArgs e) - { + private void OnKryptonContextMenuDisposed(object sender, EventArgs e) => // When the current krypton context menu is disposed, we should remove // it to prevent it being used again, as that would just throw an exception // because it has been disposed. KryptonContextMenu = null; - } #endregion } } diff --git a/Source/Krypton Components/Krypton.Navigator/Palette/HeaderGroupMappingBase.cs b/Source/Krypton Components/Krypton.Navigator/Palette/HeaderGroupMappingBase.cs index d0de02bca..62525080d 100644 --- a/Source/Krypton Components/Krypton.Navigator/Palette/HeaderGroupMappingBase.cs +++ b/Source/Krypton Components/Krypton.Navigator/Palette/HeaderGroupMappingBase.cs @@ -171,10 +171,7 @@ public virtual MapKryptonPageImage MapImage /// /// Resets the MapImage property to its default value. /// - public void ResetMapImage() - { - MapImage = GetMapImageDefault(); - } + public void ResetMapImage() => MapImage = GetMapImageDefault(); #endregion #region MapHeading @@ -203,10 +200,7 @@ public virtual MapKryptonPageText MapHeading /// /// Resets the MapHeading property to its default value. /// - public void ResetMapHeading() - { - MapHeading = GetMapHeadingDefault(); - } + public void ResetMapHeading() => MapHeading = GetMapHeadingDefault(); #endregion #region MapDescription @@ -235,10 +229,7 @@ public virtual MapKryptonPageText MapDescription /// /// Resets the MapDescription property to its default value. /// - public void ResetMapDescription() - { - MapDescription = GetMapDescriptionDefault(); - } + public void ResetMapDescription() => MapDescription = GetMapDescriptionDefault(); #endregion } } diff --git a/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorBar.cs b/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorBar.cs index 5d0fee274..11bc2fd27 100644 --- a/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorBar.cs +++ b/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorBar.cs @@ -135,10 +135,7 @@ public bool BarAnimation /// /// Resets the BarAnimation property to its default value. /// - public void ResetBarAnimation() - { - BarAnimation = true; - } + public void ResetBarAnimation() => BarAnimation = true; #endregion #region BarOrientation @@ -166,10 +163,7 @@ public VisualOrientation BarOrientation /// /// Resets the BarOrientation property to its default value. /// - public void ResetBarOrientation() - { - BarOrientation = VisualOrientation.Top; - } + public void ResetBarOrientation() => BarOrientation = VisualOrientation.Top; #endregion #region BarFirstItemInset @@ -197,10 +191,7 @@ public int BarFirstItemInset /// /// Resets the BarFirstItemInset property to its default value. /// - public void ResetBarFirstItemInset() - { - BarFirstItemInset = DEFAULT_BAR_FIRST_ITEM_INSET; - } + public void ResetBarFirstItemInset() => BarFirstItemInset = DEFAULT_BAR_FIRST_ITEM_INSET; #endregion #region BarLastItemInset @@ -228,10 +219,7 @@ public int BarLastItemInset /// /// Resets the BarLastItemInset property to its default value. /// - public void ResetBarLastItemInset() - { - BarLastItemInset = DEFAULT_BAR_LAST_ITEM_INSET; - } + public void ResetBarLastItemInset() => BarLastItemInset = DEFAULT_BAR_LAST_ITEM_INSET; #endregion #region BarMinimumHeight @@ -259,10 +247,7 @@ public int BarMinimumHeight /// /// Resets the BarMinimumHeight property to its default value. /// - public void ResetBarMinimumHeight() - { - BarMinimumHeight = DEFAULT_BAR_MINIMUM_HEIGHT; - } + public void ResetBarMinimumHeight() => BarMinimumHeight = DEFAULT_BAR_MINIMUM_HEIGHT; #endregion #region BarMinimumHeight @@ -290,10 +275,7 @@ public BarMultiline BarMultiline /// /// Resets the BarMultiline property to its default value. /// - public void ResetBarMultiline() - { - BarMultiline = BarMultiline.Singleline; - } + public void ResetBarMultiline() => BarMultiline = BarMultiline.Singleline; #endregion #region CheckButtonStyle @@ -387,10 +369,7 @@ public RelativePositionAlign ItemAlignment /// /// Resets the ItemAlignment property to its default value. /// - public void ResetItemAlignment() - { - ItemAlignment = RelativePositionAlign.Near; - } + public void ResetItemAlignment() => ItemAlignment = RelativePositionAlign.Near; #endregion #region ItemMinimumSize @@ -438,10 +417,7 @@ public Size ItemMinimumSize /// /// Reset the ItemMinimumSize to the default value. /// - public void ResetItemMinimumSize() - { - ItemMinimumSize = _defaultItemMinimumSize; - } + public void ResetItemMinimumSize() => ItemMinimumSize = _defaultItemMinimumSize; #endregion #region ItemMaximumSize @@ -489,10 +465,7 @@ public Size ItemMaximumSize /// /// Reset the ItemMaximumSize to the default value. /// - public void ResetItemMaximumSize() - { - ItemMaximumSize = _defaultItemMaximumSize; - } + public void ResetItemMaximumSize() => ItemMaximumSize = _defaultItemMaximumSize; #endregion #region ItemOrientation @@ -520,10 +493,7 @@ public ButtonOrientation ItemOrientation /// /// Resets the ItemOrientation property to its default value. /// - public void ResetItemOrientation() - { - ItemOrientation = ButtonOrientation.Auto; - } + public void ResetItemOrientation() => ItemOrientation = ButtonOrientation.Auto; #endregion #region ItemSizing @@ -551,10 +521,7 @@ public BarItemSizing ItemSizing /// /// Reset the ItemSizing to the default value. /// - public void ResetItemSizing() - { - ItemSizing = BarItemSizing.SameHeight; - } + public void ResetItemSizing() => ItemSizing = BarItemSizing.SameHeight; #endregion #region BarMapImage @@ -583,10 +550,7 @@ public virtual MapKryptonPageImage BarMapImage /// /// Resets the BarMapImage property to its default value. /// - public void ResetBarMapImage() - { - BarMapImage = MapKryptonPageImage.Small; - } + public void ResetBarMapImage() => BarMapImage = MapKryptonPageImage.Small; #endregion #region BarMapText @@ -614,10 +578,7 @@ public MapKryptonPageText BarMapText /// /// Resets the BarMapText property to its default value. /// - public void ResetBarMapText() - { - BarMapText = MapKryptonPageText.TextTitle; - } + public void ResetBarMapText() => BarMapText = MapKryptonPageText.TextTitle; #endregion #region BarMapExtraText @@ -645,10 +606,7 @@ public MapKryptonPageText BarMapExtraText /// /// Resets the BarMapExtraText property to its default value. /// - public void ResetBarMapExtraText() - { - BarMapExtraText = MapKryptonPageText.None; - } + public void ResetBarMapExtraText() => BarMapExtraText = MapKryptonPageText.None; #endregion } } diff --git a/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorButton.cs b/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorButton.cs index 57490d928..9ee4d62ba 100644 --- a/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorButton.cs +++ b/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorButton.cs @@ -80,7 +80,7 @@ public NavigatorButton([DisallowNull] KryptonNavigator navigator, FormMaximizeButton.Click += OnMaximizeButtonClick; // Add fixed buttons into the display collection - if (_navigator.Owner != null && !_navigator.ControlKryptonFormFeatures) + if (_navigator is { Owner: not null, ControlKryptonFormFeatures: false }) { FixedSpecs.AddRange(new ButtonSpecNavFixed[] { PreviousButton, NextButton, ContextButton, CloseButton, FormMinimizeButton, FormMaximizeButton, FormCloseButton }); } @@ -215,10 +215,7 @@ public ButtonDisplay PreviousButtonDisplay /// /// Resets the PreviousButtonShortcut property to its default value. /// - public void ResetPreviousButtonShortcut() - { - PreviousButtonShortcut = DEFAULT_SHORTCUT_PREVIOUS; - } + public void ResetPreviousButtonShortcut() => PreviousButtonShortcut = DEFAULT_SHORTCUT_PREVIOUS; #endregion #region NextButton @@ -293,10 +290,7 @@ public ButtonDisplay NextButtonDisplay /// /// Resets the NextButtonShortcut property to its default value. /// - public void ResetNextButtonShortcut() - { - NextButtonShortcut = DEFAULT_SHORTCUT_NEXT; - } + public void ResetNextButtonShortcut() => NextButtonShortcut = DEFAULT_SHORTCUT_NEXT; #endregion #region ContextButton @@ -371,10 +365,7 @@ public ButtonDisplay ContextButtonDisplay /// /// Resets the ContextButtonShortcut property to its default value. /// - public void ResetContextButtonShortcut() - { - ContextButtonShortcut = DEFAULT_SHORTCUT_CONTEXT; - } + public void ResetContextButtonShortcut() => ContextButtonShortcut = DEFAULT_SHORTCUT_CONTEXT; #endregion #region ContextMenuMapText @@ -471,10 +462,7 @@ public ButtonDisplay CloseButtonDisplay /// /// Resets the CloseButtonShortcut property to its default value. /// - public void ResetCloseButtonShortcut() - { - CloseButtonShortcut = DEFAULT_SHORTCUT_CLOSE; - } + public void ResetCloseButtonShortcut() => CloseButtonShortcut = DEFAULT_SHORTCUT_CLOSE; #endregion #region FormCloseButton @@ -543,10 +531,7 @@ public ButtonDisplayLogic ButtonDisplayLogic /// /// Resets the ButtonDisplayLogic property to its default value. /// - public void ResetButtonDisplayLogic() - { - ButtonDisplayLogic = ButtonDisplayLogic.Context; - } + public void ResetButtonDisplayLogic() => ButtonDisplayLogic = ButtonDisplayLogic.Context; #endregion #region Internal @@ -555,40 +540,19 @@ public void ResetButtonDisplayLogic() #endregion #region Implementation - private void OnPreviousClick(object sender, EventArgs e) - { - _navigator.PerformPreviousAction(); - } + private void OnPreviousClick(object sender, EventArgs e) => _navigator.PerformPreviousAction(); - private void OnNextClick(object sender, EventArgs e) - { - _navigator.PerformNextAction(); - } + private void OnNextClick(object sender, EventArgs e) => _navigator.PerformNextAction(); - private void OnContextClick(object sender, EventArgs e) - { - _navigator.PerformContextAction(); - } + private void OnContextClick(object sender, EventArgs e) => _navigator.PerformContextAction(); - private void OnCloseClick(object sender, EventArgs e) - { - _navigator.PerformCloseAction(); - } + private void OnCloseClick(object sender, EventArgs e) => _navigator.PerformCloseAction(); - private void OnMaximizeButtonClick(object sender, EventArgs e) - { - throw new NotImplementedException(); - } + private void OnMaximizeButtonClick(object sender, EventArgs e) => throw new NotImplementedException(); - private void OnMinimizeButtonClick(object sender, EventArgs e) - { - throw new NotImplementedException(); - } + private void OnMinimizeButtonClick(object sender, EventArgs e) => throw new NotImplementedException(); - private void OnCloseButtonClick(object sender, EventArgs e) - { - throw new NotImplementedException(); - } + private void OnCloseButtonClick(object sender, EventArgs e) => throw new NotImplementedException(); #endregion } } diff --git a/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorOutlook.cs b/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorOutlook.cs index 438ad0d71..a151b2511 100644 --- a/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorOutlook.cs +++ b/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorOutlook.cs @@ -209,10 +209,7 @@ public Orientation Orientation /// /// Resets the Orientation property to its default value. /// - public void ResetOrientation() - { - Orientation = Orientation.Vertical; - } + public void ResetOrientation() => Orientation = Orientation.Vertical; #endregion #region ItemOrientation @@ -240,10 +237,7 @@ public ButtonOrientation ItemOrientation /// /// Resets the ItemOrientation property to its default value. /// - public void ResetItemOrientation() - { - ItemOrientation = ButtonOrientation.Auto; - } + public void ResetItemOrientation() => ItemOrientation = ButtonOrientation.Auto; #endregion #region HeaderSecondaryVisible @@ -271,10 +265,7 @@ public InheritBool HeaderSecondaryVisible /// /// Resets the HeaderSecondaryVisible property to its default value. /// - public void ResetHeaderSecondaryVisible() - { - HeaderSecondaryVisible = InheritBool.False; - } + public void ResetHeaderSecondaryVisible() => HeaderSecondaryVisible = InheritBool.False; #endregion #region TextMoreButtons @@ -291,10 +282,7 @@ public void ResetHeaderSecondaryVisible() /// /// Resets the TextMoreButtons property to its default value. /// - public void ResetTextMoreButtons() - { - TextMoreButtons = DEFAULT_MORE_BUTTONS; - } + public void ResetTextMoreButtons() => TextMoreButtons = DEFAULT_MORE_BUTTONS; #endregion #region TextFewerButtons @@ -311,10 +299,7 @@ public void ResetTextMoreButtons() /// /// Resets the TextFewerButtons property to its default value. /// - public void ResetTextFewerButtons() - { - TextFewerButtons = DEFAULT_FEWER_BUTTONS; - } + public void ResetTextFewerButtons() => TextFewerButtons = DEFAULT_FEWER_BUTTONS; #endregion #region TextAddRemoveButtons @@ -331,10 +316,7 @@ public void ResetTextFewerButtons() /// /// Resets the TextAddRemoveButtons property to its default value. /// - public void ResetTextAddRemoveButtons() - { - TextAddRemoveButtons = DEFAULT_ADD_REMOVE_BUTTONS; - } + public void ResetTextAddRemoveButtons() => TextAddRemoveButtons = DEFAULT_ADD_REMOVE_BUTTONS; #endregion #region ShowDropDownButton @@ -362,10 +344,7 @@ public bool ShowDropDownButton /// /// Resets the ShowDropDownButton property to its default value. /// - public void ResetShowDropDownButton() - { - ShowDropDownButton = true; - } + public void ResetShowDropDownButton() => ShowDropDownButton = true; #endregion } } diff --git a/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorOutlookFull.cs b/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorOutlookFull.cs index 2f31d441a..f9bb9910a 100644 --- a/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorOutlookFull.cs +++ b/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorOutlookFull.cs @@ -95,10 +95,7 @@ public virtual MapKryptonPageImage OverflowMapImage /// /// Resets the OverflowMapImage property to its default value. /// - public void ResetOverflowMapImage() - { - OverflowMapImage = MapKryptonPageImage.Small; - } + public void ResetOverflowMapImage() => OverflowMapImage = MapKryptonPageImage.Small; #endregion #region OverflowMapText @@ -126,10 +123,7 @@ public MapKryptonPageText OverflowMapText /// /// Resets the OverflowMapText property to its default value. /// - public void ResetOverflowMapText() - { - OverflowMapText = MapKryptonPageText.None; - } + public void ResetOverflowMapText() => OverflowMapText = MapKryptonPageText.None; #endregion #region OverflowMapExtraText @@ -157,10 +151,7 @@ public MapKryptonPageText OverflowMapExtraText /// /// Resets the OverflowMapExtraText property to its default value. /// - public void ResetOverflowMapExtraText() - { - OverflowMapExtraText = MapKryptonPageText.None; - } + public void ResetOverflowMapExtraText() => OverflowMapExtraText = MapKryptonPageText.None; #endregion #region StackMapImage @@ -189,10 +180,7 @@ public virtual MapKryptonPageImage StackMapImage /// /// Resets the StackMapImage property to its default value. /// - public void ResetStackMapImage() - { - StackMapImage = MapKryptonPageImage.MediumSmall; - } + public void ResetStackMapImage() => StackMapImage = MapKryptonPageImage.MediumSmall; #endregion #region StackMapText @@ -220,10 +208,7 @@ public MapKryptonPageText StackMapText /// /// Resets the StackMapText property to its default value. /// - public void ResetStackMapText() - { - StackMapText = MapKryptonPageText.TextTitle; - } + public void ResetStackMapText() => StackMapText = MapKryptonPageText.TextTitle; #endregion #region StackMapExtraText @@ -251,10 +236,7 @@ public MapKryptonPageText StackMapExtraText /// /// Resets the StackMapExtraText property to its default value. /// - public void ResetStackMapExtraText() - { - StackMapExtraText = MapKryptonPageText.None; - } + public void ResetStackMapExtraText() => StackMapExtraText = MapKryptonPageText.None; #endregion } } diff --git a/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorOutlookMini.cs b/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorOutlookMini.cs index 542c8d1d5..b38a42b74 100644 --- a/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorOutlookMini.cs +++ b/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorOutlookMini.cs @@ -120,10 +120,7 @@ public virtual MapKryptonPageImage MiniMapImage /// /// Resets the MiniMapImage property to its default value. /// - public void ResetMiniMapImage() - { - MiniMapImage = MapKryptonPageImage.None; - } + public void ResetMiniMapImage() => MiniMapImage = MapKryptonPageImage.None; #endregion #region MiniMapText @@ -151,10 +148,7 @@ public MapKryptonPageText MiniMapText /// /// Resets the MiniMapText property to its default value. /// - public void ResetMiniMapText() - { - MiniMapText = MapKryptonPageText.TextTitle; - } + public void ResetMiniMapText() => MiniMapText = MapKryptonPageText.TextTitle; #endregion #region MiniMapExtraText @@ -182,10 +176,7 @@ public MapKryptonPageText MiniMapExtraText /// /// Resets the MiniMapExtraText property to its default value. /// - public void ResetMiniMapExtraText() - { - MiniMapExtraText = MapKryptonPageText.None; - } + public void ResetMiniMapExtraText() => MiniMapExtraText = MapKryptonPageText.None; #endregion #region StackMapImage @@ -214,10 +205,7 @@ public virtual MapKryptonPageImage StackMapImage /// /// Resets the StackMapImage property to its default value. /// - public void ResetStackMapImage() - { - StackMapImage = MapKryptonPageImage.MediumSmall; - } + public void ResetStackMapImage() => StackMapImage = MapKryptonPageImage.MediumSmall; #endregion #region StackMapText @@ -245,10 +233,7 @@ public MapKryptonPageText StackMapText /// /// Resets the StackMapText property to its default value. /// - public void ResetStackMapText() - { - StackMapText = MapKryptonPageText.None; - } + public void ResetStackMapText() => StackMapText = MapKryptonPageText.None; #endregion #region StackMapExtraText @@ -276,10 +261,7 @@ public MapKryptonPageText StackMapExtraText /// /// Resets the StackMapExtraText property to its default value. /// - public void ResetStackMapExtraText() - { - StackMapExtraText = MapKryptonPageText.None; - } + public void ResetStackMapExtraText() => StackMapExtraText = MapKryptonPageText.None; #endregion } } diff --git a/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorStack.cs b/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorStack.cs index ac2da86b5..dfa8f1835 100644 --- a/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorStack.cs +++ b/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorStack.cs @@ -146,10 +146,7 @@ public bool StackAnimation /// /// Resets the StackAnimation property to its default value. /// - public void ResetStackAnimation() - { - StackAnimation = true; - } + public void ResetStackAnimation() => StackAnimation = true; #endregion #region StackOrientation @@ -177,10 +174,7 @@ public Orientation StackOrientation /// /// Resets the StackOrientation property to its default value. /// - public void ResetStackOrientation() - { - StackOrientation = Orientation.Vertical; - } + public void ResetStackOrientation() => StackOrientation = Orientation.Vertical; #endregion #region StackAlignment @@ -208,10 +202,7 @@ public RelativePositionAlign StackAlignment /// /// Resets the StackAlignment property to its default value. /// - public void ResetStackAlignment() - { - StackAlignment = RelativePositionAlign.Center; - } + public void ResetStackAlignment() => StackAlignment = RelativePositionAlign.Center; #endregion #region ItemOrientation @@ -239,10 +230,7 @@ public ButtonOrientation ItemOrientation /// /// Resets the ItemOrientation property to its default value. /// - public void ResetItemOrientation() - { - ItemOrientation = ButtonOrientation.Auto; - } + public void ResetItemOrientation() => ItemOrientation = ButtonOrientation.Auto; #endregion #region StackMapImage @@ -271,10 +259,7 @@ public virtual MapKryptonPageImage StackMapImage /// /// Resets the StackMapImage property to its default value. /// - public void ResetStackMapImage() - { - StackMapImage = MapKryptonPageImage.Small; - } + public void ResetStackMapImage() => StackMapImage = MapKryptonPageImage.Small; #endregion #region StackMapText @@ -302,10 +287,7 @@ public MapKryptonPageText StackMapText /// /// Resets the StackMapText property to its default value. /// - public void ResetStackMapText() - { - StackMapText = MapKryptonPageText.TextTitle; - } + public void ResetStackMapText() => StackMapText = MapKryptonPageText.TextTitle; #endregion #region MapExtraText @@ -333,10 +315,7 @@ public MapKryptonPageText StackMapExtraText /// /// Resets the StackMapExtraText property to its default value. /// - public void ResetStackMapExtraText() - { - StackMapExtraText = MapKryptonPageText.None; - } + public void ResetStackMapExtraText() => StackMapExtraText = MapKryptonPageText.None; #endregion } } diff --git a/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorToolTips.cs b/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorToolTips.cs index c1d5a0d2b..29a0047a9 100644 --- a/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorToolTips.cs +++ b/Source/Krypton Components/Krypton.Navigator/Palette/NavigatorToolTips.cs @@ -108,51 +108,42 @@ public virtual MapKryptonPageImage MapImage set => _mapImage = value; } - /// - /// Resets the MapImage property to its default value. - /// - public void ResetMapImage() - { - MapImage = MapKryptonPageImage.ToolTip; - } - #endregion + /// + /// Resets the MapImage property to its default value. + /// + public void ResetMapImage() => MapImage = MapKryptonPageImage.ToolTip; + #endregion - #region MapText - /// - /// Gets and sets the mapping used for the tooltip text. - /// - [Category(@"Visuals")] + #region MapText + /// + /// Gets and sets the mapping used for the tooltip text. + /// + [Category(@"Visuals")] [Description(@"Mapping used for the tooltip text.")] [RefreshProperties(RefreshProperties.All)] //[DefaultValue(typeof(MapKryptonPageText), "ToolTipTitle")] public MapKryptonPageText MapText { get; set; } - /// - /// Resets the MapText property to its default value. - /// - public void ResetMapText() - { - MapText = MapKryptonPageText.ToolTipTitle; - } - #endregion + /// + /// Resets the MapText property to its default value. + /// + public void ResetMapText() => MapText = MapKryptonPageText.ToolTipTitle; + #endregion - #region MapExtraText - /// - /// Gets and sets the mapping used for the tooltip description. - /// - [Category(@"Visuals")] + #region MapExtraText + /// + /// Gets and sets the mapping used for the tooltip description. + /// + [Category(@"Visuals")] [Description(@"Mapping used for the tooltip description.")] [RefreshProperties(RefreshProperties.All)] //[DefaultValue(typeof(MapKryptonPageText), "ToolTipBody")] public MapKryptonPageText MapExtraText { get; set; } - /// - /// Resets the MapExtraText property to its default value. - /// - public void ResetMapExtraText() - { - MapExtraText = MapKryptonPageText.ToolTipBody; - } - #endregion - } + /// + /// Resets the MapExtraText property to its default value. + /// + public void ResetMapExtraText() => MapExtraText = MapKryptonPageText.ToolTipBody; + #endregion + } } diff --git a/Source/Krypton Components/Krypton.Navigator/Palette/PaletteBarRedirect.cs b/Source/Krypton Components/Krypton.Navigator/Palette/PaletteBarRedirect.cs index 90a89417c..07d4784f8 100644 --- a/Source/Krypton Components/Krypton.Navigator/Palette/PaletteBarRedirect.cs +++ b/Source/Krypton Components/Krypton.Navigator/Palette/PaletteBarRedirect.cs @@ -104,10 +104,7 @@ public Padding BarPaddingTabs /// /// Reset the BarPaddingTabs to the default value. /// - public void ResetBarPaddingTabs() - { - BarPaddingTabs = CommonHelper.InheritPadding; - } + public void ResetBarPaddingTabs() => BarPaddingTabs = CommonHelper.InheritPadding; #endregion #region BarPaddingInside @@ -135,10 +132,7 @@ public Padding BarPaddingInside /// /// Reset the BarPaddingInside to the default value. /// - public void ResetBarPaddingInside() - { - BarPaddingInside = CommonHelper.InheritPadding; - } + public void ResetBarPaddingInside() => BarPaddingInside = CommonHelper.InheritPadding; #endregion #region BarPaddingOutside @@ -166,10 +160,7 @@ public Padding BarPaddingOutside /// /// Reset the BarPaddingOutside to the default value. /// - public void ResetBarPaddingOutside() - { - BarPaddingOutside = CommonHelper.InheritPadding; - } + public void ResetBarPaddingOutside() => BarPaddingOutside = CommonHelper.InheritPadding; #endregion #region BarPaddingOnly @@ -197,10 +188,7 @@ public Padding BarPaddingOnly /// /// Reset the BarPaddingOnly to the default value. /// - public void ResetBarPaddingOnly() - { - BarPaddingOnly = CommonHelper.InheritPadding; - } + public void ResetBarPaddingOnly() => BarPaddingOnly = CommonHelper.InheritPadding; #endregion #region ButtonPadding @@ -228,10 +216,7 @@ public Padding ButtonPadding /// /// Reset the ButtonPadding to the default value. /// - public void ResetButtonPadding() - { - ButtonPadding = CommonHelper.InheritPadding; - } + public void ResetButtonPadding() => ButtonPadding = CommonHelper.InheritPadding; #endregion #region ButtonEdgeOutside @@ -259,10 +244,7 @@ public int ButtonEdgeOutside /// /// Reset the ButtonEdgeOutside to the default value. /// - public void ResetButtonEdgeOutside() - { - ButtonEdgeOutside = -1; - } + public void ResetButtonEdgeOutside() => ButtonEdgeOutside = -1; #endregion #region ButtonEdgeInside @@ -290,10 +272,7 @@ public int ButtonEdgeInside /// /// Reset the ButtonEdgeInside to the default value. /// - public void ResetButtonEdgeInside() - { - ButtonEdgeInside = -1; - } + public void ResetButtonEdgeInside() => ButtonEdgeInside = -1; #endregion #region CheckButtonGap @@ -321,10 +300,7 @@ public int CheckButtonGap /// /// Reset the CheckButtonGap to the default value. /// - public void ResetCheckButtonGap() - { - CheckButtonGap = -1; - } + public void ResetCheckButtonGap() => CheckButtonGap = -1; #endregion #region RibbonTabGap @@ -352,10 +328,7 @@ public int RibbonTabGap /// /// Reset the RibbonTabGap to the default value. /// - public void ResetRibbonTabGap() - { - RibbonTabGap = -1; - } + public void ResetRibbonTabGap() => RibbonTabGap = -1; #endregion #region IPaletteMetric diff --git a/Source/Krypton Components/Krypton.Navigator/Palette/PaletteMetrics.cs b/Source/Krypton Components/Krypton.Navigator/Palette/PaletteMetrics.cs index c3e136a62..c8b429a79 100644 --- a/Source/Krypton Components/Krypton.Navigator/Palette/PaletteMetrics.cs +++ b/Source/Krypton Components/Krypton.Navigator/Palette/PaletteMetrics.cs @@ -79,10 +79,7 @@ public int PageButtonSpecInset /// /// Resets the PageButtonSpecInset property to its default value. /// - public void ResetPageButtonSpecInset() - { - PageButtonSpecInset = -1; - } + public void ResetPageButtonSpecInset() => PageButtonSpecInset = -1; #endregion #region PageButtonSpecPadding @@ -110,10 +107,7 @@ public Padding PageButtonSpecPadding /// /// Resets the PageButtonSpecPadding property to its default value. /// - public void ResetPageButtonSpecPadding() - { - PageButtonSpecPadding = CommonHelper.InheritPadding; - } + public void ResetPageButtonSpecPadding() => PageButtonSpecPadding = CommonHelper.InheritPadding; private bool ShouldSerializePageButtonSpecPadding() => !PageButtonSpecPadding.Equals(CommonHelper.InheritPadding); diff --git a/Source/Krypton Components/Krypton.Navigator/Palette/PaletteNavContent.cs b/Source/Krypton Components/Krypton.Navigator/Palette/PaletteNavContent.cs index 1e1134fc4..6c9ead960 100644 --- a/Source/Krypton Components/Krypton.Navigator/Palette/PaletteNavContent.cs +++ b/Source/Krypton Components/Krypton.Navigator/Palette/PaletteNavContent.cs @@ -94,10 +94,7 @@ public PaletteNavContent([DisallowNull] IPaletteContent inherit, /// /// Sets the inheritance parent. /// - public void SetInherit(IPaletteContent? inherit) - { - _inherit = inherit; - } + public void SetInherit(IPaletteContent? inherit) => _inherit = inherit; #endregion #region PopulateFromBase @@ -663,10 +660,7 @@ public Padding Padding /// /// Reset the Padding to the default value. /// - public void ResetPadding() - { - Padding = CommonHelper.InheritPadding; - } + public void ResetPadding() => Padding = CommonHelper.InheritPadding; /// /// Gets the actual padding between the border and content drawing. @@ -741,10 +735,7 @@ public int AdjacentGap /// /// Reset the AdjacentGap to the default value. /// - public void ResetAdjacentGap() - { - AdjacentGap = -1; - } + public void ResetAdjacentGap() => AdjacentGap = -1; /// /// Gets the actual padding between adjacent content items. diff --git a/Source/Krypton Components/Krypton.Navigator/Palette/PaletteRibbonGeneralRedirect.cs b/Source/Krypton Components/Krypton.Navigator/Palette/PaletteRibbonGeneralRedirect.cs index d559eb2cc..37ea20e86 100644 --- a/Source/Krypton Components/Krypton.Navigator/Palette/PaletteRibbonGeneralRedirect.cs +++ b/Source/Krypton Components/Krypton.Navigator/Palette/PaletteRibbonGeneralRedirect.cs @@ -52,10 +52,7 @@ public PaletteRibbonGeneralNavRedirect([DisallowNull] PaletteRedirect redirect, /// Update the redirector with new reference. /// /// Target redirector. - public void SetRedirector(PaletteRedirect? redirect) - { - _inherit.SetRedirector(redirect); - } + public void SetRedirector(PaletteRedirect? redirect) => _inherit.SetRedirector(redirect); #endregion #region IsDefault @@ -251,10 +248,7 @@ public Font? TextFont /// /// Reset the TextFont to the default value. /// - public void ResetTextFont() - { - TextFont = null; - } + public void ResetTextFont() => TextFont = null; /// /// Gets the font for the ribbon text. @@ -290,10 +284,7 @@ public PaletteTextHint TextHint /// /// Reset the TextHint to the default value. /// - public void ResetTextHint() - { - TextHint = PaletteTextHint.Inherit; - } + public void ResetTextHint() => TextHint = PaletteTextHint.Inherit; /// /// Gets the rendering hint for the ribbon font. diff --git a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarCheckButtonGroupInside.cs b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarCheckButtonGroupInside.cs index 3217a757b..a5bd4c289 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarCheckButtonGroupInside.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarCheckButtonGroupInside.cs @@ -24,13 +24,11 @@ internal class ViewBuilderBarCheckButtonGroupInside : ViewBuilderBarItemBase /// Reference to navigator instance. /// Reference to current manager. /// Palette redirector. - public override void Construct(KryptonNavigator navigator, + public override void Construct(KryptonNavigator navigator, ViewManager manager, - PaletteRedirect? redirector) - { + PaletteRedirect? redirector) => // Let base class perform common operations base.Construct(navigator, manager, redirector); - } /// /// Gets a value indicating if the mode is a tab strip style mode. @@ -40,11 +38,9 @@ public override void Construct(KryptonNavigator navigator, /// /// Destruct the previously created view. /// - public override void Destruct() - { + public override void Destruct() => // Let base class perform common operations base.Destruct(); - } #endregion #region Protected @@ -114,7 +110,7 @@ protected override void CreateButtonSpecManager() base.CreateButtonSpecManager(); // Modify the way that button specs are remapped - ButtonSpecNavManagerLayoutBar barManager = (ButtonSpecNavManagerLayoutBar)_buttonManager; + var barManager = (ButtonSpecNavManagerLayoutBar)_buttonManager; // Remap the normal color onto the button text barManager.RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonStandalone; diff --git a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarCheckButtonGroupOnly.cs b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarCheckButtonGroupOnly.cs index 7d3392603..30637c8ba 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarCheckButtonGroupOnly.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarCheckButtonGroupOnly.cs @@ -24,13 +24,11 @@ internal class ViewBuilderBarCheckButtonGroupOnly : ViewBuilderBarItemBase /// Reference to navigator instance. /// Reference to current manager. /// Palette redirector. - public override void Construct(KryptonNavigator navigator, + public override void Construct(KryptonNavigator navigator, ViewManager manager, - PaletteRedirect? redirector) - { + PaletteRedirect? redirector) => // Let base class perform common operations base.Construct(navigator, manager, redirector); - } /// /// Gets a value indicating if the mode is a tab strip style mode. @@ -60,11 +58,9 @@ public override void KeyPressedPageView() /// /// Destruct the previously created view. /// - public override void Destruct() - { + public override void Destruct() => // Let base class perform common operations base.Destruct(); - } #endregion #region Protected @@ -134,7 +130,7 @@ protected override void CreateButtonSpecManager() base.CreateButtonSpecManager(); // Modify the way that button specs are remapped - ButtonSpecNavManagerLayoutBar barManager = (ButtonSpecNavManagerLayoutBar)_buttonManager; + var barManager = (ButtonSpecNavManagerLayoutBar)_buttonManager; // Remap the normal color onto the button text barManager.RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonStandalone; diff --git a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarCheckButtonGroupOutside.cs b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarCheckButtonGroupOutside.cs index 8b64070fe..a2b361e06 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarCheckButtonGroupOutside.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarCheckButtonGroupOutside.cs @@ -24,13 +24,11 @@ internal class ViewBuilderBarCheckButtonGroupOutside : ViewBuilderBarItemBase /// Reference to navigator instance. /// Reference to current manager. /// Palette redirector. - public override void Construct(KryptonNavigator navigator, + public override void Construct(KryptonNavigator navigator, ViewManager manager, - PaletteRedirect? redirector) - { + PaletteRedirect? redirector) => // Let base class perform common operations base.Construct(navigator, manager, redirector); - } /// /// Gets a value indicating if the mode is a tab strip style mode. @@ -40,11 +38,9 @@ public override void Construct(KryptonNavigator navigator, /// /// Destruct the previously created view. /// - public override void Destruct() - { + public override void Destruct() => // Let base class perform common operations base.Destruct(); - } #endregion #region Protected diff --git a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarCheckButtonOnly.cs b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarCheckButtonOnly.cs index 60f197c30..56a31d05c 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarCheckButtonOnly.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarCheckButtonOnly.cs @@ -24,13 +24,11 @@ internal class ViewBuilderBarCheckButtonOnly : ViewBuilderBarItemBase /// Reference to navigator instance. /// Reference to current manager. /// Palette redirector. - public override void Construct(KryptonNavigator navigator, + public override void Construct(KryptonNavigator navigator, ViewManager manager, - PaletteRedirect? redirector) - { + PaletteRedirect? redirector) => // Let base class perform common operations base.Construct(navigator, manager, redirector); - } /// /// Gets a value indicating if the mode is a tab strip style mode. @@ -60,11 +58,9 @@ public override void KeyPressedPageView() /// /// Destruct the previously created view. /// - public override void Destruct() - { + public override void Destruct() => // Let base class perform common operations base.Destruct(); - } #endregion #region Protected diff --git a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarItemBase.cs b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarItemBase.cs index f76bc46e6..4ba9ee8ad 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarItemBase.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarItemBase.cs @@ -28,16 +28,13 @@ internal abstract class ViewBuilderBarItemBase : ViewBuilderItemBase /// Gets the appropriate popup page position for the current mode. /// /// Calculated PopupPagePosition - public override PopupPagePosition GetPopupPagePosition() + public override PopupPagePosition GetPopupPagePosition() => Navigator.Bar.BarOrientation switch { - return Navigator.Bar.BarOrientation switch - { - VisualOrientation.Bottom => PopupPagePosition.AboveNear, - VisualOrientation.Left => PopupPagePosition.FarTop, - VisualOrientation.Right => PopupPagePosition.NearTop, - _ => PopupPagePosition.BelowNear - }; - } + VisualOrientation.Bottom => PopupPagePosition.AboveNear, + VisualOrientation.Left => PopupPagePosition.FarTop, + VisualOrientation.Right => PopupPagePosition.NearTop, + _ => PopupPagePosition.BelowNear + }; #endregion #region Protected diff --git a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarTabBase.cs b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarTabBase.cs index fc1d1f69c..7830a2f42 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarTabBase.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBarTabBase.cs @@ -142,7 +142,7 @@ protected void UpdateTabStyle() { foreach (var pair in PageLookup) { - ViewDrawNavCheckButtonTab tabHeader = (ViewDrawNavCheckButtonTab)pair.Value; + var tabHeader = (ViewDrawNavCheckButtonTab)pair.Value; tabHeader.ButtonSpecManager?.SetRemapTarget(Navigator.Bar.TabStyle); } } diff --git a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBase.cs b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBase.cs index 86838b7cd..eacfd7715 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBase.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderBase.cs @@ -217,15 +217,13 @@ public virtual Point GetContextShowPoint() /// /// Requested action. /// Enabled state of the button. - public virtual ButtonEnabled NextActionEnabled(DirectionButtonAction action) - { + public virtual ButtonEnabled NextActionEnabled(DirectionButtonAction action) => // Process the requested action - return action switch + action switch { DirectionButtonAction.None or DirectionButtonAction.SelectPage => (Navigator.NextActionValid ? ButtonEnabled.True : ButtonEnabled.False),// Only enabled if the count of visible pages to the left of current page is positive _ => ButtonEnabled.False // Action not supported so disable button }; - } /// /// Perform the next button action requested. @@ -252,15 +250,13 @@ public virtual void PerformNextAction(DirectionButtonAction action, KryptonPage? /// /// Requested action. /// Enabled state of the button. - public virtual ButtonEnabled PreviousActionEnabled(DirectionButtonAction action) - { + public virtual ButtonEnabled PreviousActionEnabled(DirectionButtonAction action) => // Process the requested action - return action switch + action switch { DirectionButtonAction.None or DirectionButtonAction.SelectPage => (Navigator.PreviousActionValid ? ButtonEnabled.True : ButtonEnabled.False),// Only enabled if the count of visible pages to the left of current page is positive _ => ButtonEnabled.False // Action not supported so disable button }; - } /// /// Perform the previous button action requested. @@ -670,41 +666,31 @@ protected NeedPaintHandler NeedPaintDelegate /// Requests a need paint be performed on the navigator. /// /// Does the palette change require a layout. - protected void PerformNeedPaint(bool needLayout) - { - OnNeedPaint(this, new NeedLayoutEventArgs(needLayout)); - } + protected void PerformNeedPaint(bool needLayout) => OnNeedPaint(this, new NeedLayoutEventArgs(needLayout)); /// /// Requests a need page paint be performed on the navigator. /// /// Does the palette change require a layout. - protected void PerformNeedPagePaint(bool needLayout) - { - OnNeedPagePaint(this, new NeedLayoutEventArgs(needLayout)); - } + protected void PerformNeedPagePaint(bool needLayout) => OnNeedPagePaint(this, new NeedLayoutEventArgs(needLayout)); /// /// Perform a need paint on the navigator. /// /// Source of notification. /// An NeedLayoutEventArgs containing event data. - protected void OnNeedPaint(object? sender, NeedLayoutEventArgs e) - { + protected void OnNeedPaint(object? sender, NeedLayoutEventArgs e) => // Pass paint request onto the navigator control itself Navigator.PerformNeedPaint(e.NeedLayout); - } /// /// Perform a need page paint on the navigator. /// /// Source of notification. /// An NeedLayoutEventArgs containing event data. - protected void OnNeedPagePaint(object sender, NeedLayoutEventArgs e) - { + protected void OnNeedPagePaint(object sender, NeedLayoutEventArgs e) => // Pass paint request onto the navigator control itself Navigator.PerformNeedPagePaint(e.NeedLayout); - } /// /// Process the change in a property that might effect the view builder. diff --git a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderGroup.cs b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderGroup.cs index 64db47179..532fe5f80 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderGroup.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderGroup.cs @@ -196,10 +196,7 @@ public override void Destruct() #endregion #region Implementation - private void OnEnabledChanged(object sender, EventArgs e) - { - UpdateStatePalettes(); - } + private void OnEnabledChanged(object sender, EventArgs e) => UpdateStatePalettes(); #endregion } } diff --git a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderHeaderBarCheckButtonBase.cs b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderHeaderBarCheckButtonBase.cs index d8ad8de00..da96a2541 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderHeaderBarCheckButtonBase.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderHeaderBarCheckButtonBase.cs @@ -55,8 +55,7 @@ public override void Destruct() /// /// Create a manager for handling the button specifications. /// - protected override void CreateButtonSpecManager() - { + protected override void CreateButtonSpecManager() => // Create button specification collection manager _buttonManager = new ButtonSpecNavManagerLayoutHeaderBar(Navigator, Redirector, Navigator.Button.ButtonSpecs, Navigator.FixedSpecs, new[] { _layoutBarDocker }, @@ -73,7 +72,6 @@ protected override void CreateButtonSpecManager() // Hook up the tooltip manager so that tooltips can be generated ToolTipManager = Navigator.ToolTipManager }; - } /// /// Allow operations to occur after main construct actions. @@ -243,7 +241,7 @@ private void OnEnabledChanged(object sender, EventArgs e) if (_buttonManager != null) { // Cast button manager to correct type - ButtonSpecNavManagerLayoutHeaderBar headerBarBM = (ButtonSpecNavManagerLayoutHeaderBar)_buttonManager; + var headerBarBM = (ButtonSpecNavManagerLayoutHeaderBar)_buttonManager; // Update with newly calculated values headerBarBM.UpdateRemapping(GetRemappingPaletteContent(), diff --git a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderHeaderBarTabGroup.cs b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderHeaderBarTabGroup.cs index 1045362aa..cb7998645 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderHeaderBarTabGroup.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderHeaderBarTabGroup.cs @@ -196,11 +196,9 @@ public override void PerformPreviousAction(DirectionButtonAction action, Krypton /// /// Recreate the buttons to reflect a change in selected page. /// - public void UpdateButtons() - { + public void UpdateButtons() => // Ensure buttons are recreated to reflect different page _buttonManager.RecreateButtons(); - } #endregion #region Protected @@ -477,9 +475,8 @@ private void CreateDragDrop() controller.RightMouseDown += OnRightMouseDown; controller.LeftDoubleClick += OnLeftDoubleClick; } - - protected override void CreateButtonSpecManager() - { + + protected override void CreateButtonSpecManager() => // Create button specification collection manager _buttonManager = new ButtonSpecManagerDraw(Navigator, Redirector, Navigator.Button.ButtonSpecs, Navigator.FixedSpecs, new[] { _viewHeadingPrimary, _viewHeadingSecondary }, @@ -493,7 +490,6 @@ protected override void CreateButtonSpecManager() // Hook up the tooltip manager so that tooltips can be generated ToolTipManager = Navigator.ToolTipManager }; - } private void UpdateHeaders() { @@ -614,40 +610,19 @@ private void SetEnabled(bool enabled) _buttonManager.RecreateButtons(); } - private void OnDragStart(object sender, DragStartEventCancelArgs e) - { - Navigator.InternalDragStart(e, null); - } + private void OnDragStart(object sender, DragStartEventCancelArgs e) => Navigator.InternalDragStart(e, null); - private void OnDragMove(object sender, PointEventArgs e) - { - Navigator.InternalDragMove(e); - } + private void OnDragMove(object sender, PointEventArgs e) => Navigator.InternalDragMove(e); - private void OnDragEnd(object sender, PointEventArgs e) - { - Navigator.InternalDragEnd(e); - } + private void OnDragEnd(object sender, PointEventArgs e) => Navigator.InternalDragEnd(e); - private void OnDragQuit(object sender, EventArgs e) - { - Navigator.InternalDragQuit(); - } + private void OnDragQuit(object sender, EventArgs e) => Navigator.InternalDragQuit(); - private void OnLeftMouseDown(object sender, EventArgs e) - { - Navigator.OnPrimaryHeaderLeftClicked(e); - } + private void OnLeftMouseDown(object sender, EventArgs e) => Navigator.OnPrimaryHeaderLeftClicked(e); - private void OnRightMouseDown(object sender, EventArgs e) - { - Navigator.OnPrimaryHeaderRightClicked(e); - } + private void OnRightMouseDown(object sender, EventArgs e) => Navigator.OnPrimaryHeaderRightClicked(e); - private void OnLeftDoubleClick(object sender, EventArgs e) - { - Navigator.OnPrimaryHeaderDoubleClicked(e); - } + private void OnLeftDoubleClick(object sender, EventArgs e) => Navigator.OnPrimaryHeaderDoubleClicked(e); #endregion } } diff --git a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderHeaderGroup.cs b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderHeaderGroup.cs index a24d72f36..542029d4f 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderHeaderGroup.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderHeaderGroup.cs @@ -348,10 +348,7 @@ protected override void OnViewBuilderPropertyChanged(object sender, PropertyChan #endregion #region Implementation - private void OnEnabledChanged(object sender, EventArgs e) - { - UpdateStatePalettes(); - } + private void OnEnabledChanged(object sender, EventArgs e) => UpdateStatePalettes(); #endregion } } diff --git a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderItemBase.cs b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderItemBase.cs index a94de78f9..c456bacab 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderItemBase.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderItemBase.cs @@ -99,7 +99,7 @@ public override void SelectedPageChanged() // Make sure only the selected page is checked foreach (ViewBase child in _layoutBar) { - INavCheckItem checkItem = (INavCheckItem)child; + var checkItem = (INavCheckItem)child; // Should this check button be selected if (Navigator.SelectedPage == checkItem.Page) @@ -137,11 +137,9 @@ public override void SelectedPageChanged() /// /// Change has occurred to the collection of pages. /// - public override void PageCollectionChanged() - { + public override void PageCollectionChanged() => // Let base class do standard work base.PageCollectionChanged(); - } /// /// Process a change in the visible state for a page. @@ -484,10 +482,7 @@ public override void PerformPreviousAction(DirectionButtonAction action, Krypton /// /// Perform post layout operations. /// - public override void PostLayout() - { - RefreshButtons(); - } + public override void PostLayout() => RefreshButtons(); /// /// Gets a value indicating if the view can accept the focus. @@ -690,17 +685,14 @@ public override bool ProcessDialogKey(Keys keyData) /// /// Create the view hierarchy for this view mode. /// - protected virtual void CreateCheckItemView() - { + protected virtual void CreateCheckItemView() => // Hook into the events from created view elements _layoutBarViewport.AnimateStep += OnViewportAnimation; - } /// /// Create a manager for handling the button specifications. /// - protected virtual void CreateButtonSpecManager() - { + protected virtual void CreateButtonSpecManager() => // Create button specification collection manager _buttonManager = new ButtonSpecNavManagerLayoutBar(Navigator, Redirector, Navigator.Button.ButtonSpecs, Navigator.FixedSpecs, new[] { _layoutBarDocker }, @@ -715,7 +707,6 @@ protected virtual void CreateButtonSpecManager() // Hook up the tooltip manager so that tooltips can be generated ToolTipManager = Navigator.ToolTipManager }; - } /// /// Perform post create tasks. @@ -1045,7 +1036,7 @@ private void DestructCheckButtons() // Must tell each check button it is no longer required foreach (ViewBase child in _layoutBar) { - INavCheckItem checkItem = (INavCheckItem)child; + var checkItem = (INavCheckItem)child; // Must unhook from events checkItem.ButtonDragRectangle -= OnCheckButtonDragRect; @@ -1084,7 +1075,7 @@ private void BringPageIntoView() // Make sure only the selected page is checked foreach (ViewBase child in _layoutBar) { - INavCheckItem checkItem = (INavCheckItem)child; + var checkItem = (INavCheckItem)child; // Should this check button be selected if (Navigator.SelectedPage == checkItem.Page) @@ -1171,26 +1162,17 @@ private void OnItemPageInserted(object sender, TypedCollectionEventArgs UpdateStatePalettes(); - private void OnViewportAnimation(object sender, EventArgs e) - { - Navigator.PerformNeedPaint(true); - } + private void OnNavigatorRightToLeftChanged(object sender, EventArgs e) => UpdateItemOrientation(); + + private void OnViewportAnimation(object sender, EventArgs e) => Navigator.PerformNeedPaint(true); private void OnCheckButtonDragRect(object sender, ButtonDragRectangleEventArgs e) { // Cast incoming reference to the actual button view - INavCheckItem reorderItem = (INavCheckItem)sender; + var reorderItem = (INavCheckItem)sender; e.PreDragOffset = (Navigator.AllowPageReorder && reorderItem.Page.AreFlagsSet(KryptonPageFlags.AllowPageReorder)); Rectangle dragRect = Rectangle.Union(e.DragRect, _layoutBarViewport.ClientRectangle); @@ -1201,7 +1183,7 @@ private void OnCheckButtonDragRect(object sender, ButtonDragRectangleEventArgs e private void OnCheckButtonDragOffset(object sender, ButtonDragOffsetEventArgs e) { // Cast incoming reference to the actual button view - INavCheckItem reorderItem = (INavCheckItem)sender; + var reorderItem = (INavCheckItem)sender; ViewBase reorderView = reorderItem.View; // Scan the collection of children diff --git a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderOutlookBase.cs b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderOutlookBase.cs index 6cfcefc42..829bc5f6d 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderOutlookBase.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderOutlookBase.cs @@ -75,7 +75,7 @@ public OutlookButtonSpecCollection(KryptonNavigator owner) static ViewBuilderOutlookBase() { // Get the assembly that contains the bitmap resource - Assembly? myAssembly = Assembly.GetAssembly(typeof(ViewBuilderOutlookBase)); + var myAssembly = Assembly.GetAssembly(typeof(ViewBuilderOutlookBase)); // Get the resource streams containing the images Stream? streamBlueUp = myAssembly.GetManifestResourceStream(@"Krypton.Navigator.Resources.BlueUp.bmp"); @@ -228,7 +228,7 @@ public bool SeparatorMoving(Point mouse, Point splitter) if (checkButton.Visible) { // Get the orientation specific test value - int checkButtonPos = Navigator.Outlook.Orientation == Orientation.Vertical + var checkButtonPos = Navigator.Outlook.Orientation == Orientation.Vertical ? checkButton.ClientHeight : checkButton.ClientWidth; @@ -1210,11 +1210,9 @@ protected virtual ViewBase CreateView() /// Gets the view element to use as the layout filler. /// /// ViewBase derived instance. - protected virtual void SetLayoutFiller(ViewLayoutDocker viewLayout) - { + protected virtual void SetLayoutFiller(ViewLayoutDocker viewLayout) => // Put the old root as the filler inside stack elements viewLayout.Add(_oldRoot, ViewDockStyle.Fill); - } /// /// Create an overflow check button. @@ -2054,22 +2052,18 @@ private VisualOrientation ResolveStackButtonOrientation() private VisualOrientation ResolveOverflowButtonOrientation() => Navigator.Outlook.Orientation == Orientation.Vertical ? VisualOrientation.Top : VisualOrientation.Left; - private ViewDrawNavCheckButtonBase? GetShrinkStackItem() - { + private ViewDrawNavCheckButtonBase? GetShrinkStackItem() => // If there is a visible stack item, then we can always shrink it away - return _pageStackLookup?.Values.FirstOrDefault(static checkButton => checkButton.Visible); - } + _pageStackLookup?.Values.FirstOrDefault(static checkButton => checkButton.Visible); - private ViewDrawNavCheckButtonBase? GetExpandOverflowItem() - { + private ViewDrawNavCheckButtonBase? GetExpandOverflowItem() => // If there is a overflow stack item, then we can always show it - return _pageOverflowLookup?.Values.FirstOrDefault(static checkButton => checkButton.Visible); - } + _pageOverflowLookup?.Values.FirstOrDefault(static checkButton => checkButton.Visible); private bool PageInTheStack(KryptonPage page) { // Get the overflow check button for the page - ViewDrawNavOutlookOverflow checkButton = (ViewDrawNavOutlookOverflow)_pageOverflowLookup[page]; + var checkButton = (ViewDrawNavOutlookOverflow)_pageOverflowLookup[page]; // If not visible on the overflow bar then must be in the stack return !checkButton.Visible; @@ -2082,16 +2076,11 @@ private void OnEnabledChanged(object sender, EventArgs e) Navigator.Invalidate(); } - private void OnAutoSizeChanged(object sender, EventArgs e) - { + private void OnAutoSizeChanged(object sender, EventArgs e) => // Only use minimum instead of preferred if not using AutoSize _oldRoot.SetMinimumAsPreferred(!Navigator.AutoSize); - } - private void OnViewportAnimation(object sender, EventArgs e) - { - Navigator.PerformNeedPaint(true); - } + private void OnViewportAnimation(object sender, EventArgs e) => Navigator.PerformNeedPaint(true); private bool AreFewerButtons() { @@ -2228,7 +2217,7 @@ private void OnShowFewerClick(object sender, EventArgs e) private void OnPageAddRemoveClick(object sender, EventArgs e) { // Cast to correct type - KryptonContextMenuItem? menuItem = sender as KryptonContextMenuItem; + var menuItem = sender as KryptonContextMenuItem; // Get the page this menu item is associated with @@ -2251,7 +2240,7 @@ private void ResetCachedKryptonContextMenu() private void OnCheckButtonDragRect(object sender, ButtonDragRectangleEventArgs e) { // Cast incoming reference to the actual check button view - ViewDrawNavOutlookStack reorderItem = (ViewDrawNavOutlookStack)sender; + var reorderItem = (ViewDrawNavOutlookStack)sender; e.PreDragOffset = (Navigator.AllowPageReorder && reorderItem.Page.AreFlagsSet(KryptonPageFlags.AllowPageReorder)); Rectangle dragRect = Rectangle.Union(e.DragRect, _viewLayout.ClientRectangle); @@ -2274,14 +2263,14 @@ private void OnCheckButtonDragRect(object sender, ButtonDragRectangleEventArgs e private void OnCheckButtonDragOffset(object sender, ButtonDragOffsetEventArgs e) { // Cast incoming reference to the actual check button view - ViewDrawNavOutlookStack reorderView = (ViewDrawNavOutlookStack)sender; + var reorderView = (ViewDrawNavOutlookStack)sender; // Scan the collection of children var foundReorderView = false; foreach (KryptonPage page in Navigator.Pages) { // If the mouse is over this button - ViewDrawNavOutlookStack childView = (ViewDrawNavOutlookStack)_pageStackLookup[page]; + var childView = (ViewDrawNavOutlookStack)_pageStackLookup[page]; if (childView.Visible && childView.ClientRectangle.Contains(e.PointOffset)) { // Only interested if mouse over a different check button @@ -2379,7 +2368,7 @@ private void RecreateView() foreach (KryptonPage page in Navigator.Pages) { // Grab the page associated view elements - ViewDrawNavOutlookStack? checkButton = _pageStackLookup?[page] as ViewDrawNavOutlookStack; + var checkButton = _pageStackLookup?[page] as ViewDrawNavOutlookStack; ViewDrawBorderEdge? buttonEdge = _buttonEdgeLookup?[page]; // Add to the end of the collection diff --git a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderOutlookFull.cs b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderOutlookFull.cs index c24bedaa2..8f61abcde 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderOutlookFull.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderOutlookFull.cs @@ -268,10 +268,7 @@ protected override void OnViewBuilderPropertyChanged(object sender, PropertyChan #endregion #region Implementation - private void OnViewportAnimation(object sender, EventArgs e) - { - Navigator.PerformNeedPaint(true); - } + private void OnViewportAnimation(object sender, EventArgs e) => Navigator.PerformNeedPaint(true); #endregion } } diff --git a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderPanel.cs b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderPanel.cs index a83ea741a..04e75a494 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderPanel.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderPanel.cs @@ -207,10 +207,7 @@ protected override void OnViewBuilderPropertyChanged(object sender, PropertyChan #endregion #region Implementation - private void OnEnabledChanged(object sender, EventArgs e) - { - UpdateStatePalettes(); - } + private void OnEnabledChanged(object sender, EventArgs e) => UpdateStatePalettes(); #endregion } } diff --git a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderStackCheckButtonBase.cs b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderStackCheckButtonBase.cs index 7c7dd9e7b..14734bab6 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderStackCheckButtonBase.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewBuilderStackCheckButtonBase.cs @@ -90,11 +90,9 @@ public override void Construct(KryptonNavigator navigator, /// /// Element to search against. /// Reference to ButtonSpec; otherwise null. - public override ButtonSpec? ButtonSpecFromView(ViewBase element) - { + public override ButtonSpec? ButtonSpecFromView(ViewBase element) => // Check each page level button spec - return _pageLookup?.Select(pair => pair.Value.ButtonSpecFromView(element)).FirstOrDefault(static bs => bs != null); - } + _pageLookup?.Select(pair => pair.Value.ButtonSpecFromView(element)).FirstOrDefault(static bs => bs != null); /// /// Process a change in the selected page @@ -525,11 +523,9 @@ public override bool DesignerGetHitTest(Point pt) /// /// Destruct the mode specific view hierarchy. /// - protected virtual void DestructStackCheckButtonView() - { + protected virtual void DestructStackCheckButtonView() => // Reset the preferred direction handling to original setting _oldRoot.SetMinimumAsPreferred(false); - } /// /// Allow operations to occur after main construct actions. @@ -944,21 +940,16 @@ private void OnEnabledChanged(object sender, EventArgs e) Navigator.Invalidate(); } - private void OnAutoSizeChanged(object sender, EventArgs e) - { + private void OnAutoSizeChanged(object sender, EventArgs e) => // Only use minimum instead of preferred if not using AutoSize _oldRoot.SetMinimumAsPreferred(!Navigator.AutoSize); - } - private void OnViewportAnimation(object sender, EventArgs e) - { - Navigator.PerformNeedPaint(true); - } + private void OnViewportAnimation(object sender, EventArgs e) => Navigator.PerformNeedPaint(true); private void OnCheckButtonDragRect(object sender, ButtonDragRectangleEventArgs e) { // Cast incoming reference to the actual check button view - ViewDrawNavCheckButtonStack reorderItem = (ViewDrawNavCheckButtonStack)sender; + var reorderItem = (ViewDrawNavCheckButtonStack)sender; e.PreDragOffset = (Navigator.AllowPageReorder && reorderItem.Page.AreFlagsSet(KryptonPageFlags.AllowPageReorder)); Rectangle dragRect = Rectangle.Union(e.DragRect, _viewScrollViewport.ClientRectangle); @@ -969,7 +960,7 @@ private void OnCheckButtonDragRect(object sender, ButtonDragRectangleEventArgs e private void OnCheckButtonDragOffset(object sender, ButtonDragOffsetEventArgs e) { // Cast incoming reference to the actual check button view - ViewDrawNavCheckButtonStack reorderView = (ViewDrawNavCheckButtonStack)sender; + var reorderView = (ViewDrawNavCheckButtonStack)sender; // Scan the collection of children var foundReorderView = false; @@ -977,7 +968,7 @@ private void OnCheckButtonDragOffset(object sender, ButtonDragOffsetEventArgs e) foreach (KryptonPage page in Navigator.Pages) { // If the mouse is over this button - ViewDrawNavCheckButtonStack childView = (ViewDrawNavCheckButtonStack)_pageLookup[page]; + var childView = (ViewDrawNavCheckButtonStack)_pageLookup[page]; if (childView.ClientRectangle.Contains(e.PointOffset)) { // Only interested if mouse over a different check button @@ -1078,7 +1069,7 @@ private void RecreateView() foreach (KryptonPage page in Navigator.Pages) { // Grab the page associated view elements - ViewDrawNavCheckButtonStack checkButton = (ViewDrawNavCheckButtonStack)_pageLookup[page]; + var checkButton = (ViewDrawNavCheckButtonStack)_pageLookup[page]; ViewDrawBorderEdge buttonEdge = _buttonEdgeLookup[page]; // Add to the child collection with the correct docking style diff --git a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewletHeaderGroup.cs b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewletHeaderGroup.cs index 07acf80c6..155dc6f90 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewletHeaderGroup.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewletHeaderGroup.cs @@ -115,11 +115,9 @@ public void Destruct() /// /// Recreate the buttons to reflect a change in selected page. /// - public void UpdateButtons() - { + public void UpdateButtons() => // Ensure buttons are recreated to reflect different page _buttonManager?.RecreateButtons(); - } /// /// Ensure the correct state palettes are being used. @@ -351,8 +349,7 @@ private void CreateDragDrop() controller.LeftDoubleClick += OnLeftDoubleClick; } - private void CreateButtonSpecManager() - { + private void CreateButtonSpecManager() => // Create button specification collection manager _buttonManager = new ButtonSpecManagerDraw(Navigator, Redirector, Navigator.Button.ButtonSpecs, Navigator.FixedSpecs, new[] { _viewHeadingPrimary, _viewHeadingSecondary }, @@ -366,7 +363,6 @@ private void CreateButtonSpecManager() // Hook up the tooltip manager so that tooltips can be generated ToolTipManager = Navigator.ToolTipManager }; - } private void UpdateHeaders() { @@ -489,40 +485,19 @@ private void SetEnabled(bool enabled) _buttonManager.RecreateButtons(); } - private void OnDragStart(object sender, DragStartEventCancelArgs e) - { - Navigator.InternalDragStart(e, null); - } + private void OnDragStart(object sender, DragStartEventCancelArgs e) => Navigator.InternalDragStart(e, null); - private void OnDragMove(object sender, PointEventArgs e) - { - Navigator.InternalDragMove(e); - } + private void OnDragMove(object sender, PointEventArgs e) => Navigator.InternalDragMove(e); - private void OnDragEnd(object sender, PointEventArgs e) - { - Navigator.InternalDragEnd(e); - } + private void OnDragEnd(object sender, PointEventArgs e) => Navigator.InternalDragEnd(e); - private void OnDragQuit(object sender, EventArgs e) - { - Navigator.InternalDragQuit(); - } + private void OnDragQuit(object sender, EventArgs e) => Navigator.InternalDragQuit(); - private void OnLeftMouseDown(object sender, EventArgs e) - { - Navigator.OnPrimaryHeaderLeftClicked(e); - } + private void OnLeftMouseDown(object sender, EventArgs e) => Navigator.OnPrimaryHeaderLeftClicked(e); - private void OnRightMouseDown(object sender, EventArgs e) - { - Navigator.OnPrimaryHeaderRightClicked(e); - } + private void OnRightMouseDown(object sender, EventArgs e) => Navigator.OnPrimaryHeaderRightClicked(e); - private void OnLeftDoubleClick(object sender, EventArgs e) - { - Navigator.OnPrimaryHeaderDoubleClicked(e); - } + private void OnLeftDoubleClick(object sender, EventArgs e) => Navigator.OnPrimaryHeaderDoubleClicked(e); #endregion } } diff --git a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewletHeaderGroupOutlook.cs b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewletHeaderGroupOutlook.cs index 508bee635..b42df2cc3 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Builder/ViewletHeaderGroupOutlook.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Builder/ViewletHeaderGroupOutlook.cs @@ -62,16 +62,14 @@ public override void ViewBuilderPropertyChanged(PropertyChangedEventArgs e) /// Gets the visible state of the secondary header. /// /// Boolean value. - protected override bool GetHeaderSecondaryVisible() - { + protected override bool GetHeaderSecondaryVisible() => // Work out the correct visiblity value to use - return Navigator.Outlook.HeaderSecondaryVisible switch + Navigator.Outlook.HeaderSecondaryVisible switch { InheritBool.Inherit => Navigator.Header.HeaderVisibleSecondary, InheritBool.True => true, _ => false }; - } /// /// Gets the source of the primary header values. diff --git a/Source/Krypton Components/Krypton.Navigator/View Draw/ViewDrawNavCheckButtonBase.cs b/Source/Krypton Components/Krypton.Navigator/View Draw/ViewDrawNavCheckButtonBase.cs index 0d897839b..6414682c6 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Draw/ViewDrawNavCheckButtonBase.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Draw/ViewDrawNavCheckButtonBase.cs @@ -306,10 +306,7 @@ public virtual KryptonPage? Page /// /// Raises the Click event for the button. /// - public void PerformClick() - { - OnClick(this, EventArgs.Empty); - } + public void PerformClick() => OnClick(this, EventArgs.Empty); #endregion #region IContentValues @@ -415,10 +412,7 @@ protected virtual IMouseController CreateMouseController() /// /// Source of the event. /// An NeedLayoutEventArgs containing event data. - protected virtual void OnNeedPaint(object? sender, NeedLayoutEventArgs e) - { - _needPaint?.Invoke(this, e); - } + protected virtual void OnNeedPaint(object? sender, NeedLayoutEventArgs e) => _needPaint?.Invoke(this, e); #endregion #region OnClick @@ -495,35 +489,17 @@ protected virtual void OnRightClick(object sender, MouseEventArgs e) #endregion #region Implementation - private void OnDragStart(object sender, DragStartEventCancelArgs e) - { - Navigator.InternalDragStart(e, _page); - } + private void OnDragStart(object sender, DragStartEventCancelArgs e) => Navigator.InternalDragStart(e, _page); - private void OnDragMove(object sender, PointEventArgs e) - { - Navigator.InternalDragMove(e); - } + private void OnDragMove(object sender, PointEventArgs e) => Navigator.InternalDragMove(e); - private void OnDragEnd(object sender, PointEventArgs e) - { - Navigator.InternalDragEnd(e); - } + private void OnDragEnd(object sender, PointEventArgs e) => Navigator.InternalDragEnd(e); - private void OnDragQuit(object sender, EventArgs e) - { - Navigator.InternalDragQuit(); - } + private void OnDragQuit(object sender, EventArgs e) => Navigator.InternalDragQuit(); - private void OnButtonDragRectangle(object sender, ButtonDragRectangleEventArgs e) - { - ButtonDragRectangle?.Invoke(this, e); - } + private void OnButtonDragRectangle(object sender, ButtonDragRectangleEventArgs e) => ButtonDragRectangle?.Invoke(this, e); - private void OnButtonDragOffset(object sender, ButtonDragOffsetEventArgs e) - { - ButtonDragOffset?.Invoke(this, e); - } + private void OnButtonDragOffset(object sender, ButtonDragOffsetEventArgs e) => ButtonDragOffset?.Invoke(this, e); #endregion } } diff --git a/Source/Krypton Components/Krypton.Navigator/View Draw/ViewDrawNavOutlookMini.cs b/Source/Krypton Components/Krypton.Navigator/View Draw/ViewDrawNavOutlookMini.cs index d38624d1d..6d4b7b9b9 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Draw/ViewDrawNavOutlookMini.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Draw/ViewDrawNavOutlookMini.cs @@ -126,19 +126,15 @@ protected override IMouseController CreateMouseController() #endregion #region Implementation - private void OnMiniClick(object sender, EventArgs e) - { + private void OnMiniClick(object sender, EventArgs e) => // Ask the navigator to show the specified page as a popup window // relative to our location as an element and firing the provided // delegate when the popup is dismissed. Navigator.ShowPopupPage(Page, this, _finishDelegate); - } - private void OnPopupFinished(object sender, EventArgs e) - { + private void OnPopupFinished(object sender, EventArgs e) => // Remove the fixed display of the button, now the associated popup has been removed _controller.RemoveFixed(); - } #endregion } } diff --git a/Source/Krypton Components/Krypton.Navigator/View Draw/ViewDrawNavRibbonTab.cs b/Source/Krypton Components/Krypton.Navigator/View Draw/ViewDrawNavRibbonTab.cs index 3395ce4a3..4ca523ee3 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Draw/ViewDrawNavRibbonTab.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Draw/ViewDrawNavRibbonTab.cs @@ -266,10 +266,7 @@ public NeedPaintHandler? NeedPaint /// /// Raises the Click event for the button. /// - public void PerformClick() - { - OnClick(this, EventArgs.Empty); - } + public void PerformClick() => OnClick(this, EventArgs.Empty); /// /// Set the orientation of the background/border and content. @@ -313,7 +310,7 @@ public override void Layout(ViewLayoutContext context) // We take on all the provided size ClientRectangle = context.DisplayRectangle; - Padding layoutPadding = Padding.Empty; + var layoutPadding = Padding.Empty; switch (_borderBackOrient) { @@ -437,10 +434,7 @@ protected virtual void OnRightClick(object sender, MouseEventArgs e) /// /// Source of the event. /// An NeedLayoutEventArgs containing event data. - protected virtual void OnNeedPaint(object? sender, NeedLayoutEventArgs e) - { - _needPaint?.Invoke(this, e); - } + protected virtual void OnNeedPaint(object? sender, NeedLayoutEventArgs e) => _needPaint?.Invoke(this, e); #endregion #region Implementation @@ -597,35 +591,17 @@ private void OnClick(object sender, EventArgs e) } } - private void OnDragStart(object sender, DragStartEventCancelArgs e) - { - Navigator.InternalDragStart(e, Page); - } + private void OnDragStart(object sender, DragStartEventCancelArgs e) => Navigator.InternalDragStart(e, Page); - private void OnDragMove(object sender, PointEventArgs e) - { - Navigator.InternalDragMove(e); - } + private void OnDragMove(object sender, PointEventArgs e) => Navigator.InternalDragMove(e); - private void OnDragEnd(object sender, PointEventArgs e) - { - Navigator.InternalDragEnd(e); - } + private void OnDragEnd(object sender, PointEventArgs e) => Navigator.InternalDragEnd(e); - private void OnDragQuit(object sender, EventArgs e) - { - Navigator.InternalDragQuit(); - } + private void OnDragQuit(object sender, EventArgs e) => Navigator.InternalDragQuit(); - private void OnButtonDragRectangle(object sender, ButtonDragRectangleEventArgs e) - { - ButtonDragRectangle?.Invoke(this, e); - } + private void OnButtonDragRectangle(object sender, ButtonDragRectangleEventArgs e) => ButtonDragRectangle?.Invoke(this, e); - private void OnButtonDragOffset(object sender, ButtonDragOffsetEventArgs e) - { - ButtonDragOffset?.Invoke(this, e); - } + private void OnButtonDragOffset(object sender, ButtonDragOffsetEventArgs e) => ButtonDragOffset?.Invoke(this, e); #endregion } } diff --git a/Source/Krypton Components/Krypton.Navigator/View Layout/ViewLayoutBar.cs b/Source/Krypton Components/Krypton.Navigator/View Layout/ViewLayoutBar.cs index 8cbbe3819..81d6a2dd3 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Layout/ViewLayoutBar.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Layout/ViewLayoutBar.cs @@ -276,10 +276,7 @@ public RelativePositionAlign ItemAlignment /// Updates the metrics source and metric to use. /// /// Source for acquiring metrics. - public void SetMetrics(IPaletteMetric? paletteMetric) - { - _paletteMetric = paletteMetric; - } + public void SetMetrics(IPaletteMetric? paletteMetric) => _paletteMetric = paletteMetric; /// /// Updates the metrics source and metric to use. @@ -333,7 +330,7 @@ public override Size GetPreferredSize([DisallowNull] ViewLayoutContext context) { // Get access to the indexed child ViewBase child = this[reversed ? (Count - i - 1) : i]; - INavCheckItem checkItem = (INavCheckItem)child; + var checkItem = (INavCheckItem)child; // Only examine visible children if (child.Visible) diff --git a/Source/Krypton Components/Krypton.Navigator/View Layout/ViewLayoutBarForTabs.cs b/Source/Krypton Components/Krypton.Navigator/View Layout/ViewLayoutBarForTabs.cs index b939c13b4..e1fbd8e07 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Layout/ViewLayoutBarForTabs.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Layout/ViewLayoutBarForTabs.cs @@ -127,8 +127,8 @@ private void RenderChildren(RenderContext context, bool drawChecked) if (child.Visible && child.ClientRectangle.IntersectsWith(context.ClipRect)) { // If this is a page representation that can overlap group border - ViewDrawNavCheckButtonBar buttonBar = child as ViewDrawNavCheckButtonBar; - ViewDrawNavRibbonTab tab = child as ViewDrawNavRibbonTab; + var buttonBar = child as ViewDrawNavCheckButtonBar; + var tab = child as ViewDrawNavRibbonTab; if ((buttonBar != null) || (tab != null)) { diff --git a/Source/Krypton Components/Krypton.Navigator/View Layout/ViewLayoutPageShow.cs b/Source/Krypton Components/Krypton.Navigator/View Layout/ViewLayoutPageShow.cs index af878aaa4..777c92463 100644 --- a/Source/Krypton Components/Krypton.Navigator/View Layout/ViewLayoutPageShow.cs +++ b/Source/Krypton Components/Krypton.Navigator/View Layout/ViewLayoutPageShow.cs @@ -50,11 +50,9 @@ public override string ToString() => /// Sets if the minimum size should be used instead of preferred. /// /// Should minimum be used instead of preferred. - public void SetMinimumAsPreferred(bool minimum) - { + public void SetMinimumAsPreferred(bool minimum) => // Update preferred calculation details _minimumAsPreferred = minimum; - } #endregion #region Layout @@ -66,7 +64,7 @@ public override Size GetPreferredSize([DisallowNull] ViewLayoutContext context) { Debug.Assert(context != null); - Size ret = Size.Empty; + var ret = Size.Empty; // Use the minimum size instead of preferred size? if (_minimumAsPreferred) diff --git a/Source/Krypton Components/Krypton.Ribbon/ButtonSpec/ButtonSpecViewAppButton.cs b/Source/Krypton Components/Krypton.Ribbon/ButtonSpec/ButtonSpecViewAppButton.cs index a17cd07d6..41e615b0e 100644 --- a/Source/Krypton Components/Krypton.Ribbon/ButtonSpec/ButtonSpecViewAppButton.cs +++ b/Source/Krypton Components/Krypton.Ribbon/ButtonSpec/ButtonSpecViewAppButton.cs @@ -55,7 +55,7 @@ public override ButtonSpecViewControllers CreateController(ViewDrawButton viewBu MouseEventHandler clickHandler) { // Create a ribbon specific button controller - ButtonSpecManagerLayoutAppButton managerAppButton = (ButtonSpecManagerLayoutAppButton)Manager; + var managerAppButton = (ButtonSpecManagerLayoutAppButton)Manager; _controller = new ButtonSpecAppButtonController(managerAppButton.ViewManager, viewButton, needPaint) { BecomesFixed = true @@ -78,11 +78,9 @@ public override ButtonSpecViewControllers CreateController(ViewDrawButton viewBu /// /// Source of the event. /// An EventArgs that contains the event data. - protected override void OnFinishDelegate(object sender, EventArgs e) - { + protected override void OnFinishDelegate(object sender, EventArgs e) => // Ask the button to remove the fixed pressed appearance _controller.RemoveFixed(); - } #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/ButtonSpec/ButtonSpecViewRibbon.cs b/Source/Krypton Components/Krypton.Ribbon/ButtonSpec/ButtonSpecViewRibbon.cs index 5cb6527cf..51c8a01f0 100644 --- a/Source/Krypton Components/Krypton.Ribbon/ButtonSpec/ButtonSpecViewRibbon.cs +++ b/Source/Krypton Components/Krypton.Ribbon/ButtonSpec/ButtonSpecViewRibbon.cs @@ -77,11 +77,9 @@ public override ButtonSpecViewControllers CreateController(ViewDrawButton viewBu /// /// Source of the event. /// An EventArgs that contains the event data. - protected override void OnFinishDelegate(object sender, EventArgs e) - { + protected override void OnFinishDelegate(object sender, EventArgs e) => // Ask the button to remove the fixed pressed appearance _controller.RemoveFixed(); - } #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/AppButtonController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/AppButtonController.cs index 82d85fba7..35c04decb 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/AppButtonController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/AppButtonController.cs @@ -251,7 +251,7 @@ public virtual void LostFocus(Control c) public void KeyDown(Control c, KeyEventArgs e) { ViewBase newView = null; - KryptonRibbon ribbon = (KryptonRibbon)c; + var ribbon = (KryptonRibbon)c; switch (e.KeyData) { @@ -398,7 +398,7 @@ public void KeyTipSelect(KryptonRibbon ribbon) protected void UpdateTargetState() { // By default the button is in the normal state - PaletteState newState = PaletteState.Normal; + var newState = PaletteState.Normal; // Only allow another state if the ribbon is enabled if (_ribbon.Enabled) @@ -473,10 +473,7 @@ protected void UpdateTargetState() /// Does the palette change require a layout. /// Client area to be invalidated. protected virtual void OnNeedPaint(bool needLayout, - Rectangle invalidRect) - { - NeedPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, invalidRect)); - } + Rectangle invalidRect) => NeedPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, invalidRect)); /// /// Raises the Click event. @@ -493,10 +490,7 @@ protected virtual void OnClick(MouseEventArgs e) /// Raises the MouseReleased event. /// /// A MouseEventArgs containing the event data. - protected virtual void OnMouseReleased(MouseEventArgs e) - { - MouseReleased?.Invoke(this, e); - } + protected virtual void OnMouseReleased(MouseEventArgs e) => MouseReleased?.Invoke(this, e); #endregion #region Implementation diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/AppTabController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/AppTabController.cs index 741f99e6e..3747b4986 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/AppTabController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/AppTabController.cs @@ -246,7 +246,7 @@ public virtual void LostFocus(Control c) public void KeyDown(Control c, KeyEventArgs e) { ViewBase newView = null; - KryptonRibbon ribbon = (KryptonRibbon)c; + var ribbon = (KryptonRibbon)c; switch (e.KeyData) { @@ -389,7 +389,7 @@ public void KeyTipSelect(KryptonRibbon ribbon) protected void UpdateTargetState() { // By default the button is in the normal state - PaletteState newState = PaletteState.Normal; + var newState = PaletteState.Normal; // Only allow another state if the ribbon is enabled if (_ribbon.Enabled) @@ -468,10 +468,7 @@ protected void UpdateTargetState() /// Does the palette change require a layout. /// Client area to be invalidated. protected virtual void OnNeedPaint(bool needLayout, - Rectangle invalidRect) - { - NeedPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, invalidRect)); - } + Rectangle invalidRect) => NeedPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, invalidRect)); /// /// Raises the Click event. @@ -488,10 +485,7 @@ protected virtual void OnClick(MouseEventArgs e) /// Raises the MouseReleased event. /// /// A MouseEventArgs containing the event data. - protected virtual void OnMouseReleased(MouseEventArgs e) - { - MouseReleased?.Invoke(this, e); - } + protected virtual void OnMouseReleased(MouseEventArgs e) => MouseReleased?.Invoke(this, e); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/ButtonSpecAppButtonController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/ButtonSpecAppButtonController.cs index 8ab8c24b3..4a2f0f733 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/ButtonSpecAppButtonController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/ButtonSpecAppButtonController.cs @@ -160,10 +160,7 @@ public void ClearSubMenu() /// /// Activate the item because of a mnemonic key press. /// - public void MnemonicActivate() - { - OnClick(new MouseEventArgs(MouseButtons.None, 1, 0, 0, 0)); - } + public void MnemonicActivate() => OnClick(new MouseEventArgs(MouseButtons.None, 1, 0, 0, 0)); /// /// Gets the view element that should be used when this target is active. diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/ButtonSpecRibbonController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/ButtonSpecRibbonController.cs index d3074b521..c21477c2f 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/ButtonSpecRibbonController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/ButtonSpecRibbonController.cs @@ -45,10 +45,10 @@ public ButtonSpecRibbonController(ViewBase target, public override void KeyDown(Control c, KeyEventArgs e) { ViewBase newView = null; - KryptonRibbon ribbon = (KryptonRibbon)c; + var ribbon = (KryptonRibbon)c; // Get the button spec associated with this controller - ViewDrawButton viewButton = (ViewDrawButton)Target; + var viewButton = (ViewDrawButton)Target; ButtonSpec buttonSpec = ribbon.TabsArea.ButtonSpecManager.GetButtonSpecFromView(viewButton); // Note if we are on the near edge diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/CollapsedGroupController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/CollapsedGroupController.cs index 58c555fcf..2c6285a8a 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/CollapsedGroupController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/CollapsedGroupController.cs @@ -71,11 +71,9 @@ public CollapsedGroupController([DisallowNull] KryptonRibbon ribbon, /// Mouse has entered the view. /// /// Reference to the source control instance. - public virtual void MouseEnter(Control c) - { + public virtual void MouseEnter(Control c) => // Mouse is over the target _mouseOver = true; - } /// /// Mouse has moved inside the view. @@ -119,13 +117,10 @@ public virtual void MouseUp(Control c, Point pt, MouseButtons button) /// /// Reference to the source control instance. /// Reference to view that is next to have the mouse. - public virtual void MouseLeave(Control c, ViewBase? next) - { + public virtual void MouseLeave(Control c, ViewBase? next) => // Mouse is no longer over the target _mouseOver = false; - } - /// /// Left mouse button double click. /// @@ -237,19 +232,13 @@ public void KeyTipSelect(KryptonRibbon ribbon) /// Does the palette change require a layout. /// Client area to be invalidated. protected virtual void OnNeedPaint(bool needLayout, - Rectangle invalidRect) - { - _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, invalidRect)); - } + Rectangle invalidRect) => _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, invalidRect)); /// /// Raises the Click event. /// /// A MouseEventArgs containing the event data. - protected virtual void OnClick(MouseEventArgs e) - { - Click?.Invoke(this, e); - } + protected virtual void OnClick(MouseEventArgs e) => Click?.Invoke(this, e); #endregion #region Implementation diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/ComboBoxController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/ComboBoxController.cs index e76ec38da..28fe17d49 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/ComboBoxController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/ComboBoxController.cs @@ -56,8 +56,7 @@ public ComboBoxController([DisallowNull] KryptonRibbon ribbon, /// Reference to the source control instance. public void GotFocus(Control c) { - if ((_comboBox.LastComboBox?.ComboBox != null) - && _comboBox.LastComboBox.ComboBox.CanFocus) + if (_comboBox.LastComboBox?.ComboBox is { CanFocus: true }) { _ribbon.LostFocusLosesKeyboard = false; _comboBox.LastComboBox.ComboBox.Focus(); diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/ContextClickController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/ContextClickController.cs index 78450e8b1..1a907f3bd 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/ContextClickController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/ContextClickController.cs @@ -127,10 +127,7 @@ public virtual void DoubleClick(Point pt) /// Raises the ContextClick event. /// /// A MouseEventArgs containing the event data. - protected virtual void OnContextClick(MouseEventArgs e) - { - ContextClick?.Invoke(this, e); - } + protected virtual void OnContextClick(MouseEventArgs e) => ContextClick?.Invoke(this, e); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/ContextTitleController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/ContextTitleController.cs index 70db80fbe..ec99310bb 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/ContextTitleController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/ContextTitleController.cs @@ -50,11 +50,9 @@ public ContextTitleController([DisallowNull] KryptonRibbon ribbon) /// Mouse has entered the view. /// /// Reference to the source control instance. - public virtual void MouseEnter(Control c) - { + public virtual void MouseEnter(Control c) => // Mouse is over the target _mouseOver = true; - } /// /// Mouse has moved inside the view. @@ -110,11 +108,9 @@ public virtual void MouseUp(Control c, Point pt, MouseButtons button) /// /// Reference to the source control instance. /// Reference to view that is next to have the mouse. - public virtual void MouseLeave(Control c, ViewBase? next) - { + public virtual void MouseLeave(Control c, ViewBase? next) => // Mouse is no longer over the target _mouseOver = false; - } /// /// Left mouse button double click. diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/DomainUpDownController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/DomainUpDownController.cs index 8b719886e..59eaa2462 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/DomainUpDownController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/DomainUpDownController.cs @@ -56,8 +56,7 @@ public DomainUpDownController([DisallowNull] KryptonRibbon ribbon, /// Reference to the source control instance. public void GotFocus(Control c) { - if ((_domainUpDown.LastDomainUpDown?.DomainUpDown != null) - && _domainUpDown.LastDomainUpDown.DomainUpDown.CanFocus) + if (_domainUpDown.LastDomainUpDown?.DomainUpDown is { CanFocus: true }) { _ribbon.LostFocusLosesKeyboard = false; _domainUpDown.LastDomainUpDown.DomainUpDown.Focus(); diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/GalleryButtonController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/GalleryButtonController.cs index 58f0dd4b6..d4c4dbf88 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/GalleryButtonController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/GalleryButtonController.cs @@ -199,19 +199,13 @@ public NeedPaintHandler? NeedPaint /// /// Fires the NeedPaint event. /// - public void PerformNeedPaint() - { - OnNeedPaint(false); - } + public void PerformNeedPaint() => OnNeedPaint(false); /// /// Fires the NeedPaint event. /// /// Does the palette change require a layout. - public void PerformNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout); - } + public void PerformNeedPaint(bool needLayout) => OnNeedPaint(needLayout); #endregion #region Protected @@ -271,19 +265,13 @@ protected virtual void UpdateTargetState(Point pt) /// Raises the Click event. /// /// A MouseEventArgs containing the event data. - protected virtual void OnClick(MouseEventArgs e) - { - Click?.Invoke(Target, e); - } + protected virtual void OnClick(MouseEventArgs e) => Click?.Invoke(Target, e); /// /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, Target.ClientRectangle)); - } + protected virtual void OnNeedPaint(bool needLayout) => _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, Target.ClientRectangle)); #endregion #region Private diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/GalleryItemController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/GalleryItemController.cs index 47a1abefe..e738a721b 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/GalleryItemController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/GalleryItemController.cs @@ -354,19 +354,13 @@ public NeedPaintHandler? NeedPaint /// /// Fires the NeedPaint event. /// - public void PerformNeedPaint() - { - OnNeedPaint(false); - } + public void PerformNeedPaint() => OnNeedPaint(false); /// /// Fires the NeedPaint event. /// /// Does the palette change require a layout. - public void PerformNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout); - } + public void PerformNeedPaint(bool needLayout) => OnNeedPaint(needLayout); #endregion #region Protected @@ -448,19 +442,13 @@ protected virtual void UpdateTargetState(Point pt) /// Raises the Click event. /// /// A MouseEventArgs containing the event data. - protected virtual void OnClick(MouseEventArgs e) - { - Click?.Invoke(_target, e); - } + protected virtual void OnClick(MouseEventArgs e) => Click?.Invoke(_target, e); /// /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, _target.ClientRectangle)); - } + protected virtual void OnNeedPaint(bool needLayout) => _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, _target.ClientRectangle)); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/GroupButtonController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/GroupButtonController.cs index 84e37dbe0..ae4e6ab2a 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/GroupButtonController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/GroupButtonController.cs @@ -486,19 +486,13 @@ public NeedPaintHandler? NeedPaint /// /// Fires the NeedPaint event. /// - public void PerformNeedPaint() - { - OnNeedPaint(false); - } + public void PerformNeedPaint() => OnNeedPaint(false); /// /// Fires the NeedPaint event. /// /// Does the palette change require a layout. - public void PerformNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout); - } + public void PerformNeedPaint(bool needLayout) => OnNeedPaint(needLayout); #endregion #region Protected @@ -588,37 +582,25 @@ protected void UpdateTargetState(Point pt) /// Raises the Click event. /// /// An EventArgs containing the event data. - protected virtual void OnClick(EventArgs e) - { - Click?.Invoke(_target, e); - } + protected virtual void OnClick(EventArgs e) => Click?.Invoke(_target, e); /// /// Raises the Click event. /// /// A MouseEventArgs containing the event data. - protected virtual void OnContextClick(MouseEventArgs e) - { - ContextClick?.Invoke(this, e); - } + protected virtual void OnContextClick(MouseEventArgs e) => ContextClick?.Invoke(this, e); /// /// Raises the DropDown event. /// /// An EventArgs containing the event data. - protected virtual void OnDropDown(EventArgs e) - { - DropDown?.Invoke(_target, e); - } - + protected virtual void OnDropDown(EventArgs e) => DropDown?.Invoke(_target, e); + /// /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, _target.ClientRectangle)); - } + protected virtual void OnNeedPaint(bool needLayout) => _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, _target.ClientRectangle)); #endregion #region Implementation @@ -791,15 +773,12 @@ private void KeyDownPopupMinimized(VisualPopupMinimized popupMinimized, KeyEvent } } - private bool ClickOnDown(Point pt) + private bool ClickOnDown(Point pt) => ButtonType switch { - return ButtonType switch - { - GroupButtonType.DropDown => true, - GroupButtonType.Split => _splitRectangle.Contains(pt), - _ => false - }; - } + GroupButtonType.DropDown => true, + GroupButtonType.Split => _splitRectangle.Contains(pt), + _ => false + }; #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/GroupCheckBoxController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/GroupCheckBoxController.cs index 22d790e2e..24e449eda 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/GroupCheckBoxController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/GroupCheckBoxController.cs @@ -140,11 +140,9 @@ public virtual bool MouseDown(Control c, Point pt, MouseButtons button) /// /// Reference to the source control instance. /// Mouse position relative to control. - public virtual void MouseMove(Control c, Point pt) - { + public virtual void MouseMove(Control c, Point pt) => // Update the visual state UpdateTargetState(pt); - } /// /// Mouse button has been released in the view. @@ -346,19 +344,13 @@ public NeedPaintHandler? NeedPaint /// /// Fires the NeedPaint event. /// - public void PerformNeedPaint() - { - OnNeedPaint(false); - } + public void PerformNeedPaint() => OnNeedPaint(false); /// /// Fires the NeedPaint event. /// /// Does the palette change require a layout. - public void PerformNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout); - } + public void PerformNeedPaint(bool needLayout) => OnNeedPaint(needLayout); #endregion #region Protected @@ -429,28 +421,19 @@ protected void UpdateTargetState(Point pt) /// Raises the Click event. /// /// An EventArgs containing the event data. - protected virtual void OnClick(EventArgs e) - { - Click?.Invoke(TargetMain, e); - } + protected virtual void OnClick(EventArgs e) => Click?.Invoke(TargetMain, e); /// /// Raises the Click event. /// /// A MouseEventArgs containing the event data. - protected virtual void OnContextClick(MouseEventArgs e) - { - ContextClick?.Invoke(this, e); - } + protected virtual void OnContextClick(MouseEventArgs e) => ContextClick?.Invoke(this, e); /// /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, TargetMain.ClientRectangle)); - } + protected virtual void OnNeedPaint(bool needLayout) => _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, TargetMain.ClientRectangle)); #endregion #region Implementation diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/GroupRadioButtonController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/GroupRadioButtonController.cs index 8917cbd3f..1acb3b8dd 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/GroupRadioButtonController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/GroupRadioButtonController.cs @@ -140,11 +140,9 @@ public virtual bool MouseDown(Control c, Point pt, MouseButtons button) /// /// Reference to the source control instance. /// Mouse position relative to control. - public virtual void MouseMove(Control c, Point pt) - { + public virtual void MouseMove(Control c, Point pt) => // Update the visual state UpdateTargetState(pt); - } /// /// Mouse button has been released in the view. @@ -346,19 +344,13 @@ public NeedPaintHandler? NeedPaint /// /// Fires the NeedPaint event. /// - public void PerformNeedPaint() - { - OnNeedPaint(false); - } + public void PerformNeedPaint() => OnNeedPaint(false); /// /// Fires the NeedPaint event. /// /// Does the palette change require a layout. - public void PerformNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout); - } + public void PerformNeedPaint(bool needLayout) => OnNeedPaint(needLayout); #endregion #region Protected @@ -429,28 +421,19 @@ protected void UpdateTargetState(Point pt) /// Raises the Click event. /// /// An EventArgs containing the event data. - protected virtual void OnClick(EventArgs e) - { - Click?.Invoke(TargetMain, e); - } + protected virtual void OnClick(EventArgs e) => Click?.Invoke(TargetMain, e); /// /// Raises the Click event. /// /// A MouseEventArgs containing the event data. - protected virtual void OnContextClick(MouseEventArgs e) - { - ContextClick?.Invoke(this, e); - } + protected virtual void OnContextClick(MouseEventArgs e) => ContextClick?.Invoke(this, e); /// /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, TargetMain.ClientRectangle)); - } + protected virtual void OnNeedPaint(bool needLayout) => _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, TargetMain.ClientRectangle)); #endregion #region Implementation diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/LeftDownButtonController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/LeftDownButtonController.cs index 70b52e665..a6421e0e9 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/LeftDownButtonController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/LeftDownButtonController.cs @@ -99,11 +99,9 @@ public LeftDownButtonController([DisallowNull] KryptonRibbon ribbon, /// /// Fix the display of the button. /// - public void SetFixed() - { + public void SetFixed() => // Show the button as pressed, until told otherwise IsFixed = true; - } #endregion #region RemoveFixed @@ -249,7 +247,7 @@ public virtual void DoubleClick(Point pt) protected virtual void UpdateTargetState() { // By default the button is in the normal state - PaletteState newState = PaletteState.Normal; + var newState = PaletteState.Normal; // Only allow another state if the ribbon is enabled if (Ribbon.Enabled) @@ -296,19 +294,13 @@ protected virtual void UpdateTargetState() /// Does the palette change require a layout. /// Client area to be invalidated. protected virtual void OnNeedPaint(bool needLayout, - Rectangle invalidRect) - { - _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, invalidRect)); - } + Rectangle invalidRect) => _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, invalidRect)); /// /// Raises the Click event. /// /// A MouseEventArgs containing the event data. - protected virtual void OnClick(MouseEventArgs e) - { - Click?.Invoke(this, e); - } + protected virtual void OnClick(MouseEventArgs e) => Click?.Invoke(this, e); #endregion #region Implementation diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/LeftUpButtonController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/LeftUpButtonController.cs index 62ccc71bd..b0b85d554 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/LeftUpButtonController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/LeftUpButtonController.cs @@ -99,11 +99,9 @@ public virtual void MouseEnter(Control c) /// /// Reference to the source control instance. /// Mouse position relative to control. - public virtual void MouseMove(Control c, Point pt) - { + public virtual void MouseMove(Control c, Point pt) => // Update the visual state UpdateTargetState(pt); - } /// /// Mouse button has been pressed in the view. @@ -322,19 +320,13 @@ protected virtual void UpdateTargetState(Point pt) /// Raises the Click event. /// /// A MouseEventArgs containing the event data. - protected virtual void OnClick(MouseEventArgs e) - { - Click?.Invoke(Target, e); - } + protected virtual void OnClick(MouseEventArgs e) => Click?.Invoke(Target, e); /// /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout)); - } + protected virtual void OnNeedPaint(bool needLayout) => _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout)); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/MaskedTextBoxController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/MaskedTextBoxController.cs index 31b38a5cd..daa6b9a5f 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/MaskedTextBoxController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/MaskedTextBoxController.cs @@ -56,8 +56,7 @@ public MaskedTextBoxController([DisallowNull] KryptonRibbon ribbon, /// Reference to the source control instance. public void GotFocus(Control c) { - if ((_maskedTextBox.LastMaskedTextBox?.MaskedTextBox != null) - && _maskedTextBox.LastMaskedTextBox.MaskedTextBox.CanFocus) + if (_maskedTextBox.LastMaskedTextBox?.MaskedTextBox is { CanFocus: true }) { _ribbon.LostFocusLosesKeyboard = false; _maskedTextBox.LastMaskedTextBox.MaskedTextBox.Focus(); diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/NumericUpDownController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/NumericUpDownController.cs index fe6073cf1..40ff0325d 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/NumericUpDownController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/NumericUpDownController.cs @@ -56,8 +56,7 @@ public NumericUpDownController([DisallowNull] KryptonRibbon ribbon, /// Reference to the source control instance. public void GotFocus(Control c) { - if ((_numericUpDown.LastNumericUpDown?.NumericUpDown != null) - && _numericUpDown.LastNumericUpDown.NumericUpDown.CanFocus) + if (_numericUpDown.LastNumericUpDown?.NumericUpDown is { CanFocus: true }) { _ribbon.LostFocusLosesKeyboard = false; _numericUpDown.LastNumericUpDown.NumericUpDown.Focus(); diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/QATButtonController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/QATButtonController.cs index bb871b006..c8c771bd7 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/QATButtonController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/QATButtonController.cs @@ -48,10 +48,7 @@ public QATButtonController(KryptonRibbon ribbon, /// public override bool IgnoreVisualFormLeftButtonDown => true; - public override void MouseEnter(Control c) - { - base.MouseEnter(c); - } + public override void MouseEnter(Control c) => base.MouseEnter(c); #endregion #region Focus Notifications diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/RecentDocController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/RecentDocController.cs index 424452feb..600fa4e5d 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/RecentDocController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/RecentDocController.cs @@ -60,18 +60,12 @@ public RecentDocController([DisallowNull] ViewContextMenuManager viewManager, /// /// This target should display as the active target. /// - public virtual void ShowTarget() - { - HighlightState(); - } + public virtual void ShowTarget() => HighlightState(); /// /// This target should clear any active display. /// - public virtual void ClearTarget() - { - NormalState(); - } + public virtual void ClearTarget() => NormalState(); /// /// This target should show any appropriate sub menu. @@ -97,10 +91,7 @@ public void ClearSubMenu() /// /// Activate the item because of a mnemonic key press. /// - public void MnemonicActivate() - { - PressMenuItem(); - } + public void MnemonicActivate() => PressMenuItem(); /// /// Gets the view element that should be used when this target is active. @@ -160,10 +151,7 @@ public virtual void MouseMove(Control c, Point pt) /// Reference to the source control instance. /// Mouse position relative to control. /// Mouse button released. - public virtual void MouseUp(Control c, Point pt, MouseButtons button) - { - PressMenuItem(); - } + public virtual void MouseUp(Control c, Point pt, MouseButtons button) => PressMenuItem(); /// /// Mouse has left the view. @@ -334,10 +322,7 @@ public NeedPaintHandler? NeedPaint /// Fires the NeedPaint event. /// /// Does a layout need to occur. - public void PerformNeedPaint(bool layout) - { - OnNeedPaint(layout); - } + public void PerformNeedPaint(bool layout) => OnNeedPaint(layout); #endregion #region Implementation @@ -386,10 +371,7 @@ private void NormalState() /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, _menuItem.ClientRectangle)); - } + protected virtual void OnNeedPaint(bool needLayout) => _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, _menuItem.ClientRectangle)); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/RepeatButtonController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/RepeatButtonController.cs index fbaa1b00c..6fc606bb0 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/RepeatButtonController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/RepeatButtonController.cs @@ -87,10 +87,7 @@ public NeedPaintHandler? NeedPaint /// Fires the NeedPaint event. /// /// Does the palette change require a layout. - public void PerformNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout); - } + public void PerformNeedPaint(bool needLayout) => OnNeedPaint(needLayout); #endregion #region Mouse Notifications @@ -294,10 +291,7 @@ protected void UpdateTargetState(Point pt) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout)); - } + protected virtual void OnNeedPaint(bool needLayout) => _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout)); /// /// Raises the Click event. @@ -339,11 +333,9 @@ private bool Active } } - private void OnRepeatTick(object sender, EventArgs e) - { + private void OnRepeatTick(object sender, EventArgs e) => // Keep generating clicks OnClick(new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0)); - } #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/RibbonTabController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/RibbonTabController.cs index 9368589a1..52d3dc01d 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/RibbonTabController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/RibbonTabController.cs @@ -489,20 +489,14 @@ protected void UpdateTargetState(Point pt) /// Raises the Click event. /// /// A MouseEventArgs containing the event data. - protected virtual void OnClick(MouseEventArgs e) - { - Click?.Invoke(_target, e); - } + protected virtual void OnClick(MouseEventArgs e) => Click?.Invoke(_target, e); /// /// Raises the ContextClick event. /// /// A MouseEventArgs containing the event data. - protected virtual void OnContextClick(MouseEventArgs e) - { - ContextClick?.Invoke(_target, e); - } - + protected virtual void OnContextClick(MouseEventArgs e) => ContextClick?.Invoke(_target, e); + /// /// Raises the NeedPaint event. /// diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/RibbonTabsController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/RibbonTabsController.cs index f5143849c..a794116ec 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/RibbonTabsController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/RibbonTabsController.cs @@ -131,10 +131,7 @@ public virtual void DoubleClick(Point pt) /// Raises the ContextClick event. /// /// A MouseEventArgs containing the event data. - protected virtual void OnContextClick(MouseEventArgs e) - { - ContextClick?.Invoke(this, e); - } + protected virtual void OnContextClick(MouseEventArgs e) => ContextClick?.Invoke(this, e); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/RichTextBoxController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/RichTextBoxController.cs index 038971a39..2744c26e1 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/RichTextBoxController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/RichTextBoxController.cs @@ -56,8 +56,7 @@ public RichTextBoxController([DisallowNull] KryptonRibbon ribbon, /// Reference to the source control instance. public void GotFocus(Control c) { - if ((_richTextBox.LastRichTextBox?.RichTextBox != null) - && _richTextBox.LastRichTextBox.RichTextBox.CanFocus) + if (_richTextBox.LastRichTextBox?.RichTextBox is { CanFocus: true }) { _ribbon.LostFocusLosesKeyboard = false; _richTextBox.LastRichTextBox.RichTextBox.Focus(); diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/TextBoxController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/TextBoxController.cs index bde000480..899793245 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/TextBoxController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/TextBoxController.cs @@ -56,8 +56,7 @@ public TextBoxController([DisallowNull] KryptonRibbon ribbon, /// Reference to the source control instance. public void GotFocus(Control c) { - if ((_textBox.LastTextBox?.TextBox != null) - && _textBox.LastTextBox.TextBox.CanFocus) + if (_textBox.LastTextBox?.TextBox is { CanFocus: true }) { _ribbon.LostFocusLosesKeyboard = false; _textBox.LastTextBox.TextBox.Focus(); diff --git a/Source/Krypton Components/Krypton.Ribbon/Controller/ViewHighlightController.cs b/Source/Krypton Components/Krypton.Ribbon/Controller/ViewHighlightController.cs index ef8b52057..92948d1f3 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controller/ViewHighlightController.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controller/ViewHighlightController.cs @@ -180,19 +180,13 @@ public NeedPaintHandler? NeedPaint /// /// Fires the NeedPaint event. /// - public void PerformNeedPaint() - { - OnNeedPaint(false); - } + public void PerformNeedPaint() => OnNeedPaint(false); /// /// Fires the NeedPaint event. /// /// Does the palette change require a layout. - public void PerformNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout); - } + public void PerformNeedPaint(bool needLayout) => OnNeedPaint(needLayout); #endregion #region Protected @@ -235,28 +229,19 @@ protected void UpdateTargetState(Point pt) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, Target.ClientRectangle)); - } + protected virtual void OnNeedPaint(bool needLayout) => _needPaint?.Invoke(this, new NeedLayoutEventArgs(needLayout, Target.ClientRectangle)); /// /// Raises the Click event. /// /// An EventArgs containing the event data. - protected virtual void OnClick(EventArgs e) - { - Click?.Invoke(this, e); - } + protected virtual void OnClick(EventArgs e) => Click?.Invoke(this, e); /// /// Raises the Click event. /// /// A MouseEventArgs containing the event data. - protected virtual void OnContextClick(MouseEventArgs e) - { - ContextClick?.Invoke(this, e); - } + protected virtual void OnContextClick(MouseEventArgs e) => ContextClick?.Invoke(this, e); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonGallery.cs b/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonGallery.cs index f31a0fe25..919c851a7 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonGallery.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonGallery.cs @@ -416,10 +416,7 @@ public int SelectedIndex /// /// Bring the selected index into view. /// - public void BringIntoView() - { - BringIntoView(SelectedIndex); - } + public void BringIntoView() => BringIntoView(SelectedIndex); /// /// Bring the specified image index into view. @@ -441,10 +438,7 @@ public void BringIntoView(int index) /// Sets the fixed state of the control. /// /// Should the control be fixed as active. - public void SetFixedState(bool active) - { - _fixedActive = active; - } + public void SetFixedState(bool active) => _fixedActive = active; /// /// Gets a value indicating if the input control is active. @@ -473,19 +467,13 @@ public bool IsActive /// Raises the ImageListChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnImageListChanged(EventArgs e) - { - ImageListChanged?.Invoke(this, e); - } + protected virtual void OnImageListChanged(EventArgs e) => ImageListChanged?.Invoke(this, e); /// /// Raises the SelectedIndexChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnSelectedIndexChanged(EventArgs e) - { - SelectedIndexChanged?.Invoke(this, e); - } + protected virtual void OnSelectedIndexChanged(EventArgs e) => SelectedIndexChanged?.Invoke(this, e); /// /// Raises the SelectedIndexChanged event. @@ -501,10 +489,7 @@ protected virtual void OnTrackingImage(ImageSelectEventArgs e) /// Raises the GalleryDropMenu event. /// /// An GalleryDropMenuEventArgs containing the event data. - protected virtual void OnGalleryDropMenu(GalleryDropMenuEventArgs e) - { - GalleryDropMenu?.Invoke(this, e); - } + protected virtual void OnGalleryDropMenu(GalleryDropMenuEventArgs e) => GalleryDropMenu?.Invoke(this, e); #endregion #region Protected Overrides @@ -751,12 +736,10 @@ internal Component DesignerComponentFromPoint(Point pt) => IsDisposed ? null : ViewManager.ComponentFromPoint(pt); // Ask the current view for a decision - internal void DesignerMouseLeave() - { + internal void DesignerMouseLeave() => // Simulate the mouse leaving the control so that the tracking // element that thinks it has the focus is informed it does not OnMouseLeave(EventArgs.Empty); - } internal Size InternalPreferredItemSize { @@ -764,16 +747,13 @@ internal Size InternalPreferredItemSize set => _preferredItemSize = value; } - internal KryptonRibbon Ribbon { get; set; } + internal KryptonRibbon? Ribbon { get; set; } - internal void OnDropButton() - { - ShownGalleryDropDown(RectangleToScreen(ClientRectangle), + internal void OnDropButton() => ShownGalleryDropDown(RectangleToScreen(ClientRectangle), KryptonContextMenuPositionH.Left, KryptonContextMenuPositionV.Top, null, _drawItems.ActualLineItems); - } internal void ShownGalleryDropDown(Rectangle screenRect, KryptonContextMenuPositionH hPosition, @@ -787,7 +767,7 @@ internal void ShownGalleryDropDown(Rectangle screenRect, // Number of line items equals the number actually used var lineItems = Math.Max(DropMinItemWidth, Math.Min(DropMaxItemWidth, actualLineItems)); - // If there are no ranges defined, just add a single entry showing all enties + // If there are no ranges defined, just add a single entry showing all entries if (DropButtonRanges.Count == 0) { var imageSelect = new KryptonContextMenuImageSelect @@ -873,15 +853,15 @@ private void OnDropMenuClosed(object sender, ToolStripDropDownClosedEventArgs e) TrackingIndex = -1; // Unhook from events - _dropMenu.Closed -= OnDropMenuClosed!; + _dropMenu.Closed -= OnDropMenuClosed; // Unhook from the image select events foreach (KryptonContextMenuItemBase item in _dropMenu.Items) { if (item is KryptonContextMenuImageSelect itemSelect) { - itemSelect.SelectedIndexChanged -= OnDropImageSelect!; - itemSelect.TrackingImage -= OnDropImageTracking!; + itemSelect.SelectedIndexChanged -= OnDropImageSelect; + itemSelect.TrackingImage -= OnDropImageTracking; } } @@ -903,15 +883,13 @@ private void OnDropMenuClosed(object sender, ToolStripDropDownClosedEventArgs e) #region Implementation private void OnDropImageSelect(object sender, EventArgs e) { - KryptonContextMenuImageSelect imageSelect = (KryptonContextMenuImageSelect)sender; + var imageSelect = (KryptonContextMenuImageSelect)sender; SelectedIndex = imageSelect.SelectedIndex; } - private void OnDropImageTracking(object sender, ImageSelectEventArgs e) - { + private void OnDropImageTracking(object sender, ImageSelectEventArgs e) => //KryptonContextMenuImageSelect imageSelect = (KryptonContextMenuImageSelect)sender; TrackingIndex = e.ImageIndex; - } private void UpdateStateAndPalettes() { diff --git a/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonGalleryRange.cs b/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonGalleryRange.cs index c9b48da1d..3258aff51 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonGalleryRange.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonGalleryRange.cs @@ -121,10 +121,7 @@ public int ImageIndexEnd /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbon.cs b/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbon.cs index 4cdddd79d..1ab9de8c7 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbon.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbon.cs @@ -651,11 +651,9 @@ public KryptonRibbonTab? SelectedTab /// /// Reset the SelectedTab to the default value. /// - public void ResetSelectedTab() - { + public void ResetSelectedTab() => // Update selection to match ribbon settings ValidateSelectedTab(); - } /// /// Gets and sets the common separated list of selected context names. @@ -690,10 +688,7 @@ public string SelectedContext /// /// Reset the SelectedContext to the default value. /// - private void ResetSelectedContext() - { - SelectedContext = string.Empty; - } + private void ResetSelectedContext() => SelectedContext = string.Empty; /// /// Gets the collection of ribbon context definitions. @@ -777,10 +772,7 @@ public Size HideRibbonSize /// /// Reset the HideRibbonSize to the default value. /// - private void ResetHideRibbonSize() - { - HideRibbonSize = new Size(300, 250); - } + private void ResetHideRibbonSize() => HideRibbonSize = new Size(300, 250); /// /// Gets and sets a value indicating if the ribbon is in minimized mode. @@ -884,10 +876,7 @@ public bool MinimizedMode /// /// Resets the MinimizedMode property to its default value. /// - public void ResetMinimizedMode() - { - MinimizedMode = false; - } + public void ResetMinimizedMode() => MinimizedMode = false; /// /// Gets and sets the display method for the quick access toolbar. @@ -927,10 +916,7 @@ public QATLocation QATLocation /// /// Resets the QATLocation property to its default value. /// - public void ResetQATLocation() - { - QATLocation = QATLocation.Above; - } + public void ResetQATLocation() => QATLocation = QATLocation.Above; /// /// Gets and sets a value indicating if user is allowed to change the QAT entries. @@ -943,10 +929,7 @@ public void ResetQATLocation() /// /// Resets the QATUserChange property to its default value. /// - public void ResetQATUserChange() - { - QATUserChange = true; - } + public void ResetQATUserChange() => QATUserChange = true; /// /// Gets and sets a value indicating if a minimize/expand button appears on the ribbon tab ara. @@ -972,10 +955,7 @@ public bool ShowMinimizeButton /// /// Resets the ShowMinimizeButton property to its default value. /// - public void ResetShowMinimizeButton() - { - ShowMinimizeButton = true; - } + public void ResetShowMinimizeButton() => ShowMinimizeButton = true; /// /// Gets access to the ToolTipManager used for displaying tool tips. @@ -1118,7 +1098,7 @@ public bool PreFilterMessage(ref Message m) if (ownerForm is { Visible: true, Enabled: true, ContainsFocus: true }) { // Extract the keys being pressed - Keys keys = (Keys)(int)m.WParam.ToInt64(); + var keys = (Keys)(int)m.WParam.ToInt64(); // If the user standard combination ALT + F4 if ((keys == Keys.F4) && ((ModifierKeys & Keys.Alt) == Keys.Alt)) @@ -1199,12 +1179,10 @@ public bool DesignerGetHitTest(Point pt) /// [EditorBrowsable(EditorBrowsableState.Never)] [Browsable(false)] - public void DesignerMouseLeave() - { + public void DesignerMouseLeave() => // Simulate the mouse leaving the control so that the tracking // element that thinks it has the focus is informed it does not OnMouseLeave(EventArgs.Empty); - } /// /// Internal design time method. @@ -1805,10 +1783,7 @@ protected virtual void OnSelectedTabChanged(EventArgs e) /// Raises the AppButtonMenuClosing event. /// /// A CancelEventArgs containing the event data. - protected internal virtual void OnAppButtonMenuClosing(CancelEventArgs e) - { - AppButtonMenuClosing?.Invoke(this, e); - } + protected internal virtual void OnAppButtonMenuClosing(CancelEventArgs e) => AppButtonMenuClosing?.Invoke(this, e); /// /// Raises the AppButtonMenuClosed event. @@ -1827,10 +1802,7 @@ protected internal virtual void OnAppButtonMenuClosing(CancelEventArgs e) #region Internal internal bool IgnoreDoubleClickClose { get; set; } - internal void OnDesignTimeAddTab() - { - DesignTimeAddTab?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddTab() => DesignTimeAddTab?.Invoke(this, EventArgs.Empty); internal bool RealMinimizedMode => MinimizedMode && !InDesignMode; @@ -2003,10 +1975,7 @@ internal Rectangle ClientRectangleWithoutComposition } } - internal void TestForAppButtonDoubleClick() - { - TabsArea.TestForAppButtonDoubleClick(); - } + internal void TestForAppButtonDoubleClick() => TabsArea.TestForAppButtonDoubleClick(); internal void HideFocus(Control c) { @@ -2151,7 +2120,7 @@ internal void DisplayQATCustomizeMenu(Rectangle screenRectangle, OnShowQATCustomizeMenu(args); // If not cancelled, then show it - if (args is { Cancel: false, KryptonContextMenu: { } } && CommonHelper.ValidKryptonContextMenu(_kcm)) + if (args is { Cancel: false, KryptonContextMenu: not null } && CommonHelper.ValidKryptonContextMenu(_kcm)) { // Cache the finish delegate to call when the menu is closed _kcmFinishDelegate = finishDelegate; @@ -2222,7 +2191,7 @@ internal void DisplayRibbonContextMenu(MouseEventArgs e) OnShowRibbonContextMenu(args); // If not cancelled, then show it - if (args is { Cancel: false, KryptonContextMenu: { } } && CommonHelper.ValidKryptonContextMenu(_kcm)) + if (args is { Cancel: false, KryptonContextMenu: not null } && CommonHelper.ValidKryptonContextMenu(_kcm)) { // Show at location we were provided, but need to convert to screen coordinates VisualPopupManager.Singleton.EndAllTracking(); @@ -2432,10 +2401,7 @@ internal void ActionOccurred() KillKeyboardMode(); } - internal void UpdateQAT() - { - CaptionArea?.UpdateQAT(); - } + internal void UpdateQAT() => CaptionArea?.UpdateQAT(); internal KeyTipMode KeyTipMode { @@ -2709,10 +2675,7 @@ private void CreateRibbonCollections() QATButtons.Removed += OnRibbonQATButtonsRemoved; } - private void CreateButtonSpecs() - { - ButtonSpecs = new RibbonButtonSpecAnyCollection(this); - } + private void CreateButtonSpecs() => ButtonSpecs = new RibbonButtonSpecAnyCollection(this); private void CreateStorageObjects() { @@ -3065,11 +3028,9 @@ private void OnRibbonContextsRemoved(object sender, TypedCollectionEventArgs // Layout to show the context change PerformNeedPaint(true); - } private void OnRibbonTabsClearing(object sender, EventArgs e) { @@ -3168,7 +3129,7 @@ private void OnRibbonQATButtonsCleared(object sender, EventArgs e) private void OnRibbonQATButtonsInserted(object sender, TypedCollectionEventArgs e) { - IQuickAccessToolbarButton? qatButton = e.Item as IQuickAccessToolbarButton; + var qatButton = e.Item as IQuickAccessToolbarButton; Debug.Assert(qatButton != null); // Setup the back reference from tab to ribbon control @@ -3188,7 +3149,7 @@ private void OnRibbonQATButtonsInserted(object sender, TypedCollectionEventArgs< private void OnRibbonQATButtonsRemoved(object sender, TypedCollectionEventArgs e) { - IQuickAccessToolbarButton? qatButton = e.Item as IQuickAccessToolbarButton; + var qatButton = e.Item as IQuickAccessToolbarButton; Debug.Assert(qatButton != null); // Stop tracking changes in button properties @@ -3269,11 +3230,9 @@ private void ShowMinimizedPopup() _minimizedPopup.Show(TabsArea, _drawMinimizedPanel); } - private void UpdateMinimizedPopup() - { + private void UpdateMinimizedPopup() => // Update the screen location of popup to reflect a change in selected tab _minimizedPopup?.Show(TabsArea, _drawMinimizedPanel); - } private void OnMinimizedPopupDisposed(object sender, EventArgs e) { @@ -3297,7 +3256,7 @@ private void OnQATCustomizeClick(object sender, EventArgs e) KillKeyboardMode(); // Cast to correct type - KryptonContextMenuItem menuItem = (KryptonContextMenuItem)sender; + var menuItem = (KryptonContextMenuItem)sender; // Find index of the item to toggle var index = (int)(menuItem.Tag ?? -1); @@ -3306,7 +3265,7 @@ private void OnQATCustomizeClick(object sender, EventArgs e) if ((index >= 0) && (index < QATButtons.Count)) { // Get access to the indexed entry - IQuickAccessToolbarButton qatButton = (IQuickAccessToolbarButton)QATButtons[index]; + var qatButton = (IQuickAccessToolbarButton)QATButtons[index]; // Invert the visible state qatButton.SetVisible(!qatButton.GetVisible()); @@ -3340,10 +3299,7 @@ private void OnKryptonContextMenuClosed(object sender, EventArgs e) } } - private void OnTabsAreaPaintBackground(object sender, PaintEventArgs e) - { - MainPanel.PaintRectangle(e.Graphics, e.ClipRectangle, false, sender as Control); - } + private void OnTabsAreaPaintBackground(object sender, PaintEventArgs e) => MainPanel.PaintRectangle(e.Graphics, e.ClipRectangle, false, sender as Control); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbonContext.cs b/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbonContext.cs index 01bc6ad17..06ea3c4d6 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbonContext.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbonContext.cs @@ -158,10 +158,7 @@ public object Tag private bool ShouldSerializeTag() => Tag != null; - private void ResetTag() - { - Tag = null; - } + private void ResetTag() => Tag = null; #endregion #region Protected @@ -169,10 +166,7 @@ private void ResetTag() /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbonGroup.cs b/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbonGroup.cs index 2d9c7219b..c99aee91a 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbonGroup.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbonGroup.cs @@ -335,18 +335,12 @@ public bool Visible /// /// Make the ribbon group visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon group hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the display of a dialog box launcher button. @@ -466,10 +460,7 @@ public object? Tag private bool ShouldSerializeTag() => Tag != null; - private void ResetTag() - { - Tag = null; - } + private void ResetTag() => Tag = null; /// /// Internal design time properties. diff --git a/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbonQATButton.cs b/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbonQATButton.cs index fd2dd1544..c1fc70049 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbonQATButton.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbonQATButton.cs @@ -151,18 +151,12 @@ public bool Visible /// /// Make the ribbon tab visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon tab hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the enabled state of the ribbon quick access toolbar entry. @@ -233,10 +227,7 @@ public string Text /// /// Resets the ShortcutKeys property to its default value. /// - public void ResetShortcutKeys() - { - ShortcutKeys = Keys.None; - } + public void ResetShortcutKeys() => ShortcutKeys = Keys.None; /// /// Gets and sets the tooltip label style for the quick access button. @@ -299,10 +290,7 @@ public void ResetShortcutKeys() private bool ShouldSerializeToolTipShadow() => !ToolTipShadow; - private void ResetToolTipShadow() - { - ToolTipShadow = true; - } + private void ResetToolTipShadow() => ToolTipShadow = true; #endregion /// @@ -364,10 +352,7 @@ public object Tag private bool ShouldSerializeTag() => Tag != null; - private void ResetTag() - { - Tag = null; - } + private void ResetTag() => Tag = null; #endregion #region IQuickAccessToolbarButton @@ -376,10 +361,7 @@ private void ResetTag() /// /// Reference to owning instance. [EditorBrowsable(EditorBrowsableState.Advanced)] - public void SetRibbon(KryptonRibbon? ribbon) - { - Ribbon = ribbon; - } + public void SetRibbon(KryptonRibbon? ribbon) => Ribbon = ribbon; /// /// Gets the entry image. @@ -421,10 +403,7 @@ public void SetRibbon(KryptonRibbon? ribbon) /// /// [EditorBrowsable(EditorBrowsableState.Advanced)] - public void SetVisible(bool visible) - { - Visible = visible; - } + public void SetVisible(bool visible) => Visible = visible; /// /// Gets the tooltip label style. @@ -463,10 +442,7 @@ public void SetVisible(bool visible) /// /// Generates a Click event for a button. /// - public void PerformClick() - { - OnClick(EventArgs.Empty); - } + public void PerformClick() => OnClick(EventArgs.Empty); #endregion #region Protected @@ -525,10 +501,7 @@ protected virtual void OnClick(EventArgs e) /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion } diff --git a/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbonRecentDoc.cs b/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbonRecentDoc.cs index 0fcba4a9f..28128bd5e 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbonRecentDoc.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbonRecentDoc.cs @@ -170,18 +170,12 @@ public object Tag private bool ShouldSerializeTag() => Tag != null; - private void ResetTag() - { - Tag = null; - } + private void ResetTag() => Tag = null; /// /// Generates a Click event for the component. /// - public void PerformClick() - { - OnClick(EventArgs.Empty); - } + public void PerformClick() => OnClick(EventArgs.Empty); #endregion #region Protected @@ -189,10 +183,7 @@ public void PerformClick() /// Raises the Click event. /// /// An EventArgs that contains the event data. - protected virtual void OnClick(EventArgs e) - { - Click?.Invoke(this, e); - } + protected virtual void OnClick(EventArgs e) => Click?.Invoke(this, e); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbonTab.cs b/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbonTab.cs index b5716e279..e3dc58747 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbonTab.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controls Ribbon/KryptonRibbonTab.cs @@ -214,10 +214,7 @@ public string ContextName /// /// Reset the ContextName to the default value. /// - private void ResetContextName() - { - ContextName = string.Empty; - } + private void ResetContextName() => ContextName = string.Empty; /// /// Gets and sets the visible state of the ribbon tab. @@ -255,18 +252,12 @@ public bool Visible /// /// Make the ribbon tab visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon tab hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets the collection of ribbon tab groups. @@ -300,10 +291,7 @@ public object? Tag private bool ShouldSerializeTag() => Tag != null; - private void ResetTag() - { - Tag = null; - } + private void ResetTag() => Tag = null; /// /// Internal design time properties. @@ -320,22 +308,13 @@ private void ResetTag() /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Internal - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); - internal void OnDesignTimeAddGroup() - { - DesignTimeAddGroup?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddGroup() => DesignTimeAddGroup?.Invoke(this, EventArgs.Empty); internal bool ProcessCmdKey(ref Message msg, Keys keyData) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Controls Visuals/KeyTipControl.cs b/Source/Krypton Components/Krypton.Ribbon/Controls Visuals/KeyTipControl.cs index cadf5b0b4..8bc227f84 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controls Visuals/KeyTipControl.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controls Visuals/KeyTipControl.cs @@ -70,7 +70,7 @@ public void SetKeyTips(KeyTipInfoList keyTips) // Create a new list of key tip views _viewList = new List(); - Rectangle enclosingRect = Rectangle.Empty; + var enclosingRect = Rectangle.Empty; // Create a view per key tip definition foreach (KeyTipInfo keyTip in keyTips) @@ -206,11 +206,9 @@ protected override CreateParams CreateParams /// Raises the PaintBackground event. /// /// An PaintEventArgs containing the event data. - protected override void OnPaintBackground(PaintEventArgs pevent) - { + protected override void OnPaintBackground(PaintEventArgs pevent) => // Magenta is the transparent color pevent.Graphics.FillRectangle(Brushes.Magenta, pevent.ClipRectangle); - } /// /// Raises the Paint event. diff --git a/Source/Krypton Components/Krypton.Ribbon/Controls Visuals/VisualPopupAppMenu.cs b/Source/Krypton Components/Krypton.Ribbon/Controls Visuals/VisualPopupAppMenu.cs index d5984eca9..430a566bb 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controls Visuals/VisualPopupAppMenu.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controls Visuals/VisualPopupAppMenu.cs @@ -96,11 +96,9 @@ public VisualPopupAppMenu(KryptonRibbon ribbon, } } - private void CreateButtonSpecView() - { + private void CreateButtonSpecView() => // Layout docker used to contain the generated button specs _viewButtonSpecDocker = new ViewLayoutDocker(); - } private void CreateContextMenuView(RibbonAppButton appButton) { @@ -176,9 +174,7 @@ private ViewDrawCanvas CreateInsideCanvas() return mainBackground; } - private void CreateInnerBacking(ViewBase fillElement) - { - _drawInnerBacking = new ViewDrawRibbonAppMenuInner(_ribbon) + private void CreateInnerBacking(ViewBase fillElement) => _drawInnerBacking = new ViewDrawRibbonAppMenuInner(_ribbon) { { new ViewLayoutSeparator(2), ViewDockStyle.Top }, { new ViewLayoutSeparator(2), ViewDockStyle.Bottom }, @@ -186,11 +182,8 @@ private void CreateInnerBacking(ViewBase fillElement) { new ViewLayoutSeparator(2), ViewDockStyle.Right }, { fillElement, ViewDockStyle.Fill } }; - } - private void CreateOuterBacking() - { - _drawOutsideBacking = new ViewDrawRibbonAppMenuOuter(_ribbon) + private void CreateOuterBacking() => _drawOutsideBacking = new ViewDrawRibbonAppMenuOuter(_ribbon) { { _drawInnerBacking, ViewDockStyle.Fill }, { new ViewLayoutSeparator( _rectAppButtonBottomHalf.Height-2), ViewDockStyle.Top }, @@ -200,16 +193,12 @@ private void CreateOuterBacking() { _viewButtonSpecDocker, ViewDockStyle.Bottom }, { new ViewLayoutSeparator(2), ViewDockStyle.Bottom } }; - } - private void CreateAppButtonBottom() + private void CreateAppButtonBottom() => _appButtonBottom = new ViewDrawRibbonAppButton(_ribbon, true) { - _appButtonBottom = new ViewDrawRibbonAppButton(_ribbon, true) - { - ElementState = PaletteState.Pressed, - Visible = _ribbon.RibbonShape != PaletteRibbonShape.Office2010 - }; - } + ElementState = PaletteState.Pressed, + Visible = _ribbon.RibbonShape != PaletteRibbonShape.Office2010 + }; private void CreateOutsideDocker() { @@ -287,7 +276,7 @@ public override void Show(Rectangle screenRect) preferredSize.Width = Math.Min(workingArea.Width, preferredSize.Width); preferredSize.Height = Math.Min(workingArea.Height, preferredSize.Height); - Point screenPt = Point.Empty; + var screenPt = Point.Empty; // Find the horizontal position relative to screen rectangle screenPt.X = screenRect.Left; @@ -470,11 +459,9 @@ protected override void OnLayout(LayoutEventArgs levent) /// /// Source of notification. /// An NeedLayoutEventArgs containing event data. - protected virtual void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) - { + protected virtual void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) => // Need to recalculate anything relying on the palette OnNeedPaint(sender, e); - } #endregion #region Implementation @@ -527,32 +514,22 @@ private void SetPalette(PaletteBase? palette) } } - private void OnBaseChanged(object sender, EventArgs e) - { + private void OnBaseChanged(object sender, EventArgs e) => // Change in base renderer or base palette require we fetch the latest renderer Renderer = _palette.GetRenderer(); - } - private void OnButtonSpecPaint(object sender, NeedLayoutEventArgs e) - { - OnNeedPaint(sender, new NeedLayoutEventArgs(false)); - } + private void OnButtonSpecPaint(object sender, NeedLayoutEventArgs e) => OnNeedPaint(sender, new NeedLayoutEventArgs(false)); - private void OnProviderClosing(object sender, CancelEventArgs e) - { - _ribbon?.OnAppButtonMenuClosing(e); - } + private void OnProviderClosing(object sender, CancelEventArgs e) => _ribbon?.OnAppButtonMenuClosing(e); - private void OnProviderClose(object sender, CloseReasonEventArgs e) - { + private void OnProviderClose(object sender, CloseReasonEventArgs e) => // Remove ourself from being shown VisualPopupManager.Singleton.EndPopupTracking(this); - } private void OnProviderClose(object sender, EventArgs e) { // Unhook from event source - IContextMenuProvider provider = (IContextMenuProvider)sender; + var provider = (IContextMenuProvider)sender; _provider.Dispose -= OnProviderClose!; // Kill this poup window diff --git a/Source/Krypton Components/Krypton.Ribbon/Controls Visuals/VisualPopupGroup.cs b/Source/Krypton Components/Krypton.Ribbon/Controls Visuals/VisualPopupGroup.cs index fc2cf4825..974a12bd8 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controls Visuals/VisualPopupGroup.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controls Visuals/VisualPopupGroup.cs @@ -246,10 +246,7 @@ public void ShowCalculatingSize(ViewDrawRibbonGroup parentGroup, /// /// Hide focus by giving it to the hidden control. /// - public void HideFocus() - { - _hiddenFocusTarget.Focus(); - } + public void HideFocus() => _hiddenFocusTarget.Focus(); #endregion #region Implementation diff --git a/Source/Krypton Components/Krypton.Ribbon/Controls Visuals/VisualPopupMinimized.cs b/Source/Krypton Components/Krypton.Ribbon/Controls Visuals/VisualPopupMinimized.cs index 612420288..ebd99396d 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controls Visuals/VisualPopupMinimized.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controls Visuals/VisualPopupMinimized.cs @@ -212,12 +212,10 @@ public override bool AllowMouseMove(Message m, Point pt) /// /// Tabs area of the /// - public void Show(ViewLayoutRibbonTabsArea tabsArea, - ViewDrawPanel drawMinimizedPanel) - { + public void Show(ViewLayoutRibbonTabsArea tabsArea, + ViewDrawPanel drawMinimizedPanel) => // Show at the calculated position Show(CalculatePopupRect(tabsArea, drawMinimizedPanel)); - } /// /// Update the displayed position to reflect a change in selected tab. diff --git a/Source/Krypton Components/Krypton.Ribbon/Controls Visuals/VisualPopupQATOverflow.cs b/Source/Krypton Components/Krypton.Ribbon/Controls Visuals/VisualPopupQATOverflow.cs index 63b3c91ca..563f11850 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Controls Visuals/VisualPopupQATOverflow.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Controls Visuals/VisualPopupQATOverflow.cs @@ -61,7 +61,7 @@ protected override void Dispose(bool disposing) if (disposing) { // Ensure the manager believes the mouse has left the area - ViewManager.MouseLeave(EventArgs.Empty); + ViewManager?.MouseLeave(EventArgs.Empty); // Remove all child controls so they do not become disposed for (var i = Controls.Count - 1; i >= 0; i--) @@ -128,7 +128,7 @@ public void SetLastFocusItem() public void SetNextFocusItem() { // Find the next item in sequence - ViewBase view = ViewQATContents.GetNextQATView(ViewOverflowManager.FocusView); + ViewBase? view = ViewQATContents.GetNextQATView(ViewOverflowManager.FocusView); // Rotate around to the first item if (view == null) @@ -208,7 +208,7 @@ protected override CreateParams CreateParams /// An EventArgs that contains the event data. protected override void OnLayout(LayoutEventArgs levent) { - // Let base class calulcate fill rectangle + // Let base class calculate fill rectangle base.OnLayout(levent); var borderRounding = _ribbon.RibbonShape switch { diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonGroupClusterCollectionEditor.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonGroupClusterCollectionEditor.cs index 3eae1d032..0cc24a41b 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonGroupClusterCollectionEditor.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonGroupClusterCollectionEditor.cs @@ -28,10 +28,7 @@ public KryptonRibbonGroupClusterCollectionEditor() /// Gets the data types that this collection editor can contain. /// /// An array of data types that this collection can contain. - protected override Type[] CreateNewItemTypes() - { - return new[] { typeof(KryptonRibbonGroupClusterButton), + protected override Type[] CreateNewItemTypes() => new[] { typeof(KryptonRibbonGroupClusterButton), typeof(KryptonRibbonGroupClusterColorButton)}; - } } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonGroupContainerCollectionEditor.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonGroupContainerCollectionEditor.cs index a15ddef19..f57ecb7d7 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonGroupContainerCollectionEditor.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonGroupContainerCollectionEditor.cs @@ -26,13 +26,11 @@ public KryptonRibbonGroupContainerCollectionEditor() /// Gets the data types that this collection editor can contain. /// /// An array of data types that this collection can contain. - protected override Type[] CreateNewItemTypes() - { + protected override Type[] CreateNewItemTypes() => // Bug https://github.com/Krypton-Suite/Standard-Toolkit/issues/66 // For some reason in .Net5 onwards, the following function is not called - return new[] { typeof(KryptonRibbonGroupLines), + new[] { typeof(KryptonRibbonGroupLines), typeof(KryptonRibbonGroupTriple), typeof(KryptonRibbonGroupSeparator) }; - } } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonGroupLinesCollectionEditor.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonGroupLinesCollectionEditor.cs index 17fc24a1a..13cf85aab 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonGroupLinesCollectionEditor.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonGroupLinesCollectionEditor.cs @@ -28,9 +28,7 @@ public KryptonRibbonGroupLinesCollectionEditor() /// Gets the data types that this collection editor can contain. /// /// An array of data types that this collection can contain. - protected override Type[] CreateNewItemTypes() - { - return new[] { typeof(KryptonRibbonGroupButton), + protected override Type[] CreateNewItemTypes() => new[] { typeof(KryptonRibbonGroupButton), typeof(KryptonRibbonGroupColorButton), typeof(KryptonRibbonGroupCheckBox), typeof(KryptonRibbonGroupComboBox), @@ -44,6 +42,5 @@ protected override Type[] CreateNewItemTypes() typeof(KryptonRibbonGroupRichTextBox), typeof(KryptonRibbonGroupTextBox), typeof(KryptonRibbonGroupTrackBar)}; - } } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonGroupTripleCollectionEditor.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonGroupTripleCollectionEditor.cs index a4f7ceded..2b350434a 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonGroupTripleCollectionEditor.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonGroupTripleCollectionEditor.cs @@ -28,9 +28,7 @@ public KryptonRibbonGroupTripleCollectionEditor() /// Gets the data types that this collection editor can contain. /// /// An array of data types that this collection can contain. - protected override Type[] CreateNewItemTypes() - { - return new[] { typeof(KryptonRibbonGroupButton), + protected override Type[] CreateNewItemTypes() => new[] { typeof(KryptonRibbonGroupButton), typeof(KryptonRibbonGroupColorButton), typeof(KryptonRibbonGroupCheckBox), typeof(KryptonRibbonGroupComboBox), @@ -44,6 +42,5 @@ protected override Type[] CreateNewItemTypes() typeof(KryptonRibbonGroupRichTextBox), typeof(KryptonRibbonGroupTextBox), typeof(KryptonRibbonGroupTrackBar)}; - } } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonQATButtonCollectionEditor.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonQATButtonCollectionEditor.cs index 86029b637..fadd307f1 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonQATButtonCollectionEditor.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonQATButtonCollectionEditor.cs @@ -28,10 +28,7 @@ public KryptonRibbonQATButtonCollectionEditor() /// Gets the data types that this collection editor can contain. /// /// An array of data types that this collection can contain. - protected override Type[] CreateNewItemTypes() - { - return new[] { typeof(KryptonRibbonQATButton) }; - } + protected override Type[] CreateNewItemTypes() => new[] { typeof(KryptonRibbonQATButton) }; /// /// Sets the specified array as the items of the collection. @@ -42,7 +39,7 @@ protected override Type[] CreateNewItemTypes() protected override object SetItems(object editValue, object[] value) { // Cast the context into the expected control type - KryptonRibbon ribbon = (KryptonRibbon)Context.Instance; + var ribbon = (KryptonRibbon)Context.Instance; // Suspend changes until collection has been updated ribbon?.SuspendLayout(); diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonRecentDocCollectionEditor.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonRecentDocCollectionEditor.cs index c9242990e..e3fa9d5b6 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonRecentDocCollectionEditor.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Collection Editors/KryptonRibbonRecentDocCollectionEditor.cs @@ -28,9 +28,6 @@ public KryptonRibbonRecentDocCollectionEditor() /// Gets the data types that this collection editor can contain. /// /// An array of data types that this collection can contain. - protected override Type[] CreateNewItemTypes() - { - return new[] { typeof(KryptonRibbonRecentDoc) }; - } + protected override Type[] CreateNewItemTypes() => new[] { typeof(KryptonRibbonRecentDoc) }; } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonGalleryDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonGalleryDesigner.cs index aeed77771..977db15fe 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonGalleryDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonGalleryDesigner.cs @@ -130,7 +130,7 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) if (e.Component == _gallery) { // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all the range instances for (var i = _gallery.DropButtonRanges.Count - 1; i >= 0; i--) diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonDesigner.cs index 1879dbfa1..b878d053c 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonDesigner.cs @@ -215,28 +215,19 @@ protected override void OnMouseLeave() /// Called when a drag-and-drop operation enters the control designer view. /// /// A DragEventArgs that provides data for the event. - protected override void OnDragEnter(DragEventArgs de) - { - de.Effect = DragDropEffects.None; - } + protected override void OnDragEnter(DragEventArgs de) => de.Effect = DragDropEffects.None; /// /// Called when a drag-and-drop object is dragged over the control designer view. /// /// A DragEventArgs that provides data for the event. - protected override void OnDragOver(DragEventArgs de) - { - de.Effect = DragDropEffects.None; - } + protected override void OnDragOver(DragEventArgs de) => de.Effect = DragDropEffects.None; /// /// Called when a drag-and-drop object is dropped onto the control designer view. /// /// A DragEventArgs that provides data for the event. - protected override void OnDragDrop(DragEventArgs de) - { - de.Effect = DragDropEffects.None; - } + protected override void OnDragDrop(DragEventArgs de) => de.Effect = DragDropEffects.None; #endregion #region Implementation @@ -256,11 +247,9 @@ private void UpdateVerbStatus() } } - private void OnToggleHelpers(object sender, EventArgs e) - { + private void OnToggleHelpers(object sender, EventArgs e) => // Invert the current toggle helper mode _ribbon.InDesignHelperMode = !_ribbon.InDesignHelperMode; - } private void OnAddTab(object sender, EventArgs e) { @@ -275,7 +264,7 @@ private void OnAddTab(object sender, EventArgs e) RaiseComponentChanging(propertyPages); // Get designer to create the new tab component - KryptonRibbonTab page = (KryptonRibbonTab)_designerHost.CreateComponent(typeof(KryptonRibbonTab)); + var page = (KryptonRibbonTab)_designerHost.CreateComponent(typeof(KryptonRibbonTab)); _ribbon.RibbonTabs.Add(page); RaiseComponentChanged(propertyPages, null, null); @@ -302,7 +291,7 @@ private void OnClearTabs(object sender, EventArgs e) RaiseComponentChanging(propertyPages); // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all the tabs from the ribbon for (var i = _ribbon.RibbonTabs.Count - 1; i >= 0; i--) @@ -358,10 +347,7 @@ private void OnRibbonDoubleClick(object sender, Point pt) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnComponentRemoving(object sender, ComponentEventArgs e) { @@ -369,7 +355,7 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) if (e.Component == _ribbon) { // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all the button spec instances for (var i = _ribbon.ButtonSpecs.Count - 1; i >= 0; i--) diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupButtonDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupButtonDesigner.cs index 09f95248e..94e365514 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupButtonDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupButtonDesigner.cs @@ -394,10 +394,7 @@ private void OnTypeSplit(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnContextMenu(object sender, MouseEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupCheckBoxDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupCheckBoxDesigner.cs index 30921a3db..b76ac7bd4 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupCheckBoxDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupCheckBoxDesigner.cs @@ -373,10 +373,7 @@ private void OnChecked(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnContextMenu(object sender, MouseEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupClusterButtonDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupClusterButtonDesigner.cs index 09d35b8b4..9689723ef 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupClusterButtonDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupClusterButtonDesigner.cs @@ -142,7 +142,7 @@ private void UpdateVerbStatus() if (_ribbonButton?.Ribbon != null) { // Cast container to the correct type - KryptonRibbonGroupCluster cluster = (KryptonRibbonGroupCluster)_ribbonButton.RibbonContainer; + var cluster = (KryptonRibbonGroupCluster)_ribbonButton.RibbonContainer; moveFirst = cluster.Items.IndexOf(_ribbonButton) > 0; movePrev = cluster.Items.IndexOf(_ribbonButton) > 0; @@ -170,7 +170,7 @@ private void OnMoveFirst(object sender, EventArgs e) if (_ribbonButton?.Ribbon != null) { // Cast container to the correct type - KryptonRibbonGroupCluster cluster = (KryptonRibbonGroupCluster)_ribbonButton.RibbonContainer; + var cluster = (KryptonRibbonGroupCluster)_ribbonButton.RibbonContainer; // Use a transaction to support undo/redo actions DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonRibbonGroupClusterButton MoveFirst"); @@ -202,7 +202,7 @@ private void OnMovePrevious(object sender, EventArgs e) if (_ribbonButton?.Ribbon != null) { // Cast container to the correct type - KryptonRibbonGroupCluster cluster = (KryptonRibbonGroupCluster)_ribbonButton.RibbonContainer; + var cluster = (KryptonRibbonGroupCluster)_ribbonButton.RibbonContainer; // Use a transaction to support undo/redo actions DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonRibbonGroupClusterButton MovePrevious"); @@ -236,7 +236,7 @@ private void OnMoveNext(object sender, EventArgs e) if (_ribbonButton?.Ribbon != null) { // Cast container to the correct type - KryptonRibbonGroupCluster cluster = (KryptonRibbonGroupCluster)_ribbonButton.RibbonContainer; + var cluster = (KryptonRibbonGroupCluster)_ribbonButton.RibbonContainer; // Use a transaction to support undo/redo actions DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonRibbonGroupClusterButton MoveNext"); @@ -270,7 +270,7 @@ private void OnMoveLast(object sender, EventArgs e) if (_ribbonButton?.Ribbon != null) { // Cast container to the correct type - KryptonRibbonGroupCluster cluster = (KryptonRibbonGroupCluster)_ribbonButton.RibbonContainer; + var cluster = (KryptonRibbonGroupCluster)_ribbonButton.RibbonContainer; // Use a transaction to support undo/redo actions DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonRibbonGroupClusterButton MoveLast"); @@ -302,7 +302,7 @@ private void OnDeleteButton(object sender, EventArgs e) if (_ribbonButton?.Ribbon != null) { // Cast container to the correct type - KryptonRibbonGroupCluster cluster = (KryptonRibbonGroupCluster)_ribbonButton.RibbonContainer; + var cluster = (KryptonRibbonGroupCluster)_ribbonButton.RibbonContainer; // Use a transaction to support undo/redo actions DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonRibbonGroupClusterButton DeleteButton"); @@ -396,10 +396,7 @@ private void OnTypeSplit(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnContextMenu(object sender, MouseEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupClusterColorButtonDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupClusterColorButtonDesigner.cs index e55ad68ea..b3a76fc39 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupClusterColorButtonDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupClusterColorButtonDesigner.cs @@ -142,7 +142,7 @@ private void UpdateVerbStatus() if (_ribbonColorButton?.Ribbon != null) { // Cast container to the correct type - KryptonRibbonGroupCluster cluster = (KryptonRibbonGroupCluster)_ribbonColorButton.RibbonContainer; + var cluster = (KryptonRibbonGroupCluster)_ribbonColorButton.RibbonContainer; moveFirst = cluster.Items.IndexOf(_ribbonColorButton) > 0; movePrev = cluster.Items.IndexOf(_ribbonColorButton) > 0; @@ -170,7 +170,7 @@ private void OnMoveFirst(object sender, EventArgs e) if (_ribbonColorButton?.Ribbon != null) { // Cast container to the correct type - KryptonRibbonGroupCluster cluster = (KryptonRibbonGroupCluster)_ribbonColorButton.RibbonContainer; + var cluster = (KryptonRibbonGroupCluster)_ribbonColorButton.RibbonContainer; // Use a transaction to support undo/redo actions DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonRibbonGroupColorClusterButton MoveFirst"); @@ -202,7 +202,7 @@ private void OnMovePrevious(object sender, EventArgs e) if (_ribbonColorButton?.Ribbon != null) { // Cast container to the correct type - KryptonRibbonGroupCluster cluster = (KryptonRibbonGroupCluster)_ribbonColorButton.RibbonContainer; + var cluster = (KryptonRibbonGroupCluster)_ribbonColorButton.RibbonContainer; // Use a transaction to support undo/redo actions DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonRibbonGroupColorClusterButton MovePrevious"); @@ -236,7 +236,7 @@ private void OnMoveNext(object sender, EventArgs e) if (_ribbonColorButton?.Ribbon != null) { // Cast container to the correct type - KryptonRibbonGroupCluster cluster = (KryptonRibbonGroupCluster)_ribbonColorButton.RibbonContainer; + var cluster = (KryptonRibbonGroupCluster)_ribbonColorButton.RibbonContainer; // Use a transaction to support undo/redo actions DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonRibbonGroupColorClusterButton MoveNext"); @@ -270,7 +270,7 @@ private void OnMoveLast(object sender, EventArgs e) if (_ribbonColorButton?.Ribbon != null) { // Cast container to the correct type - KryptonRibbonGroupCluster cluster = (KryptonRibbonGroupCluster)_ribbonColorButton.RibbonContainer; + var cluster = (KryptonRibbonGroupCluster)_ribbonColorButton.RibbonContainer; // Use a transaction to support undo/redo actions DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonRibbonGroupColorClusterButton MoveLast"); @@ -302,7 +302,7 @@ private void OnDeleteButton(object sender, EventArgs e) if (_ribbonColorButton?.Ribbon != null) { // Cast container to the correct type - KryptonRibbonGroupCluster cluster = (KryptonRibbonGroupCluster)_ribbonColorButton.RibbonContainer; + var cluster = (KryptonRibbonGroupCluster)_ribbonColorButton.RibbonContainer; // Use a transaction to support undo/redo actions DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonRibbonGroupColorClusterButton DeleteButton"); @@ -396,10 +396,7 @@ private void OnTypeSplit(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnContextMenu(object sender, MouseEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupClusterDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupClusterDesigner.cs index 716fe74fe..2291d4791 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupClusterDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupClusterDesigner.cs @@ -163,7 +163,7 @@ private void UpdateVerbStatus() if (_ribbonCluster?.Ribbon != null) { // Cast container to the correct type - KryptonRibbonGroupLines lines = (KryptonRibbonGroupLines)_ribbonCluster.RibbonContainer; + var lines = (KryptonRibbonGroupLines)_ribbonCluster.RibbonContainer; moveFirst = lines.Items.IndexOf(_ribbonCluster) > 0; movePrev = lines.Items.IndexOf(_ribbonCluster) > 0; @@ -193,7 +193,7 @@ private void OnMoveFirst(object sender, EventArgs e) if (_ribbonCluster?.Ribbon != null) { // Cast container to the correct type - KryptonRibbonGroupLines lines = (KryptonRibbonGroupLines)_ribbonCluster.RibbonContainer; + var lines = (KryptonRibbonGroupLines)_ribbonCluster.RibbonContainer; // Use a transaction to support undo/redo actions DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonRibbonGroupCluster MoveFirst"); @@ -225,7 +225,7 @@ private void OnMovePrevious(object sender, EventArgs e) if (_ribbonCluster?.Ribbon != null) { // Cast container to the correct type - KryptonRibbonGroupLines lines = (KryptonRibbonGroupLines)_ribbonCluster.RibbonContainer; + var lines = (KryptonRibbonGroupLines)_ribbonCluster.RibbonContainer; // Use a transaction to support undo/redo actions DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonRibbonGroupCluster MovePrevious"); @@ -259,7 +259,7 @@ private void OnMoveNext(object sender, EventArgs e) if (_ribbonCluster?.Ribbon != null) { // Cast container to the correct type - KryptonRibbonGroupLines lines = (KryptonRibbonGroupLines)_ribbonCluster.RibbonContainer; + var lines = (KryptonRibbonGroupLines)_ribbonCluster.RibbonContainer; // Use a transaction to support undo/redo actions DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonRibbonGroupCluster MoveNext"); @@ -293,7 +293,7 @@ private void OnMoveLast(object sender, EventArgs e) if (_ribbonCluster?.Ribbon != null) { // Cast container to the correct type - KryptonRibbonGroupLines lines = (KryptonRibbonGroupLines)_ribbonCluster.RibbonContainer; + var lines = (KryptonRibbonGroupLines)_ribbonCluster.RibbonContainer; // Use a transaction to support undo/redo actions DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonRibbonGroupCluster MoveLast"); @@ -335,7 +335,7 @@ private void OnAddButton(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a cluster button item - KryptonRibbonGroupClusterButton button = (KryptonRibbonGroupClusterButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupClusterButton)); + var button = (KryptonRibbonGroupClusterButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupClusterButton)); _ribbonCluster.Items.Add(button); RaiseComponentChanged(propertyItems, null, null); @@ -363,7 +363,7 @@ private void OnAddColorButton(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a cluster color button item - KryptonRibbonGroupClusterColorButton button = (KryptonRibbonGroupClusterColorButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupClusterColorButton)); + var button = (KryptonRibbonGroupClusterColorButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupClusterColorButton)); _ribbonCluster.Items.Add(button); RaiseComponentChanged(propertyItems, null, null); @@ -391,7 +391,7 @@ private void OnClearItems(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all the buttons from the cluster group for (var i = _ribbonCluster.Items.Count - 1; i >= 0; i--) @@ -416,7 +416,7 @@ private void OnDeleteCluster(object sender, EventArgs e) if (_ribbonCluster?.Ribbon != null) { // Cast container to the correct type - KryptonRibbonGroupLines lines = (KryptonRibbonGroupLines)_ribbonCluster.RibbonContainer; + var lines = (KryptonRibbonGroupLines)_ribbonCluster.RibbonContainer; // Use a transaction to support undo/redo actions DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonRibbonGroupTriple DeleteTriple"); @@ -456,10 +456,7 @@ private void OnVisible(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnComponentRemoving(object sender, ComponentEventArgs e) { @@ -467,7 +464,7 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) if (e.Component == _ribbonCluster) { // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all items from the cluster for (var j = _ribbonCluster.Items.Count - 1; j >= 0; j--) @@ -480,7 +477,7 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) } else { - IRibbonGroupContainer container = _ribbonCluster.Items[j] as IRibbonGroupContainer; + var container = _ribbonCluster.Items[j] as IRibbonGroupContainer; _ribbonCluster.Items.Remove(container); host.DestroyComponent(container as Component); } diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupColorButtonDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupColorButtonDesigner.cs index c43c8f6a5..bd3cda591 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupColorButtonDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupColorButtonDesigner.cs @@ -394,10 +394,7 @@ private void OnTypeSplit(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnContextMenu(object sender, MouseEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupComboBoxDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupComboBoxDesigner.cs index 403660a2a..fdef924c2 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupComboBoxDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupComboBoxDesigner.cs @@ -157,7 +157,7 @@ protected override void PreFilterProperties(IDictionary properties) // Adjust our list of properties for (var i = 0; i < strArray.Length; i++) { - PropertyDescriptor descrip = (PropertyDescriptor)properties[strArray[i]]; + var descrip = (PropertyDescriptor)properties[strArray[i]]; if (descrip != null) { properties[strArray[i]] = TypeDescriptor.CreateProperty(typeof(KryptonRibbonGroupComboBoxDesigner), descrip, attributes); @@ -174,17 +174,11 @@ protected override void PreFilterProperties(IDictionary properties) #endregion #region Implementation - private void ResetVisible() - { - Visible = true; - } + private void ResetVisible() => Visible = true; private bool ShouldSerializeVisible() => !Visible; - private void ResetEnabled() - { - Enabled = true; - } + private void ResetEnabled() => Enabled = true; private bool ShouldSerializeEnabled() => !Enabled; @@ -424,10 +418,7 @@ private void OnVisible(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnContextMenu(object sender, MouseEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupCustomControlDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupCustomControlDesigner.cs index 5a951056d..a50762831 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupCustomControlDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupCustomControlDesigner.cs @@ -154,7 +154,7 @@ protected override void PreFilterProperties(IDictionary properties) // Adjust our list of properties for (var i = 0; i < strArray.Length; i++) { - PropertyDescriptor descrip = (PropertyDescriptor)properties[strArray[i]]; + var descrip = (PropertyDescriptor)properties[strArray[i]]; if (descrip != null) { properties[strArray[i]] = TypeDescriptor.CreateProperty(typeof(KryptonRibbonGroupCustomControlDesigner), descrip, attributes); @@ -171,17 +171,11 @@ protected override void PreFilterProperties(IDictionary properties) #endregion #region Implementation - private void ResetVisible() - { - Visible = true; - } + private void ResetVisible() => Visible = true; private bool ShouldSerializeVisible() => !Visible; - private void ResetEnabled() - { - Enabled = true; - } + private void ResetEnabled() => Enabled = true; private bool ShouldSerializeEnabled() => !Enabled; @@ -422,10 +416,7 @@ private void OnVisible(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnContextMenu(object sender, MouseEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupDateTimePickerDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupDateTimePickerDesigner.cs index 3cefa9c77..df95929ff 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupDateTimePickerDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupDateTimePickerDesigner.cs @@ -157,7 +157,7 @@ protected override void PreFilterProperties(IDictionary properties) // Adjust our list of properties for (var i = 0; i < strArray.Length; i++) { - PropertyDescriptor descrip = (PropertyDescriptor)properties[strArray[i]]; + var descrip = (PropertyDescriptor)properties[strArray[i]]; if (descrip != null) { properties[strArray[i]] = TypeDescriptor.CreateProperty(typeof(KryptonRibbonGroupDateTimePickerDesigner), descrip, attributes); @@ -174,17 +174,11 @@ protected override void PreFilterProperties(IDictionary properties) #endregion #region Implementation - private void ResetVisible() - { - Visible = true; - } + private void ResetVisible() => Visible = true; private bool ShouldSerializeVisible() => !Visible; - private void ResetEnabled() - { - Enabled = true; - } + private void ResetEnabled() => Enabled = true; private bool ShouldSerializeEnabled() => !Enabled; @@ -424,10 +418,7 @@ private void OnVisible(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnContextMenu(object sender, MouseEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupDesigner.cs index 524f04060..c3a3940b9 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupDesigner.cs @@ -336,7 +336,7 @@ private void OnAddTriple(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create the new triple component - KryptonRibbonGroupTriple triple = (KryptonRibbonGroupTriple)_designerHost.CreateComponent(typeof(KryptonRibbonGroupTriple)); + var triple = (KryptonRibbonGroupTriple)_designerHost.CreateComponent(typeof(KryptonRibbonGroupTriple)); _ribbonGroup.Items.Add(triple); // Get access to the Triple.Items property @@ -345,9 +345,9 @@ private void OnAddTriple(object sender, EventArgs e) RaiseComponentChanging(propertyTripleItems); // Get designer to create three new button components - KryptonRibbonGroupButton button1 = (KryptonRibbonGroupButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupButton)); - KryptonRibbonGroupButton button2 = (KryptonRibbonGroupButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupButton)); - KryptonRibbonGroupButton button3 = (KryptonRibbonGroupButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupButton)); + var button1 = (KryptonRibbonGroupButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupButton)); + var button2 = (KryptonRibbonGroupButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupButton)); + var button3 = (KryptonRibbonGroupButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupButton)); triple.Items.Add(button1); triple.Items.Add(button2); triple.Items.Add(button3); @@ -378,7 +378,7 @@ private void OnAddLines(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create the new lines component - KryptonRibbonGroupLines lines = (KryptonRibbonGroupLines)_designerHost.CreateComponent(typeof(KryptonRibbonGroupLines)); + var lines = (KryptonRibbonGroupLines)_designerHost.CreateComponent(typeof(KryptonRibbonGroupLines)); _ribbonGroup.Items.Add(lines); // Get access to the Lines.Items property @@ -387,8 +387,8 @@ private void OnAddLines(object sender, EventArgs e) RaiseComponentChanging(propertyLinesItems); // Get designer to create three new button components - KryptonRibbonGroupButton button1 = (KryptonRibbonGroupButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupButton)); - KryptonRibbonGroupButton button2 = (KryptonRibbonGroupButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupButton)); + var button1 = (KryptonRibbonGroupButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupButton)); + var button2 = (KryptonRibbonGroupButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupButton)); lines.Items.Add(button1); lines.Items.Add(button2); @@ -418,7 +418,7 @@ private void OnAddSep(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create the new separator component - KryptonRibbonGroupSeparator sep = (KryptonRibbonGroupSeparator)_designerHost.CreateComponent(typeof(KryptonRibbonGroupSeparator)); + var sep = (KryptonRibbonGroupSeparator)_designerHost.CreateComponent(typeof(KryptonRibbonGroupSeparator)); _ribbonGroup.Items.Add(sep); RaiseComponentChanged(propertyItems, null, null); @@ -446,7 +446,7 @@ private void OnAddGallery(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create the new gallery component - KryptonRibbonGroupGallery gallery = (KryptonRibbonGroupGallery)_designerHost.CreateComponent(typeof(KryptonRibbonGroupGallery)); + var gallery = (KryptonRibbonGroupGallery)_designerHost.CreateComponent(typeof(KryptonRibbonGroupGallery)); _ribbonGroup.Items.Add(gallery); RaiseComponentChanged(propertyItems, null, null); @@ -474,7 +474,7 @@ private void OnClearItems(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all the items from the tab for (var i = _ribbonGroup.Items.Count - 1; i >= 0; i--) @@ -554,10 +554,7 @@ private void OnDialogLauncher(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnComponentRemoving(object sender, ComponentEventArgs e) { @@ -565,12 +562,12 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) if (e.Component == _ribbonGroup) { // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all containers from the group for (var j = _ribbonGroup.Items.Count - 1; j >= 0; j--) { - KryptonRibbonGroupContainer item = _ribbonGroup.Items[j] as KryptonRibbonGroupContainer; + var item = _ribbonGroup.Items[j] as KryptonRibbonGroupContainer; _ribbonGroup.Items.Remove(item); host.DestroyComponent(item); } diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupDomainUpDownDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupDomainUpDownDesigner.cs index 51d8f43e7..9f22c00cc 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupDomainUpDownDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupDomainUpDownDesigner.cs @@ -157,7 +157,7 @@ protected override void PreFilterProperties(IDictionary properties) // Adjust our list of properties for (var i = 0; i < strArray.Length; i++) { - PropertyDescriptor descrip = (PropertyDescriptor)properties[strArray[i]]; + var descrip = (PropertyDescriptor)properties[strArray[i]]; if (descrip != null) { properties[strArray[i]] = TypeDescriptor.CreateProperty(typeof(KryptonRibbonGroupDomainUpDownDesigner), descrip, attributes); @@ -174,17 +174,11 @@ protected override void PreFilterProperties(IDictionary properties) #endregion #region Implementation - private void ResetVisible() - { - Visible = true; - } + private void ResetVisible() => Visible = true; private bool ShouldSerializeVisible() => !Visible; - private void ResetEnabled() - { - Enabled = true; - } + private void ResetEnabled() => Enabled = true; private bool ShouldSerializeEnabled() => !Enabled; @@ -424,10 +418,7 @@ private void OnVisible(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnContextMenu(object sender, MouseEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupGalleryDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupGalleryDesigner.cs index d7d25398b..dfeafcac2 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupGalleryDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupGalleryDesigner.cs @@ -166,7 +166,7 @@ protected override void PreFilterProperties(IDictionary properties) // Adjust our list of properties for (var i = 0; i < strArray.Length; i++) { - PropertyDescriptor descrip = (PropertyDescriptor)properties[strArray[i]]; + var descrip = (PropertyDescriptor)properties[strArray[i]]; if (descrip != null) { properties[strArray[i]] = TypeDescriptor.CreateProperty(typeof(KryptonRibbonGroupGalleryDesigner), descrip, attributes); @@ -183,17 +183,11 @@ protected override void PreFilterProperties(IDictionary properties) #endregion #region Implementation - private void ResetVisible() - { - Visible = true; - } + private void ResetVisible() => Visible = true; private bool ShouldSerializeVisible() => !Visible; - private void ResetEnabled() - { - Enabled = true; - } + private void ResetEnabled() => Enabled = true; private bool ShouldSerializeEnabled() => !Enabled; @@ -476,10 +470,7 @@ private void OnMinSmall(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnContextMenu(object sender, MouseEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupLabelDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupLabelDesigner.cs index 2feac0c4c..c347ac70a 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupLabelDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupLabelDesigner.cs @@ -343,10 +343,7 @@ private void OnEnabled(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnContextMenu(object sender, MouseEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupLinesDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupLinesDesigner.cs index ef35c01c2..8d1769121 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupLinesDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupLinesDesigner.cs @@ -414,7 +414,7 @@ private void OnAddButton(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a button item - KryptonRibbonGroupButton button = (KryptonRibbonGroupButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupButton)); + var button = (KryptonRibbonGroupButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupButton)); _ribbonLines.Items.Add(button); RaiseComponentChanged(propertyItems, null, null); @@ -442,7 +442,7 @@ private void OnAddColorButton(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a button item - KryptonRibbonGroupColorButton button = (KryptonRibbonGroupColorButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupColorButton)); + var button = (KryptonRibbonGroupColorButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupColorButton)); _ribbonLines.Items.Add(button); RaiseComponentChanged(propertyItems, null, null); @@ -470,7 +470,7 @@ private void OnAddCheckBox(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a check box item - KryptonRibbonGroupCheckBox checkBox = (KryptonRibbonGroupCheckBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupCheckBox)); + var checkBox = (KryptonRibbonGroupCheckBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupCheckBox)); _ribbonLines.Items.Add(checkBox); RaiseComponentChanged(propertyItems, null, null); @@ -498,7 +498,7 @@ private void OnAddRadioButton(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a radio button item - KryptonRibbonGroupRadioButton radioButton = (KryptonRibbonGroupRadioButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupRadioButton)); + var radioButton = (KryptonRibbonGroupRadioButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupRadioButton)); _ribbonLines.Items.Add(radioButton); RaiseComponentChanged(propertyItems, null, null); @@ -526,7 +526,7 @@ private void OnAddLabel(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a label item - KryptonRibbonGroupLabel label = (KryptonRibbonGroupLabel)_designerHost.CreateComponent(typeof(KryptonRibbonGroupLabel)); + var label = (KryptonRibbonGroupLabel)_designerHost.CreateComponent(typeof(KryptonRibbonGroupLabel)); _ribbonLines.Items.Add(label); RaiseComponentChanged(propertyItems, null, null); @@ -554,7 +554,7 @@ private void OnAddCustomControl(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a custom control item - KryptonRibbonGroupCustomControl cc = (KryptonRibbonGroupCustomControl)_designerHost.CreateComponent(typeof(KryptonRibbonGroupCustomControl)); + var cc = (KryptonRibbonGroupCustomControl)_designerHost.CreateComponent(typeof(KryptonRibbonGroupCustomControl)); _ribbonLines.Items.Add(cc); RaiseComponentChanged(propertyItems, null, null); @@ -582,7 +582,7 @@ private void OnAddTextBox(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a textbox item - KryptonRibbonGroupTextBox tb = (KryptonRibbonGroupTextBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupTextBox)); + var tb = (KryptonRibbonGroupTextBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupTextBox)); _ribbonLines.Items.Add(tb); RaiseComponentChanged(propertyItems, null, null); @@ -610,7 +610,7 @@ private void OnAddMaskedTextBox(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a masked textbox item - KryptonRibbonGroupMaskedTextBox mtb = (KryptonRibbonGroupMaskedTextBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupMaskedTextBox)); + var mtb = (KryptonRibbonGroupMaskedTextBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupMaskedTextBox)); _ribbonLines.Items.Add(mtb); RaiseComponentChanged(propertyItems, null, null); @@ -638,7 +638,7 @@ private void OnAddRichTextBox(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a richtextbox item - KryptonRibbonGroupRichTextBox rtb = (KryptonRibbonGroupRichTextBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupRichTextBox)); + var rtb = (KryptonRibbonGroupRichTextBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupRichTextBox)); _ribbonLines.Items.Add(rtb); RaiseComponentChanged(propertyItems, null, null); @@ -666,7 +666,7 @@ private void OnAddComboBox(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a combobox item - KryptonRibbonGroupComboBox cb = (KryptonRibbonGroupComboBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupComboBox)); + var cb = (KryptonRibbonGroupComboBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupComboBox)); _ribbonLines.Items.Add(cb); RaiseComponentChanged(propertyItems, null, null); @@ -694,7 +694,7 @@ private void OnAddNumericUpDown(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a numeric up-down item - KryptonRibbonGroupNumericUpDown nud = (KryptonRibbonGroupNumericUpDown)_designerHost.CreateComponent(typeof(KryptonRibbonGroupNumericUpDown)); + var nud = (KryptonRibbonGroupNumericUpDown)_designerHost.CreateComponent(typeof(KryptonRibbonGroupNumericUpDown)); _ribbonLines.Items.Add(nud); RaiseComponentChanged(propertyItems, null, null); @@ -722,7 +722,7 @@ private void OnAddDomainUpDown(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a domain up-down item - KryptonRibbonGroupDomainUpDown nud = (KryptonRibbonGroupDomainUpDown)_designerHost.CreateComponent(typeof(KryptonRibbonGroupDomainUpDown)); + var nud = (KryptonRibbonGroupDomainUpDown)_designerHost.CreateComponent(typeof(KryptonRibbonGroupDomainUpDown)); _ribbonLines.Items.Add(nud); RaiseComponentChanged(propertyItems, null, null); @@ -750,7 +750,7 @@ private void OnAddDateTimePicker(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a date time picker item - KryptonRibbonGroupDateTimePicker nud = (KryptonRibbonGroupDateTimePicker)_designerHost.CreateComponent(typeof(KryptonRibbonGroupDateTimePicker)); + var nud = (KryptonRibbonGroupDateTimePicker)_designerHost.CreateComponent(typeof(KryptonRibbonGroupDateTimePicker)); _ribbonLines.Items.Add(nud); RaiseComponentChanged(propertyItems, null, null); @@ -778,7 +778,7 @@ private void OnAddTrackBar(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a trackbar item - KryptonRibbonGroupTrackBar tb = (KryptonRibbonGroupTrackBar)_designerHost.CreateComponent(typeof(KryptonRibbonGroupTrackBar)); + var tb = (KryptonRibbonGroupTrackBar)_designerHost.CreateComponent(typeof(KryptonRibbonGroupTrackBar)); _ribbonLines.Items.Add(tb); RaiseComponentChanged(propertyItems, null, null); @@ -806,7 +806,7 @@ private void OnAddCluster(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a cluster with buttons - KryptonRibbonGroupCluster cluster = (KryptonRibbonGroupCluster)_designerHost.CreateComponent(typeof(KryptonRibbonGroupCluster)); + var cluster = (KryptonRibbonGroupCluster)_designerHost.CreateComponent(typeof(KryptonRibbonGroupCluster)); _ribbonLines.Items.Add(cluster); // Get access to the Cluster.Items property @@ -815,8 +815,8 @@ private void OnAddCluster(object sender, EventArgs e) RaiseComponentChanging(propertyClusterItems); // Get designer to create three new button components - KryptonRibbonGroupClusterButton button1 = (KryptonRibbonGroupClusterButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupClusterButton)); - KryptonRibbonGroupClusterButton button2 = (KryptonRibbonGroupClusterButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupClusterButton)); + var button1 = (KryptonRibbonGroupClusterButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupClusterButton)); + var button2 = (KryptonRibbonGroupClusterButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupClusterButton)); cluster.Items.Add(button1); cluster.Items.Add(button2); @@ -846,7 +846,7 @@ private void OnClearItems(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all the items from the lines group for (var i = _ribbonLines.Items.Count - 1; i >= 0; i--) @@ -962,10 +962,7 @@ private void OnMinSmall(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnComponentRemoving(object sender, ComponentEventArgs e) { @@ -973,12 +970,12 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) if (e.Component == _ribbonLines) { // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all items from the lines groups for (var j = _ribbonLines.Items.Count - 1; j >= 0; j--) { - KryptonRibbonGroupItem item = _ribbonLines.Items[j] as KryptonRibbonGroupItem; + var item = _ribbonLines.Items[j] as KryptonRibbonGroupItem; _ribbonLines.Items.Remove(item); host.DestroyComponent(item); } @@ -1134,10 +1131,10 @@ private void OnMoveToGroup(object sender, EventArgs e) if ((_ribbonLines?.Ribbon != null) && _ribbonLines.RibbonGroup.Items.Contains(_ribbonLines)) { // Cast to correct type - ToolStripMenuItem groupMenuItem = (ToolStripMenuItem)sender; + var groupMenuItem = (ToolStripMenuItem)sender; // Get access to the destination tab - KryptonRibbonGroup destination = (KryptonRibbonGroup)groupMenuItem.Tag; + var destination = (KryptonRibbonGroup)groupMenuItem.Tag; // Use a transaction to support undo/redo actions DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonRibbonGroupLines MoveLinesToGroup"); diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupMaskedTextBoxDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupMaskedTextBoxDesigner.cs index f2e028e8a..f91828680 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupMaskedTextBoxDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupMaskedTextBoxDesigner.cs @@ -157,7 +157,7 @@ protected override void PreFilterProperties(IDictionary properties) // Adjust our list of properties for (var i = 0; i < strArray.Length; i++) { - PropertyDescriptor descrip = (PropertyDescriptor)properties[strArray[i]]; + var descrip = (PropertyDescriptor)properties[strArray[i]]; if (descrip != null) { properties[strArray[i]] = TypeDescriptor.CreateProperty(typeof(KryptonRibbonGroupMaskedTextBoxDesigner), descrip, attributes); @@ -174,17 +174,11 @@ protected override void PreFilterProperties(IDictionary properties) #endregion #region Implementation - private void ResetVisible() - { - Visible = true; - } + private void ResetVisible() => Visible = true; private bool ShouldSerializeVisible() => !Visible; - private void ResetEnabled() - { - Enabled = true; - } + private void ResetEnabled() => Enabled = true; private bool ShouldSerializeEnabled() => !Enabled; @@ -424,10 +418,7 @@ private void OnVisible(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnContextMenu(object sender, MouseEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupNumericUpDownDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupNumericUpDownDesigner.cs index 11f30bd38..4c2a6db20 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupNumericUpDownDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupNumericUpDownDesigner.cs @@ -173,17 +173,11 @@ protected override void PreFilterProperties(IDictionary properties) #endregion #region Implementation - private void ResetVisible() - { - Visible = true; - } + private void ResetVisible() => Visible = true; private bool ShouldSerializeVisible() => !Visible; - private void ResetEnabled() - { - Enabled = true; - } + private void ResetEnabled() => Enabled = true; private bool ShouldSerializeEnabled() => !Enabled; @@ -423,10 +417,7 @@ private void OnVisible(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnContextMenu(object sender, MouseEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupRadioButtonDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupRadioButtonDesigner.cs index 0ae7e0b6b..2d71ebc0e 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupRadioButtonDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupRadioButtonDesigner.cs @@ -353,10 +353,7 @@ private void OnChecked(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnContextMenu(object sender, MouseEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupRichTextBoxDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupRichTextBoxDesigner.cs index 61432488a..ae50f5df0 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupRichTextBoxDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupRichTextBoxDesigner.cs @@ -157,7 +157,7 @@ protected override void PreFilterProperties(IDictionary properties) // Adjust our list of properties for (var i = 0; i < strArray.Length; i++) { - PropertyDescriptor descrip = (PropertyDescriptor)properties[strArray[i]]; + var descrip = (PropertyDescriptor)properties[strArray[i]]; if (descrip != null) { properties[strArray[i]] = TypeDescriptor.CreateProperty(typeof(KryptonRibbonGroupRichTextBoxDesigner), descrip, attributes); @@ -174,17 +174,11 @@ protected override void PreFilterProperties(IDictionary properties) #endregion #region Implementation - private void ResetVisible() - { - Visible = true; - } + private void ResetVisible() => Visible = true; private bool ShouldSerializeVisible() => !Visible; - private void ResetEnabled() - { - Enabled = true; - } + private void ResetEnabled() => Enabled = true; private bool ShouldSerializeEnabled() => !Enabled; @@ -424,10 +418,7 @@ private void OnVisible(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnContextMenu(object sender, MouseEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupSeparatorDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupSeparatorDesigner.cs index 2f2b1b162..e8ad1c7c8 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupSeparatorDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupSeparatorDesigner.cs @@ -315,10 +315,7 @@ private void OnDeleteSeparator(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnContextMenu(object sender, MouseEventArgs e) { @@ -399,10 +396,10 @@ private void OnMoveToGroup(object sender, EventArgs e) if ((_ribbonSeparator?.Ribbon != null) && _ribbonSeparator.RibbonGroup.Items.Contains(_ribbonSeparator)) { // Cast to correct type - ToolStripMenuItem groupMenuItem = (ToolStripMenuItem)sender; + var groupMenuItem = (ToolStripMenuItem)sender; // Get access to the destination tab - KryptonRibbonGroup destination = (KryptonRibbonGroup)groupMenuItem.Tag; + var destination = (KryptonRibbonGroup)groupMenuItem.Tag; // Use a transaction to support undo/redo actions DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonRibbonGroupSeparator MoveSeparatorToGroup"); diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupTextBoxDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupTextBoxDesigner.cs index 316e4cce0..be58790a6 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupTextBoxDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupTextBoxDesigner.cs @@ -157,7 +157,7 @@ protected override void PreFilterProperties(IDictionary properties) // Adjust our list of properties for (var i = 0; i < strArray.Length; i++) { - PropertyDescriptor descrip = (PropertyDescriptor)properties[strArray[i]]; + var descrip = (PropertyDescriptor)properties[strArray[i]]; if (descrip != null) { properties[strArray[i]] = TypeDescriptor.CreateProperty(typeof(KryptonRibbonGroupTextBoxDesigner), descrip, attributes); @@ -174,17 +174,11 @@ protected override void PreFilterProperties(IDictionary properties) #endregion #region Implementation - private void ResetVisible() - { - Visible = true; - } + private void ResetVisible() => Visible = true; private bool ShouldSerializeVisible() => !Visible; - private void ResetEnabled() - { - Enabled = true; - } + private void ResetEnabled() => Enabled = true; private bool ShouldSerializeEnabled() => !Enabled; @@ -424,10 +418,7 @@ private void OnVisible(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnContextMenu(object sender, MouseEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupTrackBarDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupTrackBarDesigner.cs index e0b031525..d68f94460 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupTrackBarDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupTrackBarDesigner.cs @@ -157,7 +157,7 @@ protected override void PreFilterProperties(IDictionary properties) // Adjust our list of properties for (var i = 0; i < strArray.Length; i++) { - PropertyDescriptor descrip = (PropertyDescriptor)properties[strArray[i]]; + var descrip = (PropertyDescriptor)properties[strArray[i]]; if (descrip != null) { properties[strArray[i]] = TypeDescriptor.CreateProperty(typeof(KryptonRibbonGroupTrackBarDesigner), descrip, attributes); @@ -174,17 +174,11 @@ protected override void PreFilterProperties(IDictionary properties) #endregion #region Implementation - private void ResetVisible() - { - Visible = true; - } + private void ResetVisible() => Visible = true; private bool ShouldSerializeVisible() => !Visible; - private void ResetEnabled() - { - Enabled = true; - } + private void ResetEnabled() => Enabled = true; private bool ShouldSerializeEnabled() => !Enabled; @@ -424,10 +418,7 @@ private void OnVisible(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnContextMenu(object sender, MouseEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupTripleDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupTripleDesigner.cs index a1768814e..79dd646c2 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupTripleDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonGroupTripleDesigner.cs @@ -422,7 +422,7 @@ private void OnAddButton(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a button item - KryptonRibbonGroupButton button = (KryptonRibbonGroupButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupButton)); + var button = (KryptonRibbonGroupButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupButton)); _ribbonTriple.Items.Add(button); RaiseComponentChanged(propertyItems, null, null); @@ -450,7 +450,7 @@ private void OnAddColorButton(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a button item - KryptonRibbonGroupColorButton button = (KryptonRibbonGroupColorButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupColorButton)); + var button = (KryptonRibbonGroupColorButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupColorButton)); _ribbonTriple.Items.Add(button); RaiseComponentChanged(propertyItems, null, null); @@ -478,7 +478,7 @@ private void OnAddCheckBox(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a check box item. - KryptonRibbonGroupCheckBox checkBox = (KryptonRibbonGroupCheckBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupCheckBox)); + var checkBox = (KryptonRibbonGroupCheckBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupCheckBox)); _ribbonTriple.Items.Add(checkBox); RaiseComponentChanged(propertyItems, null, null); @@ -506,7 +506,7 @@ private void OnAddRadioButton(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a radio button item. - KryptonRibbonGroupRadioButton radioButton = (KryptonRibbonGroupRadioButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupRadioButton)); + var radioButton = (KryptonRibbonGroupRadioButton)_designerHost.CreateComponent(typeof(KryptonRibbonGroupRadioButton)); _ribbonTriple.Items.Add(radioButton); RaiseComponentChanged(propertyItems, null, null); @@ -534,7 +534,7 @@ private void OnAddLabel(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a label item - KryptonRibbonGroupLabel label = (KryptonRibbonGroupLabel)_designerHost.CreateComponent(typeof(KryptonRibbonGroupLabel)); + var label = (KryptonRibbonGroupLabel)_designerHost.CreateComponent(typeof(KryptonRibbonGroupLabel)); _ribbonTriple.Items.Add(label); RaiseComponentChanged(propertyItems, null, null); @@ -562,7 +562,7 @@ private void OnAddCustomControl(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a custom control item - KryptonRibbonGroupCustomControl cc = (KryptonRibbonGroupCustomControl)_designerHost.CreateComponent(typeof(KryptonRibbonGroupCustomControl)); + var cc = (KryptonRibbonGroupCustomControl)_designerHost.CreateComponent(typeof(KryptonRibbonGroupCustomControl)); _ribbonTriple.Items.Add(cc); RaiseComponentChanged(propertyItems, null, null); @@ -590,7 +590,7 @@ private void OnAddTextBox(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a textbox item - KryptonRibbonGroupTextBox tb = (KryptonRibbonGroupTextBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupTextBox)); + var tb = (KryptonRibbonGroupTextBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupTextBox)); _ribbonTriple.Items.Add(tb); RaiseComponentChanged(propertyItems, null, null); @@ -618,7 +618,7 @@ private void OnAddTrackBar(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a trackbar item - KryptonRibbonGroupTrackBar tb = (KryptonRibbonGroupTrackBar)_designerHost.CreateComponent(typeof(KryptonRibbonGroupTrackBar)); + var tb = (KryptonRibbonGroupTrackBar)_designerHost.CreateComponent(typeof(KryptonRibbonGroupTrackBar)); _ribbonTriple.Items.Add(tb); RaiseComponentChanged(propertyItems, null, null); @@ -646,7 +646,7 @@ private void OnAddMaskedTextBox(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a textbox item - KryptonRibbonGroupMaskedTextBox mtb = (KryptonRibbonGroupMaskedTextBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupMaskedTextBox)); + var mtb = (KryptonRibbonGroupMaskedTextBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupMaskedTextBox)); _ribbonTriple.Items.Add(mtb); RaiseComponentChanged(propertyItems, null, null); @@ -674,7 +674,7 @@ private void OnAddRichTextBox(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a richtextbox item - KryptonRibbonGroupRichTextBox rtb = (KryptonRibbonGroupRichTextBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupRichTextBox)); + var rtb = (KryptonRibbonGroupRichTextBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupRichTextBox)); _ribbonTriple.Items.Add(rtb); RaiseComponentChanged(propertyItems, null, null); @@ -702,7 +702,7 @@ private void OnAddComboBox(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a combobox item - KryptonRibbonGroupComboBox cc = (KryptonRibbonGroupComboBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupComboBox)); + var cc = (KryptonRibbonGroupComboBox)_designerHost.CreateComponent(typeof(KryptonRibbonGroupComboBox)); _ribbonTriple.Items.Add(cc); RaiseComponentChanged(propertyItems, null, null); @@ -730,7 +730,7 @@ private void OnAddNumericUpDown(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a numeric up-down item - KryptonRibbonGroupNumericUpDown cc = (KryptonRibbonGroupNumericUpDown)_designerHost.CreateComponent(typeof(KryptonRibbonGroupNumericUpDown)); + var cc = (KryptonRibbonGroupNumericUpDown)_designerHost.CreateComponent(typeof(KryptonRibbonGroupNumericUpDown)); _ribbonTriple.Items.Add(cc); RaiseComponentChanged(propertyItems, null, null); @@ -758,7 +758,7 @@ private void OnAddDomainUpDown(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a domain up-down item - KryptonRibbonGroupDomainUpDown cc = (KryptonRibbonGroupDomainUpDown)_designerHost.CreateComponent(typeof(KryptonRibbonGroupDomainUpDown)); + var cc = (KryptonRibbonGroupDomainUpDown)_designerHost.CreateComponent(typeof(KryptonRibbonGroupDomainUpDown)); _ribbonTriple.Items.Add(cc); RaiseComponentChanged(propertyItems, null, null); @@ -786,7 +786,7 @@ private void OnAddDateTimePicker(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Get designer to create a domain up-down item - KryptonRibbonGroupDateTimePicker cc = (KryptonRibbonGroupDateTimePicker)_designerHost.CreateComponent(typeof(KryptonRibbonGroupDateTimePicker)); + var cc = (KryptonRibbonGroupDateTimePicker)_designerHost.CreateComponent(typeof(KryptonRibbonGroupDateTimePicker)); _ribbonTriple.Items.Add(cc); RaiseComponentChanged(propertyItems, null, null); @@ -814,7 +814,7 @@ private void OnClearItems(object sender, EventArgs e) RaiseComponentChanging(propertyItems); // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all the items from the triple group for (var i = _ribbonTriple.Items.Count - 1; i >= 0; i--) @@ -930,10 +930,7 @@ private void OnMinSmall(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnComponentRemoving(object sender, ComponentEventArgs e) { @@ -941,12 +938,12 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) if (e.Component == _ribbonTriple) { // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all items from the triple group for (var j = _ribbonTriple.Items.Count - 1; j >= 0; j--) { - KryptonRibbonGroupItem item = _ribbonTriple.Items[j] as KryptonRibbonGroupItem; + var item = _ribbonTriple.Items[j] as KryptonRibbonGroupItem; _ribbonTriple.Items.Remove(item); host.DestroyComponent(item); } @@ -1113,10 +1110,10 @@ private void OnMoveToGroup(object sender, EventArgs e) if ((_ribbonTriple?.Ribbon != null) && _ribbonTriple.RibbonGroup.Items.Contains(_ribbonTriple)) { // Cast to correct type - ToolStripMenuItem groupMenuItem = (ToolStripMenuItem)sender; + var groupMenuItem = (ToolStripMenuItem)sender; // Get access to the destination tab - KryptonRibbonGroup destination = (KryptonRibbonGroup)groupMenuItem.Tag; + var destination = (KryptonRibbonGroup)groupMenuItem.Tag; // Use a transaction to support undo/redo actions DesignerTransaction transaction = _designerHost.CreateTransaction(@"KryptonRibbonGroupTriple MoveTripleToGroup"); diff --git a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonTabDesigner.cs b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonTabDesigner.cs index ea454742a..bac7ed254 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonTabDesigner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Designers/Designers/KryptonRibbonTabDesigner.cs @@ -328,7 +328,7 @@ private void OnAddGroup(object sender, EventArgs e) RaiseComponentChanging(propertyGroups); // Get designer to create the new group component - KryptonRibbonGroup group = (KryptonRibbonGroup)_designerHost.CreateComponent(typeof(KryptonRibbonGroup)); + var group = (KryptonRibbonGroup)_designerHost.CreateComponent(typeof(KryptonRibbonGroup)); _ribbonTab.Groups.Add(group); RaiseComponentChanged(propertyGroups, null, null); @@ -356,7 +356,7 @@ private void OnClearGroups(object sender, EventArgs e) RaiseComponentChanging(propertyGroups); // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all the groups from the tab for (var i = _ribbonTab.Groups.Count - 1; i >= 0; i--) @@ -418,10 +418,7 @@ private void OnVisible(object sender, EventArgs e) } } - private void OnComponentChanged(object sender, ComponentChangedEventArgs e) - { - UpdateVerbStatus(); - } + private void OnComponentChanged(object sender, ComponentChangedEventArgs e) => UpdateVerbStatus(); private void OnComponentRemoving(object sender, ComponentEventArgs e) { @@ -429,7 +426,7 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) if (e.Component == _ribbonTab) { // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all the groups from the tab for (var i = _ribbonTab.Groups.Count - 1; i >= 0; i--) diff --git a/Source/Krypton Components/Krypton.Ribbon/General/AppButtonMenuProvider.cs b/Source/Krypton Components/Krypton.Ribbon/General/AppButtonMenuProvider.cs index 5980f6e73..71cfdc8c4 100644 --- a/Source/Krypton Components/Krypton.Ribbon/General/AppButtonMenuProvider.cs +++ b/Source/Krypton Components/Krypton.Ribbon/General/AppButtonMenuProvider.cs @@ -100,10 +100,7 @@ public AppButtonMenuProvider(ViewContextMenuManager viewManager, /// Fires the Dispose event. /// /// An EventArgs containing the event data. - public void OnDispose(EventArgs e) - { - Dispose?.Invoke(this, e); - } + public void OnDispose(EventArgs e) => Dispose?.Invoke(this, e); /// /// Fires the Closing event. diff --git a/Source/Krypton Components/Krypton.Ribbon/General/KeyTipInfo.cs b/Source/Krypton Components/Krypton.Ribbon/General/KeyTipInfo.cs index 76d9c3b61..0b3df46ee 100644 --- a/Source/Krypton Components/Krypton.Ribbon/General/KeyTipInfo.cs +++ b/Source/Krypton Components/Krypton.Ribbon/General/KeyTipInfo.cs @@ -77,10 +77,7 @@ public KeyTipInfo(bool enabled, /// Perform actual selection of the item. /// /// Reference to owning ribbon instance. - public void KeyTipSelect(KryptonRibbon ribbon) - { - _target?.KeyTipSelect(ribbon); - } + public void KeyTipSelect(KryptonRibbon ribbon) => _target?.KeyTipSelect(ribbon); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupButton.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupButton.cs index cd5c6ec61..a5dbaeb45 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupButton.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupButton.cs @@ -35,8 +35,8 @@ public class KryptonRibbonGroupButton : KryptonRibbonGroupItem private bool _enabled; private bool _visible; private bool _checked; - private Image _imageSmall; - private Image _imageLarge; + private Image? _imageSmall; + private Image? _imageLarge; private string _textLine1; private string _textLine2; private string _keyTip; @@ -222,7 +222,7 @@ public string KeyTip { if (string.IsNullOrEmpty(value)) { - value = "B"; + value = @"B"; } _keyTip = value.ToUpper(); @@ -256,18 +256,12 @@ public override bool Visible /// /// Make the ribbon group visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon group hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the enabled state of the group entry. @@ -345,10 +339,7 @@ public GroupButtonType ButtonType /// /// Resets the ShortcutKeys property to its default value. /// - public void ResetShortcutKeys() - { - ShortcutKeys = Keys.None; - } + public void ResetShortcutKeys() => ShortcutKeys = Keys.None; /// @@ -503,36 +494,24 @@ public override ViewBase CreateView(KryptonRibbon ribbon, /// /// Generates a Click event for a button. /// - public void PerformClick() - { - PerformClick(null); - } + public void PerformClick() => PerformClick(null); /// /// Generates a Click event for a button. /// /// Delegate fired during event processing. - public void PerformClick(EventHandler finishDelegate) - { - OnClick(finishDelegate); - } + public void PerformClick(EventHandler? finishDelegate) => OnClick(finishDelegate); /// /// Generates a DropDown event for a button. /// - public void PerformDropDown() - { - PerformDropDown(null); - } + public void PerformDropDown() => PerformDropDown(null); /// /// Generates a DropDown event for a button. /// /// Delegate fired during event processing. - public void PerformDropDown(EventHandler finishDelegate) - { - OnDropDown(finishDelegate); - } + public void PerformDropDown(EventHandler? finishDelegate) => OnDropDown(finishDelegate); /// /// Internal design time properties. @@ -540,7 +519,7 @@ public void PerformDropDown(EventHandler finishDelegate) [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [EditorBrowsable(EditorBrowsableState.Never)] [Browsable(false)] - public ViewBase ButtonView { get; set; } + public ViewBase? ButtonView { get; set; } #endregion @@ -579,7 +558,7 @@ protected virtual void OnCommandPropertyChanged(object sender, PropertyChangedEv /// Raises the Click event. /// /// Delegate fired during event processing. - protected virtual void OnClick(EventHandler finishDelegate) + protected virtual void OnClick(EventHandler? finishDelegate) { var fireDelegate = true; @@ -635,7 +614,7 @@ protected virtual void OnClick(EventHandler finishDelegate) /// Raises the DropDown event. /// /// Delegate fired during event processing. - protected virtual void OnDropDown(EventHandler finishDelegate) + protected virtual void OnDropDown(EventHandler? finishDelegate) { var fireDelegate = true; @@ -655,7 +634,7 @@ protected virtual void OnDropDown(EventHandler finishDelegate) DropDown?.Invoke(this, contextArgs); // If user did not cancel and there is still a krypton context menu strip to show - if (contextArgs is { Cancel: false, KryptonContextMenu: { } }) + if (contextArgs is { Cancel: false, KryptonContextMenu: not null }) { var screenRect = Rectangle.Empty; @@ -688,7 +667,7 @@ protected virtual void OnDropDown(EventHandler finishDelegate) DropDown?.Invoke(this, contextArgs); // If user did not cancel and there is still a context menu strip to show - if (contextArgs is { Cancel: false, ContextMenuStrip: { } }) + if (contextArgs is { Cancel: false, ContextMenuStrip: not null }) { var screenRect = Rectangle.Empty; @@ -725,17 +704,11 @@ protected virtual void OnDropDown(EventHandler finishDelegate) /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Internal - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal override bool ProcessCmdKey(ref Message msg, Keys keyData) { @@ -798,7 +771,7 @@ internal override bool ProcessCmdKey(ref Message msg, Keys keyData) #region Implementation private void OnKryptonContextMenuClosed(object sender, EventArgs e) { - KryptonContextMenu kcm = (KryptonContextMenu)sender; + var kcm = (KryptonContextMenu)sender; kcm.Closed -= OnKryptonContextMenuClosed; // Fire any associated finish delegate diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupCheckBox.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupCheckBox.cs index 59beb518c..17602cfcd 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupCheckBox.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupCheckBox.cs @@ -172,7 +172,7 @@ public string KeyTip { if (string.IsNullOrEmpty(value)) { - value = "C"; + value = @"C"; } _keyTip = value.ToUpper(); @@ -206,18 +206,12 @@ public override bool Visible /// /// Make the ribbon group visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon group hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the enabled state of the group check box entry. @@ -352,12 +346,9 @@ public bool ThreeState /// /// Resets the ShortcutKeys property to its default value. /// - public void ResetShortcutKeys() - { - ShortcutKeys = Keys.None; - } + public void ResetShortcutKeys() => ShortcutKeys = Keys.None; + - /// /// Gets access to the Wrapped Controls Tooltips. /// @@ -470,19 +461,13 @@ public override ViewBase CreateView(KryptonRibbon ribbon, /// /// Generates a Click event for a check box. /// - public void PerformClick() - { - PerformClick(null); - } + public void PerformClick() => PerformClick(null); /// /// Generates a Click event for a check box. /// /// Delegate fired during event processing. - public void PerformClick(EventHandler finishDelegate) - { - OnClick(finishDelegate); - } + public void PerformClick(EventHandler? finishDelegate) => OnClick(finishDelegate); /// /// Internal design time properties. @@ -524,7 +509,7 @@ protected virtual void OnCommandPropertyChanged(object sender, PropertyChangedEv /// Raises the Click event. /// /// Delegate fired during event processing. - protected virtual void OnClick(EventHandler finishDelegate) + protected virtual void OnClick(EventHandler? finishDelegate) { var fireDelegate = true; @@ -595,35 +580,23 @@ protected virtual void OnClick(EventHandler finishDelegate) /// Raises the CheckedChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnCheckedChanged(EventArgs e) - { - CheckedChanged?.Invoke(this, e); - } + protected virtual void OnCheckedChanged(EventArgs e) => CheckedChanged?.Invoke(this, e); /// /// Raises the CheckStateChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnCheckStateChanged(EventArgs e) - { - CheckStateChanged?.Invoke(this, e); - } + protected virtual void OnCheckStateChanged(EventArgs e) => CheckStateChanged?.Invoke(this, e); /// /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Internal - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal override bool ProcessCmdKey(ref Message msg, Keys keyData) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupCluster.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupCluster.cs index 0bfeb2ce4..52d9dda4a 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupCluster.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupCluster.cs @@ -156,18 +156,12 @@ public override bool Visible /// /// Make the ribbon group visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon group hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the maximum allowed size of the item. @@ -330,27 +324,15 @@ public override Component[] GetChildComponents() /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Internal - internal void OnDesignTimeAddButton() - { - DesignTimeAddButton?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddButton() => DesignTimeAddButton?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddColorButton() - { - DesignTimeAddColorButton?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddColorButton() => DesignTimeAddColorButton?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal override bool ProcessCmdKey(ref Message msg, Keys keyData) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupClusterButton.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupClusterButton.cs index 99d189187..7e9b1a818 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupClusterButton.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupClusterButton.cs @@ -36,7 +36,7 @@ public class KryptonRibbonGroupClusterButton : KryptonRibbonGroupItem private bool _checked; private string _textLine; private string _keyTip; - private Image _imageSmall; + private Image? _imageSmall; private GroupItemSize _itemSizeMax; private GroupItemSize _itemSizeMin; private GroupItemSize _itemSizeCurrent; @@ -141,7 +141,7 @@ public string KeyTip { if (string.IsNullOrEmpty(value)) { - value = "B"; + value = @"B"; } _keyTip = value.ToUpper(); @@ -199,18 +199,12 @@ public override bool Visible /// /// Make the ribbon group visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon group hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the enabled state of the group entry. @@ -288,12 +282,9 @@ public GroupButtonType ButtonType /// /// Resets the ShortcutKeys property to its default value. /// - public void ResetShortcutKeys() - { - ShortcutKeys = Keys.None; - } + public void ResetShortcutKeys() => ShortcutKeys = Keys.None; + - /// /// Gets access to the Wrapped Controls Tooltips. /// @@ -474,36 +465,24 @@ public override ViewBase CreateView(KryptonRibbon ribbon, /// /// Generates a Click event for a button. /// - public void PerformClick() - { - PerformClick(null); - } + public void PerformClick() => PerformClick(null); /// /// Generates a Click event for a button. /// /// Delegate fired during event processing. - public void PerformClick(EventHandler finishDelegate) - { - OnClick(finishDelegate); - } + public void PerformClick(EventHandler? finishDelegate) => OnClick(finishDelegate); /// /// Generates a DropDown event for a button. /// - public void PerformDropDown() - { - PerformDropDown(null); - } + public void PerformDropDown() => PerformDropDown(null); /// /// Generates a DropDown event for a button. /// /// Delegate fired during event processing. - public void PerformDropDown(EventHandler finishDelegate) - { - OnDropDown(finishDelegate); - } + public void PerformDropDown(EventHandler? finishDelegate) => OnDropDown(finishDelegate); /// /// Internal design time properties. @@ -511,7 +490,7 @@ public void PerformDropDown(EventHandler finishDelegate) [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [EditorBrowsable(EditorBrowsableState.Never)] [Browsable(false)] - public ViewBase ClusterButtonView { get; set; } + public ViewBase? ClusterButtonView { get; set; } #endregion @@ -546,7 +525,7 @@ protected virtual void OnCommandPropertyChanged(object sender, PropertyChangedEv /// Raises the Click event. /// /// Delegate fired during event processing. - protected virtual void OnClick(EventHandler finishDelegate) + protected virtual void OnClick(EventHandler? finishDelegate) { var fireDelegate = true; @@ -602,7 +581,7 @@ protected virtual void OnClick(EventHandler finishDelegate) /// Raises the DropDown event. /// /// Delegate fired during event processing. - protected virtual void OnDropDown(EventHandler finishDelegate) + protected virtual void OnDropDown(EventHandler? finishDelegate) { var fireDelegate = true; @@ -622,7 +601,7 @@ protected virtual void OnDropDown(EventHandler finishDelegate) DropDown?.Invoke(this, contextArgs); // If user did not cancel and there is still a krypton context menu strip to show - if (contextArgs is { Cancel: false, KryptonContextMenu: { } }) + if (contextArgs is { Cancel: false, KryptonContextMenu: not null }) { var screenRect = Rectangle.Empty; @@ -655,7 +634,7 @@ protected virtual void OnDropDown(EventHandler finishDelegate) DropDown?.Invoke(this, contextArgs); // If user did not cancel and there is still a context menu strip to show - if (contextArgs is { Cancel: false, ContextMenuStrip: { } }) + if (contextArgs is { Cancel: false, ContextMenuStrip: not null }) { var screenRect = Rectangle.Empty; @@ -692,17 +671,11 @@ protected virtual void OnDropDown(EventHandler finishDelegate) /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Internal - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal override bool ProcessCmdKey(ref Message msg, Keys keyData) { @@ -766,7 +739,7 @@ internal override bool ProcessCmdKey(ref Message msg, Keys keyData) #region Implementation private void OnKryptonContextMenuClosed(object sender, EventArgs e) { - KryptonContextMenu kcm = (KryptonContextMenu)sender; + var kcm = (KryptonContextMenu)sender; kcm.Closed -= OnKryptonContextMenuClosed; // Fire any associated finish delegate diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupClusterColorButton.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupClusterColorButton.cs index b2c4994f2..1d31faaa7 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupClusterColorButton.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupClusterColorButton.cs @@ -526,18 +526,12 @@ public override bool Visible /// /// Make the ribbon color button visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon color button hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the enabled state of the group color button. @@ -615,10 +609,7 @@ public GroupButtonType ButtonType /// /// Resets the ShortcutKeys property to its default value. /// - public void ResetShortcutKeys() - { - ShortcutKeys = Keys.None; - } + public void ResetShortcutKeys() => ShortcutKeys = Keys.None; /// /// Gets access to the Wrapped Controls Tooltips. @@ -650,10 +641,7 @@ public Color[] RecentColors /// /// Clear the recent colors setting. /// - public void ClearRecentColors() - { - _recentColors.Clear(); - } + public void ClearRecentColors() => _recentColors.Clear(); /// /// Gets and sets the associated KryptonCommand. @@ -786,36 +774,24 @@ public override ViewBase CreateView(KryptonRibbon ribbon, /// /// Generates a Click event for a button. /// - public void PerformClick() - { - PerformClick(null); - } + public void PerformClick() => PerformClick(null); /// /// Generates a Click event for a button. /// /// Delegate fired during event processing. - public void PerformClick(EventHandler? finishDelegate) - { - OnClick(finishDelegate); - } + public void PerformClick(EventHandler? finishDelegate) => OnClick(finishDelegate); /// /// Generates a DropDown event for a button. /// - public void PerformDropDown() - { - PerformDropDown(null); - } + public void PerformDropDown() => PerformDropDown(null); /// /// Generates a DropDown event for a button. /// /// Delegate fired during event processing. - public void PerformDropDown(EventHandler? finishDelegate) - { - OnDropDown(finishDelegate); - } + public void PerformDropDown(EventHandler? finishDelegate) => OnDropDown(finishDelegate); /// /// Internal design time properties. @@ -934,7 +910,7 @@ protected virtual void OnDropDown(EventHandler? finishDelegate) DropDown?.Invoke(this, contextArgs); // If user did not cancel and there is still a krypton context menu strip to show - if (contextArgs is { Cancel: false, KryptonContextMenu: { } }) + if (contextArgs is { Cancel: false, KryptonContextMenu: not null }) { var screenRect = Rectangle.Empty; @@ -983,44 +959,29 @@ protected virtual void OnDropDown(EventHandler? finishDelegate) /// Raises the SelectedColorChanged event. /// /// New selected color. - protected virtual void OnSelectedColorChanged(Color selectedColor) - { - SelectedColorChanged?.Invoke(this, new ColorEventArgs(selectedColor)); - } + protected virtual void OnSelectedColorChanged(Color selectedColor) => SelectedColorChanged?.Invoke(this, new ColorEventArgs(selectedColor)); /// /// Raises the TrackingColor event. /// /// An ColorEventArgs that contains the event data. - protected virtual void OnTrackingColor(ColorEventArgs e) - { - TrackingColor?.Invoke(this, e); - } + protected virtual void OnTrackingColor(ColorEventArgs e) => TrackingColor?.Invoke(this, e); /// /// Raises the MoreColors event. /// /// An CancelEventArgs that contains the event data. - protected virtual void OnMoreColors(CancelEventArgs e) - { - MoreColors?.Invoke(this, e); - } + protected virtual void OnMoreColors(CancelEventArgs e) => MoreColors?.Invoke(this, e); /// /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Internal - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal override bool ProcessCmdKey(ref Message msg, Keys keyData) { @@ -1230,20 +1191,11 @@ private void DecideOnVisible(KryptonContextMenuItemBase visible, KryptonContextM visible.Visible = previous; } - private void OnColumnsTrackingColor(object sender, ColorEventArgs e) - { - OnTrackingColor(new ColorEventArgs(e.Color)); - } + private void OnColumnsTrackingColor(object sender, ColorEventArgs e) => OnTrackingColor(new ColorEventArgs(e.Color)); - private void OnColumnsSelectedColorChanged(object sender, ColorEventArgs e) - { - SelectedColor = e.Color; - } + private void OnColumnsSelectedColorChanged(object sender, ColorEventArgs e) => SelectedColor = e.Color; - private void OnClickNoColor(object sender, EventArgs e) - { - SelectedColor = Color.Empty; - } + private void OnClickNoColor(object sender, EventArgs e) => SelectedColor = Color.Empty; private void OnClickMoreColors(object sender, EventArgs e) { @@ -1255,8 +1207,7 @@ private void OnClickMoreColors(object sender, EventArgs e) if (!cea.Cancel) { // Use a standard color dialog for the selection of custom colors - // TODO: Use the Kryptonised version ?? - var cd = new ColorDialog + var cd = new KryptonColorDialog { Color = SelectedColor, FullOpen = true @@ -1272,7 +1223,7 @@ private void OnClickMoreColors(object sender, EventArgs e) private void OnKryptonContextMenuClosed(object sender, EventArgs e) { - KryptonContextMenu kcm = (KryptonContextMenu)sender; + var kcm = (KryptonContextMenu)sender; kcm.Closed -= OnKryptonContextMenuClosed!; // Fire any associated finish delegate diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupColorButton.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupColorButton.cs index 76da4232a..a0b094c5f 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupColorButton.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupColorButton.cs @@ -45,8 +45,8 @@ public class KryptonRibbonGroupColorButton : KryptonRibbonGroupItem private Rectangle _selectedRectLarge; private Color _selectedColor; private Color _emptyBorderColor; - private Image _imageSmall; - private Image _imageLarge; + private Image? _imageSmall; + private Image? _imageLarge; private string _textLine1; private string _textLine2; private string _keyTip; @@ -62,7 +62,7 @@ public class KryptonRibbonGroupColorButton : KryptonRibbonGroupItem private readonly List _recentColors; // Context menu items - private readonly KryptonContextMenu _kryptonContextMenu; + private readonly KryptonContextMenu? _kryptonContextMenu; private readonly KryptonContextMenuSeparator _separatorTheme; private readonly KryptonContextMenuSeparator _separatorStandard; private readonly KryptonContextMenuSeparator _separatorRecent; @@ -384,7 +384,7 @@ public string KeyTip { if (string.IsNullOrEmpty(value)) { - value = "B"; + value = @"B"; } _keyTip = value.ToUpper(); @@ -598,18 +598,12 @@ public override bool Visible /// /// Make the ribbon color button visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon color button hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the enabled state of the color button. @@ -687,10 +681,7 @@ public GroupButtonType ButtonType /// /// Resets the ShortcutKeys property to its default value. /// - public void ResetShortcutKeys() - { - ShortcutKeys = Keys.None; - } + public void ResetShortcutKeys() => ShortcutKeys = Keys.None; /// /// Gets access to the Wrapped Controls Tooltips. @@ -702,6 +693,7 @@ public void ResetShortcutKeys() /// [Category(@"Appearance")] [Description(@"Collection of recent colors.")] + [AllowNull] public Color[] RecentColors { get => _recentColors.ToArray(); @@ -721,10 +713,7 @@ public Color[] RecentColors /// /// Clear the recent colors setting. /// - public void ClearRecentColors() - { - _recentColors.Clear(); - } + public void ClearRecentColors() => _recentColors.Clear(); /// /// Gets and sets the associated KryptonCommand. @@ -833,36 +822,24 @@ public override ViewBase CreateView(KryptonRibbon ribbon, /// /// Generates a Click event for a button. /// - public void PerformClick() - { - PerformClick(null); - } + public void PerformClick() => PerformClick(null); /// /// Generates a Click event for a button. /// /// Delegate fired during event processing. - public void PerformClick(EventHandler finishDelegate) - { - OnClick(finishDelegate); - } + public void PerformClick(EventHandler? finishDelegate) => OnClick(finishDelegate); /// /// Generates a DropDown event for a button. /// - public void PerformDropDown() - { - PerformDropDown(null); - } + public void PerformDropDown() => PerformDropDown(null); /// /// Generates a DropDown event for a button. /// /// Delegate fired during event processing. - public void PerformDropDown(EventHandler finishDelegate) - { - OnDropDown(finishDelegate); - } + public void PerformDropDown(EventHandler? finishDelegate) => OnDropDown(finishDelegate); /// /// Internal design time properties. @@ -870,7 +847,7 @@ public void PerformDropDown(EventHandler finishDelegate) [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [EditorBrowsable(EditorBrowsableState.Never)] [Browsable(false)] - public ViewBase ColorButtonView { get; set; } + public ViewBase? ColorButtonView { get; set; } #endregion @@ -911,7 +888,7 @@ protected virtual void OnCommandPropertyChanged(object sender, PropertyChangedEv /// Raises the Click event. /// /// Delegate fired during event processing. - protected virtual void OnClick(EventHandler finishDelegate) + protected virtual void OnClick(EventHandler? finishDelegate) { var fireDelegate = true; @@ -967,7 +944,7 @@ protected virtual void OnClick(EventHandler finishDelegate) /// Raises the DropDown event. /// /// Delegate fired during event processing. - protected virtual void OnDropDown(EventHandler finishDelegate) + protected virtual void OnDropDown(EventHandler? finishDelegate) { var fireDelegate = true; @@ -989,7 +966,7 @@ protected virtual void OnDropDown(EventHandler finishDelegate) DropDown?.Invoke(this, contextArgs); // If user did not cancel and there is still a krypton context menu strip to show - if (contextArgs is { Cancel: false, KryptonContextMenu: { } }) + if (contextArgs is { Cancel: false, KryptonContextMenu: not null }) { var screenRect = Rectangle.Empty; @@ -1038,44 +1015,29 @@ protected virtual void OnDropDown(EventHandler finishDelegate) /// Raises the SelectedColorChanged event. /// /// New selected color. - protected virtual void OnSelectedColorChanged(Color selectedColor) - { - SelectedColorChanged?.Invoke(this, new ColorEventArgs(selectedColor)); - } + protected virtual void OnSelectedColorChanged(Color selectedColor) => SelectedColorChanged?.Invoke(this, new ColorEventArgs(selectedColor)); /// /// Raises the TrackingColor event. /// /// An ColorEventArgs that contains the event data. - protected virtual void OnTrackingColor(ColorEventArgs e) - { - TrackingColor?.Invoke(this, e); - } + protected virtual void OnTrackingColor(ColorEventArgs e) => TrackingColor?.Invoke(this, e); /// /// Raises the MoreColors event. /// /// An CancelEventArgs that contains the event data. - protected virtual void OnMoreColors(CancelEventArgs e) - { - MoreColors?.Invoke(this, e); - } + protected virtual void OnMoreColors(CancelEventArgs e) => MoreColors?.Invoke(this, e); /// /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Internal - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal override bool ProcessCmdKey(ref Message msg, Keys keyData) { @@ -1281,24 +1243,14 @@ private void DecideOnVisible(KryptonContextMenuItemBase visible, KryptonContextM } } } - visible.Visible = previous; } - private void OnColumnsTrackingColor(object sender, ColorEventArgs e) - { - OnTrackingColor(new ColorEventArgs(e.Color)); - } + private void OnColumnsTrackingColor(object sender, ColorEventArgs e) => OnTrackingColor(new ColorEventArgs(e.Color)); - private void OnColumnsSelectedColorChanged(object sender, ColorEventArgs e) - { - SelectedColor = e.Color; - } + private void OnColumnsSelectedColorChanged(object sender, ColorEventArgs e) => SelectedColor = e.Color; - private void OnClickNoColor(object sender, EventArgs e) - { - SelectedColor = Color.Empty; - } + private void OnClickNoColor(object sender, EventArgs e) => SelectedColor = Color.Empty; private void OnClickMoreColors(object sender, EventArgs e) { @@ -1310,8 +1262,7 @@ private void OnClickMoreColors(object sender, EventArgs e) if (!cea.Cancel) { // Use a standard color dialog for the selection of custom colors - // TODO: Use Kyptonised version ?? - var cd = new ColorDialog + var cd = new KryptonColorDialog { Color = SelectedColor, FullOpen = true @@ -1327,7 +1278,7 @@ private void OnClickMoreColors(object sender, EventArgs e) private void OnKryptonContextMenuClosed(object sender, EventArgs e) { - KryptonContextMenu kcm = (KryptonContextMenu)sender; + var kcm = (KryptonContextMenu)sender; kcm.Closed -= OnKryptonContextMenuClosed; // Fire any associated finish delegate diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupComboBox.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupComboBox.cs index 3805a01a1..4be198181 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupComboBox.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupComboBox.cs @@ -293,10 +293,7 @@ public override KryptonRibbon? Ribbon /// /// Resets the ShortcutKeys property to its default value. /// - public void ResetShortcutKeys() - { - ShortcutKeys = Keys.None; - } + public void ResetShortcutKeys() => ShortcutKeys = Keys.None; /// /// Access to the actual embedded KryptonComboBox instance. @@ -357,18 +354,12 @@ public override bool Visible /// /// Make the ribbon group visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon group hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the enabled state of the group combo box. @@ -838,18 +829,12 @@ public bool DroppedDown /// /// The position of the first character in the current text selection within the text box. /// The number of characters to select. - public void Select(int start, int length) - { - ComboBox.Select(start, length); - } + public void Select(int start, int length) => ComboBox.Select(start, length); /// /// Selects all text in the control. /// - public void SelectAll() - { - ComboBox.SelectAll(); - } + public void SelectAll() => ComboBox.SelectAll(); /// /// Gets and sets the maximum allowed size of the item. @@ -931,191 +916,128 @@ public override ViewBase CreateView(KryptonRibbon ribbon, /// Raises the TextUpdate event. /// /// An EventArgs containing the event data. - protected virtual void OnTextUpdate(EventArgs e) - { - TextUpdate?.Invoke(this, e); - } + protected virtual void OnTextUpdate(EventArgs e) => TextUpdate?.Invoke(this, e); /// /// Raises the SelectionChangeCommitted event. /// /// An EventArgs containing the event data. - protected virtual void OnSelectionChangeCommitted(EventArgs e) - { - SelectionChangeCommitted?.Invoke(this, e); - } + protected virtual void OnSelectionChangeCommitted(EventArgs e) => SelectionChangeCommitted?.Invoke(this, e); /// /// Raises the SelectedIndexChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnSelectedIndexChanged(EventArgs e) - { - SelectedIndexChanged?.Invoke(this, e); - } + protected virtual void OnSelectedIndexChanged(EventArgs e) => SelectedIndexChanged?.Invoke(this, e); /// /// Raises the DropDownStyleChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnDropDownStyleChanged(EventArgs e) - { - DropDownStyleChanged?.Invoke(this, e); - } + protected virtual void OnDropDownStyleChanged(EventArgs e) => DropDownStyleChanged?.Invoke(this, e); /// /// Raises the DataSourceChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnDataSourceChanged(EventArgs e) - { - DataSourceChanged?.Invoke(this, e); - } + protected virtual void OnDataSourceChanged(EventArgs e) => DataSourceChanged?.Invoke(this, e); /// /// Raises the DisplayMemberChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnDisplayMemberChanged(EventArgs e) - { - DisplayMemberChanged?.Invoke(this, e); - } + protected virtual void OnDisplayMemberChanged(EventArgs e) => DisplayMemberChanged?.Invoke(this, e); /// /// Raises the Format event. /// /// An EventArgs containing the event data. - protected virtual void OnFormat(EventArgs e) - { - Format?.Invoke(this, e); - } + protected virtual void OnFormat(EventArgs e) => Format?.Invoke(this, e); /// /// Raises the FormatInfoChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnFormatInfoChanged(EventArgs e) - { - FormatInfoChanged?.Invoke(this, e); - } + protected virtual void OnFormatInfoChanged(EventArgs e) => FormatInfoChanged?.Invoke(this, e); /// /// Raises the FormatStringChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnFormatStringChanged(EventArgs e) - { - FormatStringChanged?.Invoke(this, e); - } + protected virtual void OnFormatStringChanged(EventArgs e) => FormatStringChanged?.Invoke(this, e); /// /// Raises the FormattingEnabledChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnFormattingEnabledChanged(EventArgs e) - { - FormattingEnabledChanged?.Invoke(this, e); - } + protected virtual void OnFormattingEnabledChanged(EventArgs e) => FormattingEnabledChanged?.Invoke(this, e); /// /// Raises the SelectedValueChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnSelectedValueChanged(EventArgs e) - { - SelectedValueChanged?.Invoke(this, e); - } + protected virtual void OnSelectedValueChanged(EventArgs e) => SelectedValueChanged?.Invoke(this, e); /// /// Raises the ValueMemberChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnValueMemberChanged(EventArgs e) - { - ValueMemberChanged?.Invoke(this, e); - } + protected virtual void OnValueMemberChanged(EventArgs e) => ValueMemberChanged?.Invoke(this, e); /// /// Raises the DropDownClosed event. /// /// An EventArgs containing the event data. - protected virtual void OnDropDownClosed(EventArgs e) - { - DropDownClosed?.Invoke(this, e); - } + protected virtual void OnDropDownClosed(EventArgs e) => DropDownClosed?.Invoke(this, e); /// /// Raises the DropDown event. /// /// An EventArgs containing the event data. - protected virtual void OnDropDown(EventArgs e) - { - DropDown?.Invoke(this, e); - } + protected virtual void OnDropDown(EventArgs e) => DropDown?.Invoke(this, e); /// /// Raises the GotFocus event. /// /// An EventArgs containing the event data. - protected virtual void OnGotFocus(EventArgs e) - { - GotFocus?.Invoke(this, e); - } + protected virtual void OnGotFocus(EventArgs e) => GotFocus?.Invoke(this, e); /// /// Raises the LostFocus event. /// /// An EventArgs containing the event data. - protected virtual void OnLostFocus(EventArgs e) - { - LostFocus?.Invoke(this, e); - } + protected virtual void OnLostFocus(EventArgs e) => LostFocus?.Invoke(this, e); /// /// Raises the KeyDown event. /// /// An KeyEventArgs containing the event data. - protected virtual void OnKeyDown(KeyEventArgs e) - { - KeyDown?.Invoke(this, e); - } + protected virtual void OnKeyDown(KeyEventArgs e) => KeyDown?.Invoke(this, e); /// /// Raises the KeyUp event. /// /// An KeyEventArgs containing the event data. - protected virtual void OnKeyUp(KeyEventArgs e) - { - KeyUp?.Invoke(this, e); - } + protected virtual void OnKeyUp(KeyEventArgs e) => KeyUp?.Invoke(this, e); /// /// Raises the KeyPress event. /// /// An KeyPressEventArgs containing the event data. - protected virtual void OnKeyPress(KeyPressEventArgs e) - { - KeyPress?.Invoke(this, e); - } + protected virtual void OnKeyPress(KeyPressEventArgs e) => KeyPress?.Invoke(this, e); /// /// Raises the PreviewKeyDown event. /// /// An PreviewKeyDownEventArgs containing the event data. - protected virtual void OnPreviewKeyDown(PreviewKeyDownEventArgs e) - { - PreviewKeyDown?.Invoke(this, e); - } + protected virtual void OnPreviewKeyDown(PreviewKeyDownEventArgs e) => PreviewKeyDown?.Invoke(this, e); /// /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Internal @@ -1125,10 +1047,7 @@ protected virtual void OnPropertyChanged(string propertyName) internal NeedPaintHandler? ViewPaintDelegate { get; set; } - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal override bool ProcessCmdKey(ref Message msg, Keys keyData) { @@ -1174,126 +1093,55 @@ private void UnmonitorControl(KryptonComboBox c) c.TrackMouseLeave -= OnControlLeave; } - private void OnControlEnter(object sender, EventArgs e) - { - MouseEnterControl?.Invoke(this, e); - } + private void OnControlEnter(object sender, EventArgs e) => MouseEnterControl?.Invoke(this, e); - private void OnControlLeave(object sender, EventArgs e) - { - MouseLeaveControl?.Invoke(this, e); - } + private void OnControlLeave(object sender, EventArgs e) => MouseLeaveControl?.Invoke(this, e); - private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) - { + private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) => // Pass request onto the view provided paint delegate ViewPaintDelegate?.Invoke(this, e); - } - private void OnComboBoxGotFocus(object sender, EventArgs e) - { - OnGotFocus(e); - } + private void OnComboBoxGotFocus(object sender, EventArgs e) => OnGotFocus(e); - private void OnComboBoxLostFocus(object sender, EventArgs e) - { - OnLostFocus(e); - } + private void OnComboBoxLostFocus(object sender, EventArgs e) => OnLostFocus(e); - private void OnComboBoxTextUpdate(object sender, EventArgs e) - { - OnTextUpdate(e); - } + private void OnComboBoxTextUpdate(object sender, EventArgs e) => OnTextUpdate(e); - private void OnComboBoxSelectionChangeCommitted(object sender, EventArgs e) - { - OnSelectionChangeCommitted(e); - } + private void OnComboBoxSelectionChangeCommitted(object sender, EventArgs e) => OnSelectionChangeCommitted(e); - private void OnComboBoxSelectedIndexChanged(object sender, EventArgs e) - { - OnSelectedIndexChanged(e); - } + private void OnComboBoxSelectedIndexChanged(object sender, EventArgs e) => OnSelectedIndexChanged(e); - private void OnComboBoxDropDownStyleChanged(object sender, EventArgs e) - { - OnDropDownStyleChanged(e); - } + private void OnComboBoxDropDownStyleChanged(object sender, EventArgs e) => OnDropDownStyleChanged(e); - private void OnComboBoxDataSourceChanged(object sender, EventArgs e) - { - OnDataSourceChanged(e); - } + private void OnComboBoxDataSourceChanged(object sender, EventArgs e) => OnDataSourceChanged(e); - private void OnComboBoxDisplayMemberChanged(object sender, EventArgs e) - { - OnDisplayMemberChanged(e); - } + private void OnComboBoxDisplayMemberChanged(object sender, EventArgs e) => OnDisplayMemberChanged(e); - private void OnComboBoxDropDownClosed(object sender, EventArgs e) - { - OnDropDownClosed(e); - } + private void OnComboBoxDropDownClosed(object sender, EventArgs e) => OnDropDownClosed(e); - private void OnComboBoxDropDown(object sender, EventArgs e) - { - OnDropDown(e); - } + private void OnComboBoxDropDown(object sender, EventArgs e) => OnDropDown(e); - private void OnComboBoxKeyPress(object sender, KeyPressEventArgs e) - { - OnKeyPress(e); - } + private void OnComboBoxKeyPress(object sender, KeyPressEventArgs e) => OnKeyPress(e); - private void OnComboBoxKeyUp(object sender, KeyEventArgs e) - { - OnKeyUp(e); - } + private void OnComboBoxKeyUp(object sender, KeyEventArgs e) => OnKeyUp(e); - private void OnComboBoxKeyDown(object sender, KeyEventArgs e) - { - OnKeyDown(e); - } + private void OnComboBoxKeyDown(object sender, KeyEventArgs e) => OnKeyDown(e); - private void OnComboBoxPreviewKeyDown(object sender, PreviewKeyDownEventArgs e) - { - OnPreviewKeyDown(e); - } + private void OnComboBoxPreviewKeyDown(object sender, PreviewKeyDownEventArgs e) => OnPreviewKeyDown(e); - private void OnComboBoxFormat(object sender, ListControlConvertEventArgs e) - { - OnFormat(e); - } + private void OnComboBoxFormat(object sender, ListControlConvertEventArgs e) => OnFormat(e); - private void OnComboBoxFormatInfoChanged(object sender, EventArgs e) - { - OnFormatInfoChanged(e); - } + private void OnComboBoxFormatInfoChanged(object sender, EventArgs e) => OnFormatInfoChanged(e); - private void OnComboBoxFormatStringChanged(object sender, EventArgs e) - { - OnFormatStringChanged(e); - } + private void OnComboBoxFormatStringChanged(object sender, EventArgs e) => OnFormatStringChanged(e); - private void OnComboBoxFormattingEnabledChanged(object sender, EventArgs e) - { - OnFormattingEnabledChanged(e); - } + private void OnComboBoxFormattingEnabledChanged(object sender, EventArgs e) => OnFormattingEnabledChanged(e); - private void OnComboBoxSelectedValueChanged(object sender, EventArgs e) - { - OnSelectedValueChanged(e); - } + private void OnComboBoxSelectedValueChanged(object sender, EventArgs e) => OnSelectedValueChanged(e); - private void OnComboBoxValueMemberChanged(object sender, EventArgs e) - { - OnValueMemberChanged(e); - } + private void OnComboBoxValueMemberChanged(object sender, EventArgs e) => OnValueMemberChanged(e); - private void OnRibbonPaletteChanged(object sender, EventArgs e) - { - ComboBox.Palette = Ribbon.GetResolvedPalette(); - } + private void OnRibbonPaletteChanged(object sender, EventArgs e) => ComboBox.Palette = Ribbon.GetResolvedPalette(); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupCustomControl.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupCustomControl.cs index e5a68aebc..572f9ff3b 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupCustomControl.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupCustomControl.cs @@ -101,10 +101,7 @@ protected override void Dispose(bool disposing) /// /// Resets the ShortcutKeys property to its default value. /// - public void ResetShortcutKeys() - { - ShortcutKeys = Keys.None; - } + public void ResetShortcutKeys() => ShortcutKeys = Keys.None; /// /// Gets and sets the key tip for the ribbon group custom control. @@ -229,18 +226,12 @@ public override bool Visible /// /// Make the ribbon group visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon group hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the maximum allowed size of the item. @@ -320,10 +311,7 @@ public override ViewBase CreateView(KryptonRibbon ribbon, /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Internal @@ -333,10 +321,7 @@ protected virtual void OnPropertyChanged(string propertyName) internal NeedPaintHandler ViewPaintDelegate { get; set; } - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal override bool ProcessCmdKey(ref Message msg, Keys keyData) { @@ -392,21 +377,13 @@ private void UnmonitorControl(Control c) } } - private void OnCustomControlEnter(object sender, EventArgs e) - { - MouseEnterControl?.Invoke(this, e); - } + private void OnCustomControlEnter(object sender, EventArgs e) => MouseEnterControl?.Invoke(this, e); - private void OnCustomControlLeave(object sender, EventArgs e) - { - MouseLeaveControl?.Invoke(this, e); - } + private void OnCustomControlLeave(object sender, EventArgs e) => MouseLeaveControl?.Invoke(this, e); - private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) - { + private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) => // Pass request onto the view provided paint delegate ViewPaintDelegate?.Invoke(this, e); - } #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupDateTimePicker.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupDateTimePicker.cs index 0c4daa4a8..14518028e 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupDateTimePicker.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupDateTimePicker.cs @@ -231,10 +231,7 @@ public override KryptonRibbon? Ribbon /// /// Resets the ShortcutKeys property to its default value. /// - public void ResetShortcutKeys() - { - ShortcutKeys = Keys.None; - } + public void ResetShortcutKeys() => ShortcutKeys = Keys.None; /// /// Access to the actual embedded KryptonDateTimePicker instance. @@ -295,18 +292,12 @@ public override bool Visible /// /// Make the ribbon group date time picker visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon group date time picker hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the enabled state of the group date time picker. @@ -432,10 +423,7 @@ public string CalendarTodayText set => DateTimePicker.CalendarTodayText = value; } - private void ResetCalendarTodayText() - { - DateTimePicker.ResetCalendarTodayText(); - } + private void ResetCalendarTodayText() => DateTimePicker.ResetCalendarTodayText(); /// /// First day of the week. @@ -509,10 +497,7 @@ public DateTime CalendarTodayDate set => DateTimePicker.CalendarTodayDate = value; } - private void ResetCalendarTodayDate() - { - CalendarTodayDate = DateTime.Now.Date; - } + private void ResetCalendarTodayDate() => CalendarTodayDate = DateTime.Now.Date; private bool ShouldSerializeCalendarTodayDate() => CalendarTodayDate != DateTime.Now.Date; @@ -528,10 +513,7 @@ public DateTime[] CalendarAnnuallyBoldedDates set => DateTimePicker.CalendarAnnuallyBoldedDates = value; } - private void ResetCalendarAnnuallyBoldedDates() - { - CalendarAnnuallyBoldedDates = null; - } + private void ResetCalendarAnnuallyBoldedDates() => CalendarAnnuallyBoldedDates = null; private bool ShouldSerializeCalendarAnnuallyBoldedDates() => DateTimePicker.ShouldSerializeCalendarAnnuallyBoldedDates(); @@ -547,10 +529,7 @@ public DateTime[] CalendarMonthlyBoldedDates set => DateTimePicker.CalendarMonthlyBoldedDates = value; } - private void ResetCalendarMonthlyBoldedDates() - { - CalendarMonthlyBoldedDates = null; - } + private void ResetCalendarMonthlyBoldedDates() => CalendarMonthlyBoldedDates = null; private bool ShouldSerializeCalendarMonthlyBoldedDates() => DateTimePicker.ShouldSerializeCalendarMonthlyBoldedDates(); @@ -566,10 +545,7 @@ public DateTime[] CalendarBoldedDates set => DateTimePicker.CalendarBoldedDates = value; } - private void ResetCalendarBoldedDates() - { - CalendarBoldedDates = null; - } + private void ResetCalendarBoldedDates() => CalendarBoldedDates = null; private bool ShouldSerializeCalendarBoldedDates() => DateTimePicker.ShouldSerializeCalendarBoldedDates(); @@ -600,10 +576,7 @@ public object ValueNullable set => DateTimePicker.ValueNullable = value; } - private void ResetValueNullable() - { - DateTimePicker.ResetValueNullable(); - } + private void ResetValueNullable() => DateTimePicker.ResetValueNullable(); private bool ShouldSerializeValueNullable() => DateTimePicker.ShouldSerializeValueNullable(); @@ -620,10 +593,7 @@ public DateTime Value set => DateTimePicker.Value = value; } - private void ResetValue() - { - DateTimePicker.ResetValue(); - } + private void ResetValue() => DateTimePicker.ResetValue(); private bool ShouldSerializeValue() => DateTimePicker.ShouldSerializeValue(); @@ -687,10 +657,7 @@ public DateTime MaxDate set => DateTimePicker.MaxDate = value; } - private void ResetMaxDate() - { - MaxDate = DateTime.MaxValue; - } + private void ResetMaxDate() => MaxDate = DateTime.MaxValue; private bool ShouldSerializeMaxDate() => DateTimePicker.ShouldSerializeMaxDate(); @@ -705,10 +672,7 @@ public DateTime MinDate set => DateTimePicker.MinDate = value; } - private void ResetMinDate() - { - MinDate = DateTime.MinValue; - } + private void ResetMinDate() => MinDate = DateTime.MinValue; private bool ShouldSerializeMinDate() => DateTimePicker.ShouldSerializeMinDate(); @@ -779,10 +743,7 @@ public HeaderStyle CalendarHeaderStyle set => DateTimePicker.CalendarHeaderStyle = value; } - private void ResetCalendarHeaderStyle() - { - CalendarHeaderStyle = HeaderStyle.Calendar; - } + private void ResetCalendarHeaderStyle() => CalendarHeaderStyle = HeaderStyle.Calendar; private bool ShouldSerializeCalendarHeaderStyle() => CalendarHeaderStyle != HeaderStyle.Calendar; @@ -797,10 +758,7 @@ public ButtonStyle CalendarDayStyle set => DateTimePicker.CalendarDayStyle = value; } - private void ResetCalendarDayStyle() - { - CalendarDayStyle = ButtonStyle.CalendarDay; - } + private void ResetCalendarDayStyle() => CalendarDayStyle = ButtonStyle.CalendarDay; private bool ShouldSerializeCalendarDayStyle() => CalendarDayStyle != ButtonStyle.CalendarDay; @@ -815,10 +773,7 @@ public ButtonStyle CalendarDayOfWeekStyle set => DateTimePicker.CalendarDayOfWeekStyle = value; } - private void ResetCalendarDayOfWeekStyle() - { - CalendarDayOfWeekStyle = ButtonStyle.CalendarDay; - } + private void ResetCalendarDayOfWeekStyle() => CalendarDayOfWeekStyle = ButtonStyle.CalendarDay; private bool ShouldSerializeCalendarDayOfWeekStyle() => CalendarDayOfWeekStyle != ButtonStyle.CalendarDay; @@ -898,118 +853,79 @@ public override GroupItemSize ItemSizeCurrent /// Raises the GotFocus event. /// /// An EventArgs containing the event data. - protected virtual void OnGotFocus(EventArgs e) - { - GotFocus?.Invoke(this, e); - } + protected virtual void OnGotFocus(EventArgs e) => GotFocus?.Invoke(this, e); /// /// Raises the LostFocus event. /// /// An EventArgs containing the event data. - protected virtual void OnLostFocus(EventArgs e) - { - LostFocus?.Invoke(this, e); - } + protected virtual void OnLostFocus(EventArgs e) => LostFocus?.Invoke(this, e); /// /// Raises the FormatChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnFormatChanged(EventArgs e) - { - FormatChanged?.Invoke(this, e); - } + protected virtual void OnFormatChanged(EventArgs e) => FormatChanged?.Invoke(this, e); /// /// Raises the CheckedChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnCheckedChanged(EventArgs e) - { - CheckedChanged?.Invoke(this, e); - } + protected virtual void OnCheckedChanged(EventArgs e) => CheckedChanged?.Invoke(this, e); /// /// Raises the CloseUp event. /// /// An DateTimePickerCloseArgs containing the event data. - protected virtual void OnCloseUp(DateTimePickerCloseArgs e) - { - CloseUp?.Invoke(this, e); - } + protected virtual void OnCloseUp(DateTimePickerCloseArgs e) => CloseUp?.Invoke(this, e); /// /// Raises the DropDown event. /// /// An DateTimePickerDropArgs containing the event data. - protected virtual void OnDropDown(DateTimePickerDropArgs e) - { - DropDown?.Invoke(this, e); - } + protected virtual void OnDropDown(DateTimePickerDropArgs e) => DropDown?.Invoke(this, e); /// /// Raises the ValueNullableChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnValueNullableChanged(EventArgs e) - { - ValueNullableChanged?.Invoke(this, e); - } + protected virtual void OnValueNullableChanged(EventArgs e) => ValueNullableChanged?.Invoke(this, e); /// /// Raises the ValueChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnValueChanged(EventArgs e) - { - ValueChanged?.Invoke(this, e); - } + protected virtual void OnValueChanged(EventArgs e) => ValueChanged?.Invoke(this, e); /// /// Raises the KeyDown event. /// /// An KeyEventArgs containing the event data. - protected virtual void OnKeyDown(KeyEventArgs e) - { - KeyDown?.Invoke(this, e); - } + protected virtual void OnKeyDown(KeyEventArgs e) => KeyDown?.Invoke(this, e); /// /// Raises the KeyUp event. /// /// An KeyEventArgs containing the event data. - protected virtual void OnKeyUp(KeyEventArgs e) - { - KeyUp?.Invoke(this, e); - } + protected virtual void OnKeyUp(KeyEventArgs e) => KeyUp?.Invoke(this, e); /// /// Raises the KeyPress event. /// /// An KeyPressEventArgs containing the event data. - protected virtual void OnKeyPress(KeyPressEventArgs e) - { - KeyPress?.Invoke(this, e); - } + protected virtual void OnKeyPress(KeyPressEventArgs e) => KeyPress?.Invoke(this, e); /// /// Raises the PreviewKeyDown event. /// /// An PreviewKeyDownEventArgs containing the event data. - protected virtual void OnPreviewKeyDown(PreviewKeyDownEventArgs e) - { - PreviewKeyDown?.Invoke(this, e); - } + protected virtual void OnPreviewKeyDown(PreviewKeyDownEventArgs e) => PreviewKeyDown?.Invoke(this, e); /// /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Internal @@ -1019,10 +935,7 @@ protected virtual void OnPropertyChanged(string propertyName) internal NeedPaintHandler ViewPaintDelegate { get; set; } - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal override bool ProcessCmdKey(ref Message msg, Keys keyData) { @@ -1064,86 +977,39 @@ private void UnmonitorControl(KryptonDateTimePicker c) c.MouseLeave -= OnControlLeave; } - private void OnControlEnter(object sender, EventArgs e) - { - MouseEnterControl?.Invoke(this, e); - } + private void OnControlEnter(object sender, EventArgs e) => MouseEnterControl?.Invoke(this, e); - private void OnControlLeave(object sender, EventArgs e) - { - MouseLeaveControl?.Invoke(this, e); - } + private void OnControlLeave(object sender, EventArgs e) => MouseLeaveControl?.Invoke(this, e); - private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) - { + private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) => // Pass request onto the view provided paint delegate ViewPaintDelegate?.Invoke(this, e); - } - private void OnDateTimePickerGotFocus(object sender, EventArgs e) - { - OnGotFocus(e); - } + private void OnDateTimePickerGotFocus(object sender, EventArgs e) => OnGotFocus(e); - private void OnDateTimePickerLostFocus(object sender, EventArgs e) - { - OnLostFocus(e); - } + private void OnDateTimePickerLostFocus(object sender, EventArgs e) => OnLostFocus(e); - private void OnDateTimePickerFormatChanged(object sender, EventArgs e) - { - OnFormatChanged(e); - } + private void OnDateTimePickerFormatChanged(object sender, EventArgs e) => OnFormatChanged(e); - private void OnDateTimePickerCheckedChanged(object sender, EventArgs e) - { - OnCheckedChanged(e); - } + private void OnDateTimePickerCheckedChanged(object sender, EventArgs e) => OnCheckedChanged(e); - private void OnDateTimePickerCloseUp(object sender, DateTimePickerCloseArgs e) - { - OnCloseUp(e); - } + private void OnDateTimePickerCloseUp(object sender, DateTimePickerCloseArgs e) => OnCloseUp(e); - private void OnDateTimePickerDropDown(object sender, DateTimePickerDropArgs e) - { - OnDropDown(e); - } + private void OnDateTimePickerDropDown(object sender, DateTimePickerDropArgs e) => OnDropDown(e); - private void OnDateTimePickerValueNullableChanged(object sender, EventArgs e) - { - OnValueNullableChanged(e); - } + private void OnDateTimePickerValueNullableChanged(object sender, EventArgs e) => OnValueNullableChanged(e); - private void OnDateTimePickerValueChanged(object sender, EventArgs e) - { - OnValueChanged(e); - } + private void OnDateTimePickerValueChanged(object sender, EventArgs e) => OnValueChanged(e); - private void OnDateTimePickerKeyPress(object sender, KeyPressEventArgs e) - { - OnKeyPress(e); - } + private void OnDateTimePickerKeyPress(object sender, KeyPressEventArgs e) => OnKeyPress(e); - private void OnDateTimePickerKeyUp(object sender, KeyEventArgs e) - { - OnKeyUp(e); - } + private void OnDateTimePickerKeyUp(object sender, KeyEventArgs e) => OnKeyUp(e); - private void OnDateTimePickerKeyDown(object sender, KeyEventArgs e) - { - OnKeyDown(e); - } + private void OnDateTimePickerKeyDown(object sender, KeyEventArgs e) => OnKeyDown(e); - private void OnDateTimePickerKeyDown(object sender, PreviewKeyDownEventArgs e) - { - OnPreviewKeyDown(e); - } + private void OnDateTimePickerKeyDown(object sender, PreviewKeyDownEventArgs e) => OnPreviewKeyDown(e); - private void OnRibbonPaletteChanged(object sender, EventArgs e) - { - DateTimePicker.Palette = Ribbon.GetResolvedPalette(); - } + private void OnRibbonPaletteChanged(object sender, EventArgs e) => DateTimePicker.Palette = Ribbon.GetResolvedPalette(); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupDomainUpDown.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupDomainUpDown.cs index f51c2c97b..6f1aff984 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupDomainUpDown.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupDomainUpDown.cs @@ -240,10 +240,7 @@ public string Text /// /// Resets the ShortcutKeys property to its default value. /// - public void ResetShortcutKeys() - { - ShortcutKeys = Keys.None; - } + public void ResetShortcutKeys() => ShortcutKeys = Keys.None; /// /// Gets or the collection of allowable items of the domain up down. @@ -386,18 +383,12 @@ public override bool Visible /// /// Make the ribbon group domain up-down visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon group domain up-down hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the enabled state of the group domain up-down. @@ -503,10 +494,7 @@ public bool AllowButtonSpecToolTipPriority /// /// The position of the first character in the current text selection within the text box. /// The number of characters to select. - public void Select(int start, int length) - { - DomainUpDown.Select(start, length); - } + public void Select(int start, int length) => DomainUpDown.Select(start, length); /// /// Gets and sets the maximum allowed size of the item. @@ -586,91 +574,61 @@ public override ViewBase CreateView(KryptonRibbon ribbon, /// Raises the GotFocus event. /// /// An EventArgs containing the event data. - protected virtual void OnGotFocus(EventArgs e) - { - GotFocus?.Invoke(this, e); - } + protected virtual void OnGotFocus(EventArgs e) => GotFocus?.Invoke(this, e); /// /// Raises the LostFocus event. /// /// An EventArgs containing the event data. - protected virtual void OnLostFocus(EventArgs e) - { - LostFocus?.Invoke(this, e); - } + protected virtual void OnLostFocus(EventArgs e) => LostFocus?.Invoke(this, e); /// /// Raises the KeyDown event. /// /// An KeyEventArgs containing the event data. - protected virtual void OnKeyDown(KeyEventArgs e) - { - KeyDown?.Invoke(this, e); - } + protected virtual void OnKeyDown(KeyEventArgs e) => KeyDown?.Invoke(this, e); /// /// Raises the KeyUp event. /// /// An KeyEventArgs containing the event data. - protected virtual void OnKeyUp(KeyEventArgs e) - { - KeyUp?.Invoke(this, e); - } + protected virtual void OnKeyUp(KeyEventArgs e) => KeyUp?.Invoke(this, e); /// /// Raises the KeyPress event. /// /// An KeyPressEventArgs containing the event data. - protected virtual void OnKeyPress(KeyPressEventArgs e) - { - KeyPress?.Invoke(this, e); - } + protected virtual void OnKeyPress(KeyPressEventArgs e) => KeyPress?.Invoke(this, e); /// /// Raises the PreviewKeyDown event. /// /// An PreviewKeyDownEventArgs containing the event data. - protected virtual void OnPreviewKeyDown(PreviewKeyDownEventArgs e) - { - PreviewKeyDown?.Invoke(this, e); - } + protected virtual void OnPreviewKeyDown(PreviewKeyDownEventArgs e) => PreviewKeyDown?.Invoke(this, e); /// /// Raises the SelectedItemChanged event. /// /// An EventArgs that contains the event data. - protected virtual void OnSelectedItemChanged(EventArgs e) - { - SelectedItemChanged?.Invoke(this, e); - } + protected virtual void OnSelectedItemChanged(EventArgs e) => SelectedItemChanged?.Invoke(this, e); /// /// Raises the TextChanged event. /// /// A EventArgs that contains the event data. - protected virtual void OnTextChanged(EventArgs e) - { - TextChanged?.Invoke(this, e); - } + protected virtual void OnTextChanged(EventArgs e) => TextChanged?.Invoke(this, e); /// /// Raises the SelectedItemChanged event. /// /// A ScrollEventArgs that contains the event data. - protected virtual void OnScroll(ScrollEventArgs e) - { - Scroll?.Invoke(this, e); - } + protected virtual void OnScroll(ScrollEventArgs e) => Scroll?.Invoke(this, e); /// /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Internal @@ -680,10 +638,7 @@ protected virtual void OnPropertyChanged(string propertyName) internal NeedPaintHandler ViewPaintDelegate { get; set; } - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal override bool ProcessCmdKey(ref Message msg, Keys keyData) { @@ -729,71 +684,33 @@ private void UnmonitorControl(KryptonDomainUpDown c) c.TrackMouseLeave -= OnControlLeave; } - private void OnControlEnter(object sender, EventArgs e) - { - MouseEnterControl?.Invoke(this, e); - } + private void OnControlEnter(object sender, EventArgs e) => MouseEnterControl?.Invoke(this, e); - private void OnControlLeave(object sender, EventArgs e) - { - MouseLeaveControl?.Invoke(this, e); - } + private void OnControlLeave(object sender, EventArgs e) => MouseLeaveControl?.Invoke(this, e); - private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) - { + private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) => // Pass request onto the view provided paint delegate ViewPaintDelegate?.Invoke(this, e); - } - private void OnDomainUpDownScroll(object sender, ScrollEventArgs e) - { - OnScroll(e); - } + private void OnDomainUpDownScroll(object sender, ScrollEventArgs e) => OnScroll(e); - private void OnDomainUpDownSelectedItemChanged(object sender, EventArgs e) - { - OnSelectedItemChanged(e); - } + private void OnDomainUpDownSelectedItemChanged(object sender, EventArgs e) => OnSelectedItemChanged(e); - private void OnDomainUpDownTextChanged(object sender, EventArgs e) - { - OnTextChanged(e); - } + private void OnDomainUpDownTextChanged(object sender, EventArgs e) => OnTextChanged(e); - private void OnDomainUpDownGotFocus(object sender, EventArgs e) - { - OnGotFocus(e); - } + private void OnDomainUpDownGotFocus(object sender, EventArgs e) => OnGotFocus(e); - private void OnDomainUpDownLostFocus(object sender, EventArgs e) - { - OnLostFocus(e); - } + private void OnDomainUpDownLostFocus(object sender, EventArgs e) => OnLostFocus(e); - private void OnDomainUpDownKeyPress(object sender, KeyPressEventArgs e) - { - OnKeyPress(e); - } + private void OnDomainUpDownKeyPress(object sender, KeyPressEventArgs e) => OnKeyPress(e); - private void OnDomainUpDownKeyUp(object sender, KeyEventArgs e) - { - OnKeyUp(e); - } + private void OnDomainUpDownKeyUp(object sender, KeyEventArgs e) => OnKeyUp(e); - private void OnDomainUpDownKeyDown(object sender, KeyEventArgs e) - { - OnKeyDown(e); - } + private void OnDomainUpDownKeyDown(object sender, KeyEventArgs e) => OnKeyDown(e); - private void OnDomainUpDownPreviewKeyDown(object sender, PreviewKeyDownEventArgs e) - { - OnPreviewKeyDown(e); - } + private void OnDomainUpDownPreviewKeyDown(object sender, PreviewKeyDownEventArgs e) => OnPreviewKeyDown(e); - private void OnRibbonPaletteChanged(object sender, EventArgs e) - { - DomainUpDown.Palette = Ribbon.GetResolvedPalette(); - } + private void OnRibbonPaletteChanged(object sender, EventArgs e) => DomainUpDown.Palette = Ribbon.GetResolvedPalette(); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupGallery.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupGallery.cs index 59b09d3d6..63e71eaa9 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupGallery.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupGallery.cs @@ -34,7 +34,7 @@ public class KryptonRibbonGroupGallery : KryptonRibbonGroupContainer private bool _enabled; private string _textLine1; private string _textLine2; - private Image _imageLarge; + private Image? _imageLarge; private string _keyTip; private GroupItemSize _itemSizeMax; private GroupItemSize _itemSizeMin; @@ -377,7 +377,7 @@ public string KeyTip { if (string.IsNullOrEmpty(value)) { - value = "X"; + value = @"X"; } _keyTip = value.ToUpper(); @@ -492,18 +492,12 @@ public override bool Visible /// /// Make the ribbon group gallery visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon group gallery hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the enabled state of the group gallery. @@ -646,7 +640,7 @@ public override ViewBase CreateView(KryptonRibbon ribbon, [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [EditorBrowsable(EditorBrowsableState.Never)] [Browsable(false)] - public IKryptonDesignObject GalleryDesigner { get; set; } + public IKryptonDesignObject? GalleryDesigner { get; set; } /// /// Internal design time properties. @@ -659,16 +653,13 @@ public override ViewBase CreateView(KryptonRibbon ribbon, #endregion #region Internal - internal Control LastParentControl { get; set; } + internal Control? LastParentControl { get; set; } - internal KryptonGallery LastGallery { get; set; } + internal KryptonGallery? LastGallery { get; set; } internal NeedPaintHandler ViewPaintDelegate { get; set; } - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal int InternalItemCount { get; set; } @@ -681,64 +672,43 @@ internal void OnDesignTimeContextMenu(MouseEventArgs e) /// Raises the ImageListChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnImageListChanged(EventArgs e) - { - ImageListChanged?.Invoke(this, e); - } + protected virtual void OnImageListChanged(EventArgs e) => ImageListChanged?.Invoke(this, e); /// /// Raises the SelectedIndexChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnSelectedIndexChanged(EventArgs e) - { - SelectedIndexChanged?.Invoke(this, e); - } + protected virtual void OnSelectedIndexChanged(EventArgs e) => SelectedIndexChanged?.Invoke(this, e); /// /// Raises the SelectedIndexChanged event. /// /// An ImageSelectEventArgs containing the event data. - protected virtual void OnTrackingImage(ImageSelectEventArgs e) - { - TrackingImage?.Invoke(this, e); - } + protected virtual void OnTrackingImage(ImageSelectEventArgs e) => TrackingImage?.Invoke(this, e); /// /// Raises the GalleryDropMenu event. /// /// An GalleryDropMenuEventArgs containing the event data. - protected virtual void OnGalleryDropMenu(GalleryDropMenuEventArgs e) - { - GalleryDropMenu?.Invoke(this, e); - } + protected virtual void OnGalleryDropMenu(GalleryDropMenuEventArgs e) => GalleryDropMenu.Invoke(this, e); /// /// Raises the GotFocus event. /// /// An EventArgs containing the event data. - protected virtual void OnGotFocus(EventArgs e) - { - GotFocus?.Invoke(this, e); - } + protected virtual void OnGotFocus(EventArgs e) => GotFocus?.Invoke(this, e); /// /// Raises the LostFocus event. /// /// An EventArgs containing the event data. - protected virtual void OnLostFocus(EventArgs e) - { - LostFocus?.Invoke(this, e); - } + protected virtual void OnLostFocus(EventArgs e) => LostFocus?.Invoke(this, e); /// /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Implementation @@ -754,45 +724,21 @@ private void UnmonitorControl(KryptonGallery c) c.MouseLeave -= OnControlLeave; } - private void OnControlEnter(object sender, EventArgs e) - { - MouseEnterControl?.Invoke(this, e); - } + private void OnControlEnter(object sender, EventArgs e) => MouseEnterControl?.Invoke(this, e); - private void OnControlLeave(object sender, EventArgs e) - { - MouseLeaveControl?.Invoke(this, e); - } + private void OnControlLeave(object sender, EventArgs e) => MouseLeaveControl?.Invoke(this, e); - private void OnGalleryImageListChanged(object sender, EventArgs e) - { - OnImageListChanged(e); - } + private void OnGalleryImageListChanged(object sender, EventArgs e) => OnImageListChanged(e); - private void OnGallerySelectedIndexChanged(object sender, EventArgs e) - { - OnSelectedIndexChanged(e); - } + private void OnGallerySelectedIndexChanged(object sender, EventArgs e) => OnSelectedIndexChanged(e); - private void OnGalleryTrackingImage(object sender, ImageSelectEventArgs e) - { - OnTrackingImage(e); - } + private void OnGalleryTrackingImage(object sender, ImageSelectEventArgs e) => OnTrackingImage(e); - private void OnGalleryGalleryDropMenu(object sender, GalleryDropMenuEventArgs e) - { - OnGalleryDropMenu(e); - } + private void OnGalleryGalleryDropMenu(object sender, GalleryDropMenuEventArgs e) => OnGalleryDropMenu(e); - private void OnGalleryGotFocus(object sender, EventArgs e) - { - OnGotFocus(e); - } + private void OnGalleryGotFocus(object sender, EventArgs e) => OnGotFocus(e); - private void OnGalleryLostFocus(object sender, EventArgs e) - { - OnLostFocus(e); - } + private void OnGalleryLostFocus(object sender, EventArgs e) => OnLostFocus(e); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupItem.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupItem.cs index 6c8079c39..5e75d99fe 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupItem.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupItem.cs @@ -144,10 +144,7 @@ public object? Tag private bool ShouldSerializeTag() => Tag != null; - private void ResetTag() - { - Tag = null; - } + private void ResetTag() => Tag = null; /// /// Gets access to the Wrapped Controls Tooltips. diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupLabel.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupLabel.cs index d2c3eb66c..d7bc630e6 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupLabel.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupLabel.cs @@ -211,18 +211,12 @@ public override bool Visible /// /// Make the ribbon group visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon group hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the enabled state of the group label. @@ -401,19 +395,13 @@ protected virtual void OnCommandPropertyChanged(object sender, PropertyChangedEv /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Internal internal NeedPaintHandler ViewPaintDelegate { get; set; } - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal override bool ProcessCmdKey(ref Message msg, Keys keyData) => // A label never has any command keys to process @@ -422,11 +410,9 @@ internal override bool ProcessCmdKey(ref Message msg, Keys keyData) => #endregion #region Implementation - private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) - { + private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) => // Pass request onto the view provided paint delegate ViewPaintDelegate?.Invoke(this, e); - } #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupLines.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupLines.cs index eb1dc0455..32b4c38e3 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupLines.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupLines.cs @@ -267,18 +267,12 @@ public override bool Visible /// /// Make the ribbon group visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon group hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the maximum allowed size of the container. @@ -471,92 +465,41 @@ public override Component[] GetChildComponents() /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Internal - internal void OnDesignTimeAddButton() - { - DesignTimeAddButton?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddButton() => DesignTimeAddButton?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddColorButton() - { - DesignTimeAddColorButton?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddColorButton() => DesignTimeAddColorButton?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddCheckBox() - { - DesignTimeAddCheckBox?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddCheckBox() => DesignTimeAddCheckBox?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddRadioButton() - { - DesignTimeAddRadioButton?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddRadioButton() => DesignTimeAddRadioButton?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddLabel() - { - DesignTimeAddLabel?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddLabel() => DesignTimeAddLabel?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddCustomControl() - { - DesignTimeAddCustomControl?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddCustomControl() => DesignTimeAddCustomControl?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddCluster() - { - DesignTimeAddCluster?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddCluster() => DesignTimeAddCluster?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddTextBox() - { - DesignTimeAddTextBox?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddTextBox() => DesignTimeAddTextBox?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddMaskedTextBox() - { - DesignTimeAddMaskedTextBox?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddMaskedTextBox() => DesignTimeAddMaskedTextBox?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddRichTextBox() - { - DesignTimeAddRichTextBox?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddRichTextBox() => DesignTimeAddRichTextBox?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddComboBox() - { - DesignTimeAddComboBox?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddComboBox() => DesignTimeAddComboBox?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddNumericUpDown() - { - DesignTimeAddNumericUpDown?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddNumericUpDown() => DesignTimeAddNumericUpDown?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddDomainUpDown() - { - DesignTimeAddDomainUpDown?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddDomainUpDown() => DesignTimeAddDomainUpDown?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddDateTimePicker() - { - DesignTimeAddDateTimePicker?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddDateTimePicker() => DesignTimeAddDateTimePicker?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddTrackBar() - { - DesignTimeAddTrackBar?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddTrackBar() => DesignTimeAddTrackBar?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal override bool ProcessCmdKey(ref Message msg, Keys keyData) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupMaskedTextBox.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupMaskedTextBox.cs index 21cbe1e43..262840475 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupMaskedTextBox.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupMaskedTextBox.cs @@ -254,10 +254,7 @@ public override KryptonRibbon? Ribbon /// /// Resets the ShortcutKeys property to its default value. /// - public void ResetShortcutKeys() - { - ShortcutKeys = Keys.None; - } + public void ResetShortcutKeys() => ShortcutKeys = Keys.None; /// /// Access to the actual embedded KryptonMaskedTextBox instance. @@ -319,18 +316,12 @@ public override bool Visible /// /// Make the ribbon group masked text box visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon group masked text box hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the enabled state of the group masked text box. @@ -868,145 +859,97 @@ public override ViewBase CreateView(KryptonRibbon ribbon, /// Raises the TextChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnTextChanged(EventArgs e) - { - TextChanged?.Invoke(this, e); - } + protected virtual void OnTextChanged(EventArgs e) => TextChanged?.Invoke(this, e); /// /// Raises the GotFocus event. /// /// An EventArgs containing the event data. - protected virtual void OnGotFocus(EventArgs e) - { - GotFocus?.Invoke(this, e); - } + protected virtual void OnGotFocus(EventArgs e) => GotFocus?.Invoke(this, e); /// /// Raises the LostFocus event. /// /// An EventArgs containing the event data. - protected virtual void OnLostFocus(EventArgs e) - { - LostFocus?.Invoke(this, e); - } + protected virtual void OnLostFocus(EventArgs e) => LostFocus?.Invoke(this, e); /// /// Raises the KeyDown event. /// /// An KeyEventArgs containing the event data. - protected virtual void OnKeyDown(KeyEventArgs e) - { - KeyDown?.Invoke(this, e); - } + protected virtual void OnKeyDown(KeyEventArgs e) => KeyDown?.Invoke(this, e); /// /// Raises the KeyUp event. /// /// An KeyEventArgs containing the event data. - protected virtual void OnKeyUp(KeyEventArgs e) - { - KeyUp?.Invoke(this, e); - } + protected virtual void OnKeyUp(KeyEventArgs e) => KeyUp?.Invoke(this, e); /// /// Raises the KeyPress event. /// /// An KeyPressEventArgs containing the event data. - protected virtual void OnKeyPress(KeyPressEventArgs e) - { - KeyPress?.Invoke(this, e); - } + protected virtual void OnKeyPress(KeyPressEventArgs e) => KeyPress?.Invoke(this, e); /// /// Raises the PreviewKeyDown event. /// /// An PreviewKeyDownEventArgs containing the event data. - protected virtual void OnPreviewKeyDown(PreviewKeyDownEventArgs e) - { - PreviewKeyDown?.Invoke(this, e); - } + protected virtual void OnPreviewKeyDown(PreviewKeyDownEventArgs e) => PreviewKeyDown?.Invoke(this, e); /// /// Raises the HideSelectionChanged event. /// /// An EventArgs that contains the event data. - protected virtual void OnHideSelectionChanged(EventArgs e) - { - HideSelectionChanged?.Invoke(this, e); - } + protected virtual void OnHideSelectionChanged(EventArgs e) => HideSelectionChanged?.Invoke(this, e); /// /// Raises the ModifiedChanged event. /// /// An EventArgs that contains the event data. - protected virtual void OnModifiedChanged(EventArgs e) - { - ModifiedChanged?.Invoke(this, e); - } + protected virtual void OnModifiedChanged(EventArgs e) => ModifiedChanged?.Invoke(this, e); /// /// Raises the ReadOnlyChanged event. /// /// An EventArgs that contains the event data. - protected virtual void OnReadOnlyChanged(EventArgs e) - { - ReadOnlyChanged?.Invoke(this, e); - } + protected virtual void OnReadOnlyChanged(EventArgs e) => ReadOnlyChanged?.Invoke(this, e); /// /// Raises the MaskChanged event. /// /// An EventArgs that contains the event data. - protected virtual void OnMaskChanged(EventArgs e) - { - MaskChanged?.Invoke(this, e); - } + protected virtual void OnMaskChanged(EventArgs e) => MaskChanged?.Invoke(this, e); /// /// Raises the TextAlignChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnTextAlignChanged(EventArgs e) - { - TextAlignChanged?.Invoke(this, e); - } + protected virtual void OnTextAlignChanged(EventArgs e) => TextAlignChanged?.Invoke(this, e); /// /// Raises the IsOverwriteModeChanged event. /// /// An EventArgs that contains the event data. - protected virtual void OnIsOverwriteModeChanged(EventArgs e) - { - IsOverwriteModeChanged?.Invoke(this, e); - } + protected virtual void OnIsOverwriteModeChanged(EventArgs e) => IsOverwriteModeChanged?.Invoke(this, e); /// /// Raises the MaskInputRejected event. /// /// An MaskInputRejectedEventArgs that contains the event data. - protected virtual void OnMaskInputRejected(MaskInputRejectedEventArgs e) - { - MaskInputRejected?.Invoke(this, e); - } + protected virtual void OnMaskInputRejected(MaskInputRejectedEventArgs e) => MaskInputRejected?.Invoke(this, e); /// /// Raises the TypeValidationCompleted event. /// /// An EventArgs that contains the event data. - protected virtual void OnTypeValidationCompleted(TypeValidationEventArgs e) - { - TypeValidationCompleted?.Invoke(this, e); - } + protected virtual void OnTypeValidationCompleted(TypeValidationEventArgs e) => TypeValidationCompleted?.Invoke(this, e); /// /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Internal @@ -1016,10 +959,7 @@ protected virtual void OnPropertyChanged(string propertyName) internal NeedPaintHandler ViewPaintDelegate { get; set; } - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal override bool ProcessCmdKey(ref Message msg, Keys keyData) { @@ -1065,96 +1005,43 @@ private void UnmonitorControl(KryptonMaskedTextBox c) c.TrackMouseLeave -= OnControlLeave; } - private void OnControlEnter(object sender, EventArgs e) - { - MouseEnterControl?.Invoke(this, e); - } + private void OnControlEnter(object sender, EventArgs e) => MouseEnterControl?.Invoke(this, e); - private void OnControlLeave(object sender, EventArgs e) - { - MouseLeaveControl?.Invoke(this, e); - } + private void OnControlLeave(object sender, EventArgs e) => MouseLeaveControl?.Invoke(this, e); - private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) - { + private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) => // Pass request onto the view provided paint delegate ViewPaintDelegate?.Invoke(this, e); - } - private void OnMaskedTextBoxTextChanged(object sender, EventArgs e) - { - OnTextChanged(e); - } + private void OnMaskedTextBoxTextChanged(object sender, EventArgs e) => OnTextChanged(e); - private void OnMaskedTextBoxTextAlignChanged(object sender, EventArgs e) - { - OnTextAlignChanged(e); - } + private void OnMaskedTextBoxTextAlignChanged(object sender, EventArgs e) => OnTextAlignChanged(e); - private void OnMaskedMaskChanged(object sender, EventArgs e) - { - OnMaskChanged(e); - } + private void OnMaskedMaskChanged(object sender, EventArgs e) => OnMaskChanged(e); - private void OnMaskedIsOverwriteModeChanged(object sender, EventArgs e) - { - OnIsOverwriteModeChanged(e); - } + private void OnMaskedIsOverwriteModeChanged(object sender, EventArgs e) => OnIsOverwriteModeChanged(e); - private void OnMaskedMaskInputRejected(object sender, MaskInputRejectedEventArgs e) - { - OnMaskInputRejected(e); - } + private void OnMaskedMaskInputRejected(object sender, MaskInputRejectedEventArgs e) => OnMaskInputRejected(e); - private void OnMaskedTypeValidationCompleted(object sender, TypeValidationEventArgs e) - { - OnTypeValidationCompleted(e); - } + private void OnMaskedTypeValidationCompleted(object sender, TypeValidationEventArgs e) => OnTypeValidationCompleted(e); - private void OnMaskedTextBoxHideSelectionChanged(object sender, EventArgs e) - { - OnHideSelectionChanged(e); - } + private void OnMaskedTextBoxHideSelectionChanged(object sender, EventArgs e) => OnHideSelectionChanged(e); - private void OnMaskedTextBoxModifiedChanged(object sender, EventArgs e) - { - OnModifiedChanged(e); - } + private void OnMaskedTextBoxModifiedChanged(object sender, EventArgs e) => OnModifiedChanged(e); - private void OnMaskedTextBoxReadOnlyChanged(object sender, EventArgs e) - { - OnReadOnlyChanged(e); - } + private void OnMaskedTextBoxReadOnlyChanged(object sender, EventArgs e) => OnReadOnlyChanged(e); - private void OnMaskedTextBoxGotFocus(object sender, EventArgs e) - { - OnGotFocus(e); - } + private void OnMaskedTextBoxGotFocus(object sender, EventArgs e) => OnGotFocus(e); - private void OnMaskedTextBoxLostFocus(object sender, EventArgs e) - { - OnLostFocus(e); - } + private void OnMaskedTextBoxLostFocus(object sender, EventArgs e) => OnLostFocus(e); - private void OnMaskedTextBoxKeyPress(object sender, KeyPressEventArgs e) - { - OnKeyPress(e); - } + private void OnMaskedTextBoxKeyPress(object sender, KeyPressEventArgs e) => OnKeyPress(e); - private void OnMaskedTextBoxKeyUp(object sender, KeyEventArgs e) - { - OnKeyUp(e); - } + private void OnMaskedTextBoxKeyUp(object sender, KeyEventArgs e) => OnKeyUp(e); - private void OnMaskedTextBoxKeyDown(object sender, KeyEventArgs e) - { - OnKeyDown(e); - } + private void OnMaskedTextBoxKeyDown(object sender, KeyEventArgs e) => OnKeyDown(e); - private void OnMaskedTextBoxPreviewKeyDown(object sender, PreviewKeyDownEventArgs e) - { - OnPreviewKeyDown(e); - } + private void OnMaskedTextBoxPreviewKeyDown(object sender, PreviewKeyDownEventArgs e) => OnPreviewKeyDown(e); private void OnRibbonPaletteChanged(object sender, EventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupNumericUpDown.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupNumericUpDown.cs index f08c22a4c..e4a097610 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupNumericUpDown.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupNumericUpDown.cs @@ -198,10 +198,7 @@ public override KryptonRibbon Ribbon /// /// Resets the ShortcutKeys property to its default value. /// - public void ResetShortcutKeys() - { - ShortcutKeys = Keys.None; - } + public void ResetShortcutKeys() => ShortcutKeys = Keys.None; /// /// Access to the actual embedded KryptonNumericUpDown instance. @@ -409,18 +406,12 @@ public override bool Visible /// /// Make the ribbon group numeric up-down visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon group numeric up-down hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the enabled state of the group numeric up-down. @@ -520,10 +511,7 @@ public bool AllowButtonSpecToolTipPriority /// /// The position of the first character in the current text selection within the text box. /// The number of characters to select. - public void Select(int start, int length) - { - NumericUpDown.Select(start, length); - } + public void Select(int start, int length) => NumericUpDown.Select(start, length); /// /// Gets and sets the maximum allowed size of the item. @@ -603,73 +591,49 @@ public override ViewBase CreateView(KryptonRibbon ribbon, /// Raises the GotFocus event. /// /// An EventArgs containing the event data. - protected virtual void OnGotFocus(EventArgs e) - { - GotFocus?.Invoke(this, e); - } + protected virtual void OnGotFocus(EventArgs e) => GotFocus?.Invoke(this, e); /// /// Raises the LostFocus event. /// /// An EventArgs containing the event data. - protected virtual void OnLostFocus(EventArgs e) - { - LostFocus?.Invoke(this, e); - } + protected virtual void OnLostFocus(EventArgs e) => LostFocus?.Invoke(this, e); /// /// Raises the KeyDown event. /// /// An KeyEventArgs containing the event data. - protected virtual void OnKeyDown(KeyEventArgs e) - { - KeyDown?.Invoke(this, e); - } + protected virtual void OnKeyDown(KeyEventArgs e) => KeyDown?.Invoke(this, e); /// /// Raises the KeyUp event. /// /// An KeyEventArgs containing the event data. - protected virtual void OnKeyUp(KeyEventArgs e) - { - KeyUp?.Invoke(this, e); - } + protected virtual void OnKeyUp(KeyEventArgs e) => KeyUp?.Invoke(this, e); /// /// Raises the KeyPress event. /// /// An KeyPressEventArgs containing the event data. - protected virtual void OnKeyPress(KeyPressEventArgs e) - { - KeyPress?.Invoke(this, e); - } + protected virtual void OnKeyPress(KeyPressEventArgs e) => KeyPress?.Invoke(this, e); /// /// Raises the PreviewKeyDown event. /// /// An PreviewKeyDownEventArgs containing the event data. - protected virtual void OnPreviewKeyDown(PreviewKeyDownEventArgs e) - { - PreviewKeyDown?.Invoke(this, e); - } + protected virtual void OnPreviewKeyDown(PreviewKeyDownEventArgs e) => PreviewKeyDown?.Invoke(this, e); /// /// Raises the ValueChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnValueChanged(EventArgs e) - { - ValueChanged?.Invoke(this, e); - } + protected virtual void OnValueChanged(EventArgs e) => ValueChanged?.Invoke(this, e); /// /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Internal @@ -679,10 +643,7 @@ protected virtual void OnPropertyChanged(string propertyName) internal NeedPaintHandler ViewPaintDelegate { get; set; } - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal override bool ProcessCmdKey(ref Message msg, Keys keyData) { @@ -729,61 +690,29 @@ private void UnmonitorControl(KryptonNumericUpDown c) c.TrackMouseLeave -= OnControlLeave; } - private void OnControlEnter(object sender, EventArgs e) - { - MouseEnterControl?.Invoke(this, e); - } + private void OnControlEnter(object sender, EventArgs e) => MouseEnterControl?.Invoke(this, e); - private void OnControlLeave(object sender, EventArgs e) - { - MouseLeaveControl?.Invoke(this, e); - } + private void OnControlLeave(object sender, EventArgs e) => MouseLeaveControl?.Invoke(this, e); - private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) - { + private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) => // Pass request onto the view provided paint delegate ViewPaintDelegate?.Invoke(this, e); - } - private void OnNumericUpDownValueChanged(object sender, EventArgs e) - { - OnValueChanged(e); - } + private void OnNumericUpDownValueChanged(object sender, EventArgs e) => OnValueChanged(e); - private void OnNumericUpDownGotFocus(object sender, EventArgs e) - { - OnGotFocus(e); - } + private void OnNumericUpDownGotFocus(object sender, EventArgs e) => OnGotFocus(e); - private void OnNumericUpDownLostFocus(object sender, EventArgs e) - { - OnLostFocus(e); - } + private void OnNumericUpDownLostFocus(object sender, EventArgs e) => OnLostFocus(e); - private void OnNumericUpDownKeyPress(object sender, KeyPressEventArgs e) - { - OnKeyPress(e); - } + private void OnNumericUpDownKeyPress(object sender, KeyPressEventArgs e) => OnKeyPress(e); - private void OnNumericUpDownKeyUp(object sender, KeyEventArgs e) - { - OnKeyUp(e); - } + private void OnNumericUpDownKeyUp(object sender, KeyEventArgs e) => OnKeyUp(e); - private void OnNumericUpDownKeyDown(object sender, KeyEventArgs e) - { - OnKeyDown(e); - } + private void OnNumericUpDownKeyDown(object sender, KeyEventArgs e) => OnKeyDown(e); - private void OnNumericUpDownPreviewKeyDown(object sender, PreviewKeyDownEventArgs e) - { - OnPreviewKeyDown(e); - } + private void OnNumericUpDownPreviewKeyDown(object sender, PreviewKeyDownEventArgs e) => OnPreviewKeyDown(e); - private void OnRibbonPaletteChanged(object sender, EventArgs e) - { - NumericUpDown.Palette = Ribbon.GetResolvedPalette(); - } + private void OnRibbonPaletteChanged(object sender, EventArgs e) => NumericUpDown.Palette = Ribbon.GetResolvedPalette(); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupRadioButton.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupRadioButton.cs index fffc459ed..f126869d2 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupRadioButton.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupRadioButton.cs @@ -195,18 +195,12 @@ public override bool Visible /// /// Make the ribbon group radio button visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon group radio button hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the enabled state of the group radio button entry. @@ -259,7 +253,7 @@ public bool Checked } /// - /// Gets or sets a value indicating if checking this radio button should unheck others in the same group. + /// Gets or sets a value indicating if checking this radio button should uncheck others in the same group. /// [Category(@"Behavior")] [Description(@"Indicates if checking this radio button should uncheck others in the same group.")] @@ -295,10 +289,7 @@ public bool AutoCheck /// /// Resets the ShortcutKeys property to its default value. /// - public void ResetShortcutKeys() - { - ShortcutKeys = Keys.None; - } + public void ResetShortcutKeys() => ShortcutKeys = Keys.None; /// /// Gets access to the Wrapped Controls Tooltips. @@ -382,19 +373,13 @@ public override ViewBase CreateView(KryptonRibbon ribbon, /// /// Generates a Click event for a check box. /// - public void PerformClick() - { - PerformClick(null); - } + public void PerformClick() => PerformClick(null); /// /// Generates a Click event for a radio button. /// /// Delegate fired during event processing. - public void PerformClick(EventHandler finishDelegate) - { - OnClick(finishDelegate); - } + public void PerformClick(EventHandler? finishDelegate) => OnClick(finishDelegate); /// /// Internal design time properties. @@ -411,7 +396,7 @@ public void PerformClick(EventHandler finishDelegate) /// Raises the Click event. /// /// Delegate fired during event processing. - protected virtual void OnClick(EventHandler finishDelegate) + protected virtual void OnClick(EventHandler? finishDelegate) { var fireDelegate = true; @@ -455,26 +440,17 @@ protected virtual void OnClick(EventHandler finishDelegate) /// Raises the CheckedChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnCheckedChanged(EventArgs e) - { - CheckedChanged?.Invoke(this, e); - } + protected virtual void OnCheckedChanged(EventArgs e) => CheckedChanged?.Invoke(this, e); /// /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Internal - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal override bool ProcessCmdKey(ref Message msg, Keys keyData) { @@ -509,7 +485,7 @@ private void AutoUpdateOthers() if (RibbonContainer?.RibbonGroup != null) { // Process each container inside the group - foreach (IRibbonGroupContainer container in RibbonContainer.RibbonGroup.Items) + foreach (var container in RibbonContainer.RibbonGroup.Items) { AutoUpdateContainer(container); } @@ -517,10 +493,10 @@ private void AutoUpdateOthers() } } - private void AutoUpdateContainer(IRibbonGroupContainer Container) + private void AutoUpdateContainer(IRibbonGroupContainer iContainer) { // Process each component inside the container - foreach (Component component in Container.GetChildComponents()) + foreach (Component component in iContainer.GetChildComponents()) { switch (component) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupRichTextBox.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupRichTextBox.cs index 690bf524e..859874b58 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupRichTextBox.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupRichTextBox.cs @@ -272,10 +272,7 @@ public override KryptonRibbon Ribbon /// /// Resets the ShortcutKeys property to its default value. /// - public void ResetShortcutKeys() - { - ShortcutKeys = Keys.None; - } + public void ResetShortcutKeys() => ShortcutKeys = Keys.None; /// /// Access to the actual embedded KryptonRichTextBox instance. @@ -336,18 +333,12 @@ public override bool Visible /// /// Make the ribbon group visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon group hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the enabled state of the group rich text box. @@ -926,50 +917,32 @@ public int[] SelectionTabs /// Appends text to the current text of a rich text box. /// /// The text to append to the current contents of the text box. - public void AppendText(string text) - { - RichTextBox.AppendText(text); - } + public void AppendText(string text) => RichTextBox.AppendText(text); /// /// Clears all text from the text box control. /// - public void Clear() - { - RichTextBox.Clear(); - } + public void Clear() => RichTextBox.Clear(); /// /// Clears information about the most recent operation from the undo buffer of the rich text box. /// - public void ClearUndo() - { - RichTextBox.ClearUndo(); - } + public void ClearUndo() => RichTextBox.ClearUndo(); /// /// Copies the current selection in the text box to the Clipboard. /// - public void Copy() - { - RichTextBox.Copy(); - } + public void Copy() => RichTextBox.Copy(); /// /// Moves the current selection in the text box to the Clipboard. /// - public void Cut() - { - RichTextBox.Cut(); - } + public void Cut() => RichTextBox.Cut(); /// /// Specifies that the value of the SelectionLength property is zero so that no characters are selected in the control. /// - public void DeselectAll() - { - RichTextBox.DeselectAll(); - } + public void DeselectAll() => RichTextBox.DeselectAll(); /// /// Determines whether you can paste information from the Clipboard in the specified data format. @@ -1081,118 +1054,79 @@ public void DeselectAll() /// Loads a rich text format (RTF) or standard ASCII text file into the RichTextBox control. /// /// The name and location of the file to load into the control. - public void LoadFile(string path) - { - RichTextBox.LoadFile(path); - } + public void LoadFile(string path) => RichTextBox.LoadFile(path); /// /// Loads the contents of an existing data stream into the RichTextBox control. /// /// A stream of data to load into the RichTextBox control. /// One of the RichTextBoxStreamType values. - public void LoadFile(Stream data, RichTextBoxStreamType fileType) - { - RichTextBox.LoadFile(data, fileType); - } + public void LoadFile(Stream data, RichTextBoxStreamType fileType) => RichTextBox.LoadFile(data, fileType); /// /// Loads a specific type of file into the RichTextBox control. /// /// The name and location of the file to load into the control. /// One of the RichTextBoxStreamType values. - public void LoadFile(string path, RichTextBoxStreamType fileType) - { - RichTextBox.LoadFile(path, fileType); - } + public void LoadFile(string path, RichTextBoxStreamType fileType) => RichTextBox.LoadFile(path, fileType); /// /// Replaces the current selection in the text box with the contents of the Clipboard. /// - public void Paste() - { - RichTextBox.Paste(); - } + public void Paste() => RichTextBox.Paste(); /// /// Undoes the last edit operation in the text box. /// - public void Undo() - { - RichTextBox.Undo(); - } + public void Undo() => RichTextBox.Undo(); /// /// Pastes the contents of the Clipboard in the specified Clipboard format. /// /// The Clipboard format in which the data should be obtained from the Clipboard. - public void Paste(DataFormats.Format clipFormat) - { - RichTextBox.Paste(clipFormat); - } + public void Paste(DataFormats.Format clipFormat) => RichTextBox.Paste(clipFormat); /// /// Reapplies the last operation that was undone in the control. /// - public void Redo() - { - RichTextBox.Redo(); - } + public void Redo() => RichTextBox.Redo(); /// /// Saves the contents of the RichTextBox to a rich text format (RTF) file. /// /// The name and location of the file to save. - public void SaveFile(string path) - { - RichTextBox.SaveFile(path); - } + public void SaveFile(string path) => RichTextBox.SaveFile(path); /// /// Saves the contents of a RichTextBox control to an open data stream. /// /// The data stream that contains the file to save to. /// One of the RichTextBoxStreamType values. - public void SaveFile(Stream data, RichTextBoxStreamType fileType) - { - RichTextBox.SaveFile(data, fileType); - } + public void SaveFile(Stream data, RichTextBoxStreamType fileType) => RichTextBox.SaveFile(data, fileType); /// /// Saves the contents of the KryptonRichTextBox to a specific type of file. /// /// The name and location of the file to save. /// One of the RichTextBoxStreamType values. - public void SaveFile(string path, RichTextBoxStreamType fileType) - { - RichTextBox.SaveFile(path, fileType); - } + public void SaveFile(string path, RichTextBoxStreamType fileType) => RichTextBox.SaveFile(path, fileType); /// /// Scrolls the contents of the control to the current caret position. /// - public void ScrollToCaret() - { - RichTextBox.ScrollToCaret(); - } + public void ScrollToCaret() => RichTextBox.ScrollToCaret(); /// /// Selects a range of text in the control. /// /// The position of the first character in the current text selection within the text box. /// The number of characters to select. - public void Select(int start, int length) - { - RichTextBox.Select(start, length); - } + public void Select(int start, int length) => RichTextBox.Select(start, length); /// /// Selects all text in the control. /// - public void SelectAll() - { - RichTextBox.SelectAll(); - } + public void SelectAll() => RichTextBox.SelectAll(); /// /// Gets and sets the maximum allowed size of the item. @@ -1272,163 +1206,109 @@ public override ViewBase CreateView(KryptonRibbon ribbon, /// Raises the TextChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnTextChanged(EventArgs e) - { - TextChanged?.Invoke(this, e); - } + protected virtual void OnTextChanged(EventArgs e) => TextChanged?.Invoke(this, e); /// /// Raises the GotFocus event. /// /// An EventArgs containing the event data. - protected virtual void OnGotFocus(EventArgs e) - { - GotFocus?.Invoke(this, e); - } + protected virtual void OnGotFocus(EventArgs e) => GotFocus?.Invoke(this, e); /// /// Raises the LostFocus event. /// /// An EventArgs containing the event data. - protected virtual void OnLostFocus(EventArgs e) - { - LostFocus?.Invoke(this, e); - } + protected virtual void OnLostFocus(EventArgs e) => LostFocus?.Invoke(this, e); /// /// Raises the KeyDown event. /// /// An KeyEventArgs containing the event data. - protected virtual void OnKeyDown(KeyEventArgs e) - { - KeyDown?.Invoke(this, e); - } + protected virtual void OnKeyDown(KeyEventArgs e) => KeyDown?.Invoke(this, e); /// /// Raises the KeyUp event. /// /// An KeyEventArgs containing the event data. - protected virtual void OnKeyUp(KeyEventArgs e) - { - KeyUp?.Invoke(this, e); - } + protected virtual void OnKeyUp(KeyEventArgs e) => KeyUp?.Invoke(this, e); /// /// Raises the KeyPress event. /// /// An KeyPressEventArgs containing the event data. - protected virtual void OnKeyPress(KeyPressEventArgs e) - { - KeyPress?.Invoke(this, e); - } + protected virtual void OnKeyPress(KeyPressEventArgs e) => KeyPress?.Invoke(this, e); /// /// Raises the PreviewKeyDown event. /// /// An PreviewKeyDownEventArgs containing the event data. - protected virtual void OnPreviewKeyDown(PreviewKeyDownEventArgs e) - { - PreviewKeyDown?.Invoke(this, e); - } + protected virtual void OnPreviewKeyDown(PreviewKeyDownEventArgs e) => PreviewKeyDown?.Invoke(this, e); /// /// Raises the AcceptsTabChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnAcceptsTabChanged(EventArgs e) - { - AcceptsTabChanged?.Invoke(this, e); - } + protected virtual void OnAcceptsTabChanged(EventArgs e) => AcceptsTabChanged?.Invoke(this, e); /// /// Raises the HideSelectionChanged event. /// /// An EventArgs that contains the event data. - protected virtual void OnHideSelectionChanged(EventArgs e) - { - HideSelectionChanged?.Invoke(this, e); - } + protected virtual void OnHideSelectionChanged(EventArgs e) => HideSelectionChanged?.Invoke(this, e); /// /// Raises the ModifiedChanged event. /// /// An EventArgs that contains the event data. - protected virtual void OnModifiedChanged(EventArgs e) - { - ModifiedChanged?.Invoke(this, e); - } + protected virtual void OnModifiedChanged(EventArgs e) => ModifiedChanged?.Invoke(this, e); /// /// Raises the MultilineChanged event. /// /// An EventArgs that contains the event data. - protected virtual void OnMultilineChanged(EventArgs e) - { - MultilineChanged?.Invoke(this, e); - } + protected virtual void OnMultilineChanged(EventArgs e) => MultilineChanged?.Invoke(this, e); /// /// Raises the ReadOnlyChanged event. /// /// An EventArgs that contains the event data. - protected virtual void OnReadOnlyChanged(EventArgs e) - { - ReadOnlyChanged?.Invoke(this, e); - } + protected virtual void OnReadOnlyChanged(EventArgs e) => ReadOnlyChanged?.Invoke(this, e); /// /// Raises the VScroll event. /// /// An EventArgs that contains the event data. - protected virtual void OnVScroll(EventArgs e) - { - VScroll?.Invoke(this, e); - } + protected virtual void OnVScroll(EventArgs e) => VScroll?.Invoke(this, e); /// /// Raises the HScroll event. /// /// An EventArgs that contains the event data. - protected virtual void OnHScroll(EventArgs e) - { - HScroll?.Invoke(this, e); - } + protected virtual void OnHScroll(EventArgs e) => HScroll?.Invoke(this, e); /// /// Raises the SelectionChanged event. /// /// An EventArgs that contains the event data. - protected virtual void OnSelectionChanged(EventArgs e) - { - SelectionChanged?.Invoke(this, e); - } + protected virtual void OnSelectionChanged(EventArgs e) => SelectionChanged?.Invoke(this, e); /// /// Raises the Protected event. /// /// An EventArgs that contains the event data. - protected virtual void OnProtected(EventArgs e) - { - Protected?.Invoke(this, e); - } + protected virtual void OnProtected(EventArgs e) => Protected?.Invoke(this, e); /// /// Raises the LinkClicked event. /// /// A LinkClickedEventArgs that contains the event data. - protected virtual void OnLinkClicked(LinkClickedEventArgs e) - { - LinkClicked?.Invoke(this, e); - } + protected virtual void OnLinkClicked(LinkClickedEventArgs e) => LinkClicked?.Invoke(this, e); /// /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Internal @@ -1438,10 +1318,7 @@ protected virtual void OnPropertyChanged(string propertyName) internal NeedPaintHandler ViewPaintDelegate { get; set; } - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal override bool ProcessCmdKey(ref Message msg, Keys keyData) { @@ -1487,111 +1364,49 @@ private void UnmonitorControl(KryptonRichTextBox c) c.TrackMouseLeave -= OnControlLeave; } - private void OnControlEnter(object sender, EventArgs e) - { - MouseEnterControl?.Invoke(this, e); - } + private void OnControlEnter(object sender, EventArgs e) => MouseEnterControl?.Invoke(this, e); - private void OnControlLeave(object sender, EventArgs e) - { - MouseLeaveControl?.Invoke(this, e); - } + private void OnControlLeave(object sender, EventArgs e) => MouseLeaveControl?.Invoke(this, e); - private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) - { + private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) => // Pass request onto the view provided paint delegate ViewPaintDelegate?.Invoke(this, e); - } - private void OnRichTextBoxAcceptsTabChanged(object sender, EventArgs e) - { - OnAcceptsTabChanged(e); - } + private void OnRichTextBoxAcceptsTabChanged(object sender, EventArgs e) => OnAcceptsTabChanged(e); - private void OnRichTextBoxTextChanged(object sender, EventArgs e) - { - OnTextChanged(e); - } + private void OnRichTextBoxTextChanged(object sender, EventArgs e) => OnTextChanged(e); - private void OnRichTextBoxHideSelectionChanged(object sender, EventArgs e) - { - OnHideSelectionChanged(e); - } + private void OnRichTextBoxHideSelectionChanged(object sender, EventArgs e) => OnHideSelectionChanged(e); - private void OnRichTextBoxModifiedChanged(object sender, EventArgs e) - { - OnModifiedChanged(e); - } + private void OnRichTextBoxModifiedChanged(object sender, EventArgs e) => OnModifiedChanged(e); - private void OnRichTextBoxMultilineChanged(object sender, EventArgs e) - { - OnMultilineChanged(e); - } + private void OnRichTextBoxMultilineChanged(object sender, EventArgs e) => OnMultilineChanged(e); - private void OnRichTextBoxReadOnlyChanged(object sender, EventArgs e) - { - OnReadOnlyChanged(e); - } + private void OnRichTextBoxReadOnlyChanged(object sender, EventArgs e) => OnReadOnlyChanged(e); - private void OnRichTextBoxGotFocus(object sender, EventArgs e) - { - OnGotFocus(e); - } + private void OnRichTextBoxGotFocus(object sender, EventArgs e) => OnGotFocus(e); - private void OnRichTextBoxLostFocus(object sender, EventArgs e) - { - OnLostFocus(e); - } + private void OnRichTextBoxLostFocus(object sender, EventArgs e) => OnLostFocus(e); - private void OnRichTextBoxKeyPress(object sender, KeyPressEventArgs e) - { - OnKeyPress(e); - } + private void OnRichTextBoxKeyPress(object sender, KeyPressEventArgs e) => OnKeyPress(e); - private void OnRichTextBoxKeyUp(object sender, KeyEventArgs e) - { - OnKeyUp(e); - } + private void OnRichTextBoxKeyUp(object sender, KeyEventArgs e) => OnKeyUp(e); - private void OnRichTextBoxKeyDown(object sender, KeyEventArgs e) - { - OnKeyDown(e); - } + private void OnRichTextBoxKeyDown(object sender, KeyEventArgs e) => OnKeyDown(e); - private void OnRichTextBoxPreviewKeyDown(object sender, PreviewKeyDownEventArgs e) - { - OnPreviewKeyDown(e); - } + private void OnRichTextBoxPreviewKeyDown(object sender, PreviewKeyDownEventArgs e) => OnPreviewKeyDown(e); - private void OnRichTextBoxVScroll(object sender, EventArgs e) - { - OnVScroll(e); - } + private void OnRichTextBoxVScroll(object sender, EventArgs e) => OnVScroll(e); - private void OnRichTextBoxHScroll(object sender, EventArgs e) - { - OnHScroll(e); - } + private void OnRichTextBoxHScroll(object sender, EventArgs e) => OnHScroll(e); - private void OnRichTextBoxSelectionChanged(object sender, EventArgs e) - { - OnSelectionChanged(e); - } + private void OnRichTextBoxSelectionChanged(object sender, EventArgs e) => OnSelectionChanged(e); - private void OnRichTextBoxProtected(object sender, EventArgs e) - { - OnProtected(e); - } + private void OnRichTextBoxProtected(object sender, EventArgs e) => OnProtected(e); - private void OnRichTextBoxLinkClicked(object sender, LinkClickedEventArgs e) - { - OnLinkClicked(e); - } + private void OnRichTextBoxLinkClicked(object sender, LinkClickedEventArgs e) => OnLinkClicked(e); - private void OnRibbonPaletteChanged(object sender, EventArgs e) - { - RichTextBox.Palette = Ribbon.GetResolvedPalette(); - } + private void OnRibbonPaletteChanged(object sender, EventArgs e) => RichTextBox.Palette = Ribbon.GetResolvedPalette(); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupSeparator.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupSeparator.cs index 92c28a500..47a900a3c 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupSeparator.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupSeparator.cs @@ -86,18 +86,12 @@ public override bool Visible /// /// Make the ribbon group visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon group hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the maximum allowed size of the item. @@ -165,10 +159,7 @@ public override ViewBase CreateView(KryptonRibbon ribbon, #endregion #region Internal - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal override bool ProcessCmdKey(ref Message msg, Keys keyData) => false; @@ -179,10 +170,7 @@ internal void OnDesignTimeContextMenu(MouseEventArgs e) /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupTextBox.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupTextBox.cs index 39fc4f4ea..8904f7e23 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupTextBox.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupTextBox.cs @@ -238,10 +238,7 @@ public override KryptonRibbon Ribbon /// /// Resets the ShortcutKeys property to its default value. /// - public void ResetShortcutKeys() - { - ShortcutKeys = Keys.None; - } + public void ResetShortcutKeys() => ShortcutKeys = Keys.None; /// /// Access to the actual embedded KryptonTextBox instance. @@ -302,18 +299,12 @@ public override bool Visible /// /// Make the ribbon group textbox visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon group textbox hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the enabled state of the group text box. @@ -713,92 +704,59 @@ public int SelectionStart /// Appends text to the current text of a rich text box. /// /// The text to append to the current contents of the text box. - public void AppendText(string text) - { - TextBox.AppendText(text); - } + public void AppendText(string text) => TextBox.AppendText(text); /// /// Clears all text from the text box control. /// - public void Clear() - { - TextBox.Clear(); - } + public void Clear() => TextBox.Clear(); /// /// Clears information about the most recent operation from the undo buffer of the rich text box. /// - public void ClearUndo() - { - TextBox.ClearUndo(); - } + public void ClearUndo() => TextBox.ClearUndo(); /// /// Copies the current selection in the text box to the Clipboard. /// - public void Copy() - { - TextBox.Copy(); - } + public void Copy() => TextBox.Copy(); /// /// Moves the current selection in the text box to the Clipboard. /// - public void Cut() - { - TextBox.Cut(); - } + public void Cut() => TextBox.Cut(); /// /// Replaces the current selection in the text box with the contents of the Clipboard. /// - public void Paste() - { - TextBox.Paste(); - } + public void Paste() => TextBox.Paste(); /// /// Scrolls the contents of the control to the current caret position. /// - public void ScrollToCaret() - { - TextBox.ScrollToCaret(); - } + public void ScrollToCaret() => TextBox.ScrollToCaret(); /// /// Selects a range of text in the control. /// /// The position of the first character in the current text selection within the text box. /// The number of characters to select. - public void Select(int start, int length) - { - TextBox.Select(start, length); - } + public void Select(int start, int length) => TextBox.Select(start, length); /// /// Selects all text in the control. /// - public void SelectAll() - { - TextBox.SelectAll(); - } + public void SelectAll() => TextBox.SelectAll(); /// /// Undoes the last edit operation in the text box. /// - public void Undo() - { - TextBox.Undo(); - } + public void Undo() => TextBox.Undo(); /// /// Specifies that the value of the SelectionLength property is zero so that no characters are selected in the control. /// - public void DeselectAll() - { - TextBox.DeselectAll(); - } + public void DeselectAll() => TextBox.DeselectAll(); /// /// Retrieves the character that is closest to the specified location within the control. @@ -919,127 +877,85 @@ public override ViewBase CreateView(KryptonRibbon ribbon, /// Raises the TextChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnTextChanged(EventArgs e) - { - TextChanged?.Invoke(this, e); - } + protected virtual void OnTextChanged(EventArgs e) => TextChanged?.Invoke(this, e); /// /// Raises the GotFocus event. /// /// An EventArgs containing the event data. - protected virtual void OnGotFocus(EventArgs e) - { - GotFocus?.Invoke(this, e); - } + protected virtual void OnGotFocus(EventArgs e) => GotFocus?.Invoke(this, e); /// /// Raises the LostFocus event. /// /// An EventArgs containing the event data. - protected virtual void OnLostFocus(EventArgs e) - { - LostFocus?.Invoke(this, e); - } + protected virtual void OnLostFocus(EventArgs e) => LostFocus?.Invoke(this, e); /// /// Raises the KeyDown event. /// /// An KeyEventArgs containing the event data. - protected virtual void OnKeyDown(KeyEventArgs e) - { - KeyDown?.Invoke(this, e); - } + protected virtual void OnKeyDown(KeyEventArgs e) => KeyDown?.Invoke(this, e); /// /// Raises the KeyUp event. /// /// An KeyEventArgs containing the event data. - protected virtual void OnKeyUp(KeyEventArgs e) - { - KeyUp?.Invoke(this, e); - } + protected virtual void OnKeyUp(KeyEventArgs e) => KeyUp?.Invoke(this, e); /// /// Raises the KeyPress event. /// /// An KeyPressEventArgs containing the event data. - protected virtual void OnKeyPress(KeyPressEventArgs e) - { - KeyPress?.Invoke(this, e); - } + protected virtual void OnKeyPress(KeyPressEventArgs e) => KeyPress?.Invoke(this, e); /// /// Raises the PreviewKeyDown event. /// /// An PreviewKeyDownEventArgs containing the event data. - protected virtual void OnPreviewKeyDown(PreviewKeyDownEventArgs e) - { - PreviewKeyDown?.Invoke(this, e); - } + protected virtual void OnPreviewKeyDown(PreviewKeyDownEventArgs e) => PreviewKeyDown?.Invoke(this, e); /// /// Raises the AcceptsTabChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnAcceptsTabChanged(EventArgs e) - { - AcceptsTabChanged?.Invoke(this, e); - } + protected virtual void OnAcceptsTabChanged(EventArgs e) => AcceptsTabChanged?.Invoke(this, e); /// /// Raises the TextAlignChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnTextAlignChanged(EventArgs e) - { - TextAlignChanged?.Invoke(this, e); - } + protected virtual void OnTextAlignChanged(EventArgs e) => TextAlignChanged?.Invoke(this, e); /// /// Raises the HideSelectionChanged event. /// /// An EventArgs that contains the event data. - protected virtual void OnHideSelectionChanged(EventArgs e) - { - HideSelectionChanged?.Invoke(this, e); - } + protected virtual void OnHideSelectionChanged(EventArgs e) => HideSelectionChanged?.Invoke(this, e); /// /// Raises the ModifiedChanged event. /// /// An EventArgs that contains the event data. - protected virtual void OnModifiedChanged(EventArgs e) - { - ModifiedChanged?.Invoke(this, e); - } + protected virtual void OnModifiedChanged(EventArgs e) => ModifiedChanged?.Invoke(this, e); /// /// Raises the MultilineChanged event. /// /// An EventArgs that contains the event data. - protected virtual void OnMultilineChanged(EventArgs e) - { - MultilineChanged?.Invoke(this, e); - } + protected virtual void OnMultilineChanged(EventArgs e) => MultilineChanged?.Invoke(this, e); /// /// Raises the ReadOnlyChanged event. /// /// An EventArgs that contains the event data. - protected virtual void OnReadOnlyChanged(EventArgs e) - { - ReadOnlyChanged?.Invoke(this, e); - } + protected virtual void OnReadOnlyChanged(EventArgs e) => ReadOnlyChanged?.Invoke(this, e); /// /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Internal @@ -1049,10 +965,7 @@ protected virtual void OnPropertyChanged(string propertyName) internal NeedPaintHandler ViewPaintDelegate { get; set; } - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal override bool ProcessCmdKey(ref Message msg, Keys keyData) { @@ -1098,91 +1011,41 @@ private void UnmonitorControl(KryptonTextBox c) c.TrackMouseLeave -= OnControlLeave; } - private void OnControlEnter(object sender, EventArgs e) - { - MouseEnterControl?.Invoke(this, e); - } + private void OnControlEnter(object sender, EventArgs e) => MouseEnterControl?.Invoke(this, e); - private void OnControlLeave(object sender, EventArgs e) - { - MouseLeaveControl?.Invoke(this, e); - } + private void OnControlLeave(object sender, EventArgs e) => MouseLeaveControl?.Invoke(this, e); - private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) - { + private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) => // Pass request onto the view provided paint delegate ViewPaintDelegate?.Invoke(this, e); - } - private void OnTextBoxAcceptsTabChanged(object sender, EventArgs e) - { - OnAcceptsTabChanged(e); - } + private void OnTextBoxAcceptsTabChanged(object sender, EventArgs e) => OnAcceptsTabChanged(e); - private void OnTextBoxTextChanged(object sender, EventArgs e) - { - OnTextChanged(e); - } + private void OnTextBoxTextChanged(object sender, EventArgs e) => OnTextChanged(e); - private void OnTextBoxTextAlignChanged(object sender, EventArgs e) - { - OnTextAlignChanged(e); - } + private void OnTextBoxTextAlignChanged(object sender, EventArgs e) => OnTextAlignChanged(e); - private void OnTextBoxHideSelectionChanged(object sender, EventArgs e) - { - OnHideSelectionChanged(e); - } + private void OnTextBoxHideSelectionChanged(object sender, EventArgs e) => OnHideSelectionChanged(e); - private void OnTextBoxModifiedChanged(object sender, EventArgs e) - { - OnModifiedChanged(e); - } + private void OnTextBoxModifiedChanged(object sender, EventArgs e) => OnModifiedChanged(e); - private void OnTextBoxMultilineChanged(object sender, EventArgs e) - { - OnMultilineChanged(e); - } + private void OnTextBoxMultilineChanged(object sender, EventArgs e) => OnMultilineChanged(e); - private void OnTextBoxReadOnlyChanged(object sender, EventArgs e) - { - OnReadOnlyChanged(e); - } + private void OnTextBoxReadOnlyChanged(object sender, EventArgs e) => OnReadOnlyChanged(e); - private void OnTextBoxGotFocus(object sender, EventArgs e) - { - OnGotFocus(e); - } + private void OnTextBoxGotFocus(object sender, EventArgs e) => OnGotFocus(e); - private void OnTextBoxLostFocus(object sender, EventArgs e) - { - OnLostFocus(e); - } + private void OnTextBoxLostFocus(object sender, EventArgs e) => OnLostFocus(e); - private void OnTextBoxKeyPress(object sender, KeyPressEventArgs e) - { - OnKeyPress(e); - } + private void OnTextBoxKeyPress(object sender, KeyPressEventArgs e) => OnKeyPress(e); - private void OnTextBoxKeyUp(object sender, KeyEventArgs e) - { - OnKeyUp(e); - } + private void OnTextBoxKeyUp(object sender, KeyEventArgs e) => OnKeyUp(e); - private void OnTextBoxKeyDown(object sender, KeyEventArgs e) - { - OnKeyDown(e); - } + private void OnTextBoxKeyDown(object sender, KeyEventArgs e) => OnKeyDown(e); - private void OnTextBoxPreviewKeyDown(object sender, PreviewKeyDownEventArgs e) - { - OnPreviewKeyDown(e); - } + private void OnTextBoxPreviewKeyDown(object sender, PreviewKeyDownEventArgs e) => OnPreviewKeyDown(e); - private void OnRibbonPaletteChanged(object sender, EventArgs e) - { - TextBox.Palette = Ribbon.GetResolvedPalette(); - } + private void OnRibbonPaletteChanged(object sender, EventArgs e) => TextBox.Palette = Ribbon.GetResolvedPalette(); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupTrackBar.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupTrackBar.cs index 973e1bf8d..56b1c898f 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupTrackBar.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupTrackBar.cs @@ -214,18 +214,12 @@ public override bool Visible /// /// Make the ribbon group track bar visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon group track bar hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the enabled state of the group track bar. @@ -459,10 +453,7 @@ public int LargeChange /// /// The lower limit of the range of the track bar. /// The upper limit of the range of the track bar. - public void SetRange(int minValue, int maxValue) - { - TrackBar.SetRange(minValue, maxValue); - } + public void SetRange(int minValue, int maxValue) => TrackBar.SetRange(minValue, maxValue); /// /// Gets and sets the maximum allowed size of the item. @@ -542,28 +533,19 @@ public override ViewBase CreateView(KryptonRibbon ribbon, /// Raises the GotFocus event. /// /// An EventArgs containing the event data. - protected virtual void OnGotFocus(EventArgs e) - { - GotFocus?.Invoke(this, e); - } + protected virtual void OnGotFocus(EventArgs e) => GotFocus?.Invoke(this, e); /// /// Raises the LostFocus event. /// /// An EventArgs containing the event data. - protected virtual void OnLostFocus(EventArgs e) - { - LostFocus?.Invoke(this, e); - } + protected virtual void OnLostFocus(EventArgs e) => LostFocus?.Invoke(this, e); /// /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Internal @@ -573,10 +555,7 @@ protected virtual void OnPropertyChanged(string propertyName) internal NeedPaintHandler ViewPaintDelegate { get; set; } - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal override bool ProcessCmdKey(ref Message msg, Keys keyData) => false; @@ -595,41 +574,21 @@ private void UnmonitorControl(KryptonTrackBar c) c.MouseLeave -= OnControlLeave; } - private void OnControlEnter(object sender, EventArgs e) - { - MouseEnterControl?.Invoke(this, e); - } + private void OnControlEnter(object sender, EventArgs e) => MouseEnterControl?.Invoke(this, e); - private void OnControlLeave(object sender, EventArgs e) - { - MouseLeaveControl?.Invoke(this, e); - } + private void OnControlLeave(object sender, EventArgs e) => MouseLeaveControl?.Invoke(this, e); - private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) - { + private void OnPaletteNeedPaint(object sender, NeedLayoutEventArgs e) => // Pass request onto the view provided paint delegate ViewPaintDelegate?.Invoke(this, e); - } - private void OnTrackBarGotFocus(object sender, EventArgs e) - { - OnGotFocus(e); - } + private void OnTrackBarGotFocus(object sender, EventArgs e) => OnGotFocus(e); - private void OnTrackBarLostFocus(object sender, EventArgs e) - { - OnLostFocus(e); - } + private void OnTrackBarLostFocus(object sender, EventArgs e) => OnLostFocus(e); - private void OnTrackBarValueChanged(object sender, EventArgs e) - { - ValueChanged?.Invoke(this, e); - } + private void OnTrackBarValueChanged(object sender, EventArgs e) => ValueChanged?.Invoke(this, e); - private void OnRibbonPaletteChanged(object sender, EventArgs e) - { - TrackBar.Palette = Ribbon.GetResolvedPalette(); - } + private void OnRibbonPaletteChanged(object sender, EventArgs e) => TrackBar.Palette = Ribbon.GetResolvedPalette(); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupTriple.cs b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupTriple.cs index da193338b..4b9a9f2d7 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupTriple.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Group Contents/KryptonRibbonGroupTriple.cs @@ -280,18 +280,12 @@ public override bool Visible /// /// Make the ribbon group visible. /// - public void Show() - { - Visible = true; - } + public void Show() => Visible = true; /// /// Make the ribbon group hidden. /// - public void Hide() - { - Visible = false; - } + public void Hide() => Visible = false; /// /// Gets and sets the maximum allowed size of the container. @@ -489,87 +483,39 @@ public override Component[] GetChildComponents() /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string propertyName) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + protected virtual void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion #region Internal - internal void OnDesignTimeAddButton() - { - DesignTimeAddButton?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddButton() => DesignTimeAddButton?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddColorButton() - { - DesignTimeAddColorButton?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddColorButton() => DesignTimeAddColorButton?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddCheckBox() - { - DesignTimeAddCheckBox?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddCheckBox() => DesignTimeAddCheckBox?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddRadioButton() - { - DesignTimeAddRadioButton?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddRadioButton() => DesignTimeAddRadioButton?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddLabel() - { - DesignTimeAddLabel?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddLabel() => DesignTimeAddLabel?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddCustomControl() - { - DesignTimeAddCustomControl?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddCustomControl() => DesignTimeAddCustomControl?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddTextBox() - { - DesignTimeAddTextBox?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddTextBox() => DesignTimeAddTextBox?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddMaskedTextBox() - { - DesignTimeAddMaskedTextBox?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddMaskedTextBox() => DesignTimeAddMaskedTextBox?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddRichTextBox() - { - DesignTimeAddRichTextBox?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddRichTextBox() => DesignTimeAddRichTextBox?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddComboBox() - { - DesignTimeAddComboBox?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddComboBox() => DesignTimeAddComboBox?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddNumericUpDown() - { - DesignTimeAddNumericUpDown?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddNumericUpDown() => DesignTimeAddNumericUpDown?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddDomainUpDown() - { - DesignTimeAddDomainUpDown?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddDomainUpDown() => DesignTimeAddDomainUpDown?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddDateTimePicker() - { - DesignTimeAddDateTimePicker?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddDateTimePicker() => DesignTimeAddDateTimePicker?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeAddTrackBar() - { - DesignTimeAddTrackBar?.Invoke(this, EventArgs.Empty); - } + internal void OnDesignTimeAddTrackBar() => DesignTimeAddTrackBar?.Invoke(this, EventArgs.Empty); - internal void OnDesignTimeContextMenu(MouseEventArgs e) - { - DesignTimeContextMenu?.Invoke(this, e); - } + internal void OnDesignTimeContextMenu(MouseEventArgs e) => DesignTimeContextMenu?.Invoke(this, e); internal override bool ProcessCmdKey(ref Message msg, Keys keyData) { diff --git a/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteGalleryRedirect.cs b/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteGalleryRedirect.cs index 1625d76c2..50e2489ab 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteGalleryRedirect.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteGalleryRedirect.cs @@ -109,11 +109,9 @@ public override void SetRedirector(PaletteRedirect? redirect) /// /// Source of the event. /// True if a layout is also needed. - protected void OnNeedPaint(object? sender, bool needLayout) - { + protected void OnNeedPaint(object? sender, bool needLayout) => // Pass request from child to our own handler PerformNeedPaint(needLayout); - } #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteRibbonContextBack.cs b/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteRibbonContextBack.cs index 15f650268..d5430e036 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteRibbonContextBack.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteRibbonContextBack.cs @@ -40,10 +40,7 @@ public PaletteRibbonContextBack([DisallowNull] KryptonRibbon ribbon) /// /// Sets the inheritance parent. /// - public void SetInherit(IPaletteRibbonBack inherit) - { - _inherit = inherit; - } + public void SetInherit(IPaletteRibbonBack inherit) => _inherit = inherit; #endregion #region BackColorStyle diff --git a/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteRibbonContextDouble.cs b/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteRibbonContextDouble.cs index 01f2f4371..e06c87558 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteRibbonContextDouble.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteRibbonContextDouble.cs @@ -59,10 +59,7 @@ public PaletteRibbonContextDouble([DisallowNull] KryptonRibbon ribbon) /// /// Sets the inheritance parent. /// - public void SetInherit(PaletteRibbonDoubleInheritOverride inherit) - { - _inherit = inherit; - } + public void SetInherit(PaletteRibbonDoubleInheritOverride inherit) => _inherit = inherit; #endregion #region BackColorStyle diff --git a/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteRibbonDisabled.cs b/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteRibbonDisabled.cs index 96523d5ed..4d00920d5 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteRibbonDisabled.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteRibbonDisabled.cs @@ -140,11 +140,9 @@ public virtual void SetInherit(PaletteRibbonRedirect inherit) /// /// Source of the event. /// True if a layout is also needed. - protected void OnNeedPaint(object? sender, bool needLayout) - { + protected void OnNeedPaint(object? sender, bool needLayout) => // Pass request from child to our own handler PerformNeedPaint(needLayout); - } #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteRibbonJustTab.cs b/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteRibbonJustTab.cs index a63fe46d7..7eb47c947 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteRibbonJustTab.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteRibbonJustTab.cs @@ -56,20 +56,14 @@ public PaletteRibbonJustTab([DisallowNull] PaletteRibbonRedirect inherit, /// Populate values from the base palette. /// /// The palette state to populate with. - public virtual void PopulateFromBase(PaletteState state) - { - _ribbonTab.PopulateFromBase(state); - } + public virtual void PopulateFromBase(PaletteState state) => _ribbonTab.PopulateFromBase(state); #endregion #region SetInherit /// /// Sets the inheritance parent. /// - public virtual void SetInherit(PaletteRibbonRedirect inherit) - { - _ribbonTab.SetInherit(inherit.RibbonTab, inherit.RibbonTab); - } + public virtual void SetInherit(PaletteRibbonRedirect inherit) => _ribbonTab.SetInherit(inherit.RibbonTab, inherit.RibbonTab); #endregion #region RibbonTab @@ -91,11 +85,9 @@ public virtual void SetInherit(PaletteRibbonRedirect inherit) /// /// Source of the event. /// True if a layout is also needed. - protected void OnNeedPaint(object? sender, bool needLayout) - { + protected void OnNeedPaint(object? sender, bool needLayout) => // Pass request from child to our own handler PerformNeedPaint(needLayout); - } #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteRibbonRedirect.cs b/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteRibbonRedirect.cs index d0cd6bf1c..378a5976c 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteRibbonRedirect.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Palette/PaletteRibbonRedirect.cs @@ -561,11 +561,9 @@ public override void SetRedirector(PaletteRedirect? redirect) /// /// Source of the event. /// True if a layout is also needed. - protected void OnNeedPaint(object? sender, bool needLayout) - { + protected void OnNeedPaint(object? sender, bool needLayout) => // Pass request from child to our own handler PerformNeedPaint(needLayout); - } #endregion #region Internal diff --git a/Source/Krypton Components/Krypton.Ribbon/Palette/RibbonAppButton.cs b/Source/Krypton Components/Krypton.Ribbon/Palette/RibbonAppButton.cs index c21150495..0bffb6605 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Palette/RibbonAppButton.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Palette/RibbonAppButton.cs @@ -329,10 +329,7 @@ public string AppButtonText private bool ShouldSerializeToolTipShadow() => !ToolTipShadow; - private void ResetToolTipShadow() - { - ToolTipShadow = true; - } + private void ResetToolTipShadow() => ToolTipShadow = true; #endregion #region AppButtonToolTipImage diff --git a/Source/Krypton Components/Krypton.Ribbon/Palette/RibbonRecentDocsTitleToContent.cs b/Source/Krypton Components/Krypton.Ribbon/Palette/RibbonRecentDocsTitleToContent.cs index 586bc493c..75f0ecadb 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Palette/RibbonRecentDocsTitleToContent.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Palette/RibbonRecentDocsTitleToContent.cs @@ -42,10 +42,7 @@ public RibbonRecentDocsTitleToContent([DisallowNull] PaletteRibbonGeneral ribbon /// /// Remove any cached resources. /// - public void Dispose() - { - _shortTextFont?.Dispose(); - } + public void Dispose() => _shortTextFont?.Dispose(); #endregion #region IPaletteContent diff --git a/Source/Krypton Components/Krypton.Ribbon/Palette/RibbonShortcuts.cs b/Source/Krypton Components/Krypton.Ribbon/Palette/RibbonShortcuts.cs index ba97684f4..14538fffe 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Palette/RibbonShortcuts.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Palette/RibbonShortcuts.cs @@ -67,10 +67,7 @@ public RibbonShortcuts() /// /// Resets the ToggleMinimizeMode property to its default value. /// - public void ResetToggleMinimizeMode() - { - ToggleMinimizeMode = DEFAULT_TOGGLE_MINIMIZE_MODE; - } + public void ResetToggleMinimizeMode() => ToggleMinimizeMode = DEFAULT_TOGGLE_MINIMIZE_MODE; #endregion #region ToggleKeyboardAccess1 @@ -89,10 +86,7 @@ public void ResetToggleMinimizeMode() /// /// Resets the ToggleKeyboardAccess1 property to its default value. /// - public void ResetToggleKeyboardAccess1() - { - ToggleKeyboardAccess1 = DEFAULT_TOGGLE_KEYBOARD_ACCESS1; - } + public void ResetToggleKeyboardAccess1() => ToggleKeyboardAccess1 = DEFAULT_TOGGLE_KEYBOARD_ACCESS1; #endregion #region ToggleKeyboardAccess2 @@ -111,10 +105,7 @@ public void ResetToggleKeyboardAccess1() /// /// Resets the ToggleKeyboardAccess2 property to its default value. /// - public void ResetToggleKeyboardAccess2() - { - ToggleKeyboardAccess2 = DEFAULT_TOGGLE_KEYBOARD_ACCESS2; - } + public void ResetToggleKeyboardAccess2() => ToggleKeyboardAccess2 = DEFAULT_TOGGLE_KEYBOARD_ACCESS2; #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/Palette/RibbonThemeManager.cs b/Source/Krypton Components/Krypton.Ribbon/Palette/RibbonThemeManager.cs index 3b90675e5..f256c3ab9 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Palette/RibbonThemeManager.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Palette/RibbonThemeManager.cs @@ -100,11 +100,9 @@ public class RibbonThemeManager /// The current . public static PaletteMode GetPaletteMode(KryptonManager manager) => ReturnPaletteMode(manager.GlobalPaletteMode); - private static PaletteMode ReturnPaletteMode(string themeName) - { + private static PaletteMode ReturnPaletteMode(string themeName) => // Note: Needs to be filled out - return PaletteMode.Custom; - } + PaletteMode.Custom; /// Returns the palette mode. /// The palette mode manager. diff --git a/Source/Krypton Components/Krypton.Ribbon/Utilities/BiDictionary.cs b/Source/Krypton Components/Krypton.Ribbon/Utilities/BiDictionary.cs index 9ea27d2c3..18b7987fb 100644 --- a/Source/Krypton Components/Krypton.Ribbon/Utilities/BiDictionary.cs +++ b/Source/Krypton Components/Krypton.Ribbon/Utilities/BiDictionary.cs @@ -60,9 +60,6 @@ public TFirst GetBySecond(TSecond second) return first; } - public ICollection GetAllFirsts() - { - return _firstToSecond.Keys; - } + public ICollection GetAllFirsts() => _firstToSecond.Keys; } } \ No newline at end of file diff --git a/Source/Krypton Components/Krypton.Ribbon/View Base/ViewRibbonManager.cs b/Source/Krypton Components/Krypton.Ribbon/View Base/ViewRibbonManager.cs index 0c4cc0555..053ddee62 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Base/ViewRibbonManager.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Base/ViewRibbonManager.cs @@ -58,10 +58,7 @@ public ViewRibbonManager(KryptonRibbon control, /// /// Application we are inside has become active. /// - public void Active() - { - _active = true; - } + public void Active() => _active = true; #endregion #region Inactive @@ -244,15 +241,9 @@ protected override void UpdateViewFromPoint(Control control, Point pt) #endregion #region Implementation - private void PerformNeedPaint(bool needLayout) - { - PerformNeedPaint(needLayout, Rectangle.Empty); - } + private void PerformNeedPaint(bool needLayout) => PerformNeedPaint(needLayout, Rectangle.Empty); - private void PerformNeedPaint(bool needLayout, Rectangle invalidRect) - { - _needPaintDelegate?.Invoke(this, new NeedLayoutEventArgs(needLayout, invalidRect)); - } + private void PerformNeedPaint(bool needLayout, Rectangle invalidRect) => _needPaintDelegate?.Invoke(this, new NeedLayoutEventArgs(needLayout, invalidRect)); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Base/ViewRibbonMinimizedManager.cs b/Source/Krypton Components/Krypton.Ribbon/View Base/ViewRibbonMinimizedManager.cs index e3167ee46..20991817f 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Base/ViewRibbonMinimizedManager.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Base/ViewRibbonMinimizedManager.cs @@ -70,10 +70,7 @@ public override void Dispose() /// /// Application we are inside has become active. /// - public void Active() - { - _active = true; - } + public void Active() => _active = true; #endregion #region Inactive @@ -244,11 +241,9 @@ public override void KeyDown(KeyEventArgs e) /// Perform key press handling. /// /// A KeyPressEventArgs that contains the event data. - public override void KeyPress(KeyPressEventArgs e) - { + public override void KeyPress(KeyPressEventArgs e) => // Tell current view of key event FocusView?.KeyPress(e); - } /// /// Perform key up handling. @@ -316,15 +311,9 @@ public ViewBase FocusView } } - private void PerformNeedPaint(bool needLayout) - { - PerformNeedPaint(needLayout, Rectangle.Empty); - } + private void PerformNeedPaint(bool needLayout) => PerformNeedPaint(needLayout, Rectangle.Empty); - private void PerformNeedPaint(bool needLayout, Rectangle invalidRect) - { - _needPaintDelegate?.Invoke(this, new NeedLayoutEventArgs(needLayout, invalidRect)); - } + private void PerformNeedPaint(bool needLayout, Rectangle invalidRect) => _needPaintDelegate?.Invoke(this, new NeedLayoutEventArgs(needLayout, invalidRect)); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Base/ViewRibbonPopupGroupManager.cs b/Source/Krypton Components/Krypton.Ribbon/View Base/ViewRibbonPopupGroupManager.cs index 061735ba7..4a96c1820 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Base/ViewRibbonPopupGroupManager.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Base/ViewRibbonPopupGroupManager.cs @@ -162,21 +162,17 @@ public override void MouseLeave([DisallowNull] EventArgs e) /// Perform key down handling. /// /// A KeyEventArgs that contains the event data. - public override void KeyDown(KeyEventArgs e) - { + public override void KeyDown(KeyEventArgs e) => // Tell current view of key event FocusView?.KeyDown(e); - } /// /// Perform key press handling. /// /// A KeyPressEventArgs that contains the event data. - public override void KeyPress(KeyPressEventArgs e) - { + public override void KeyPress(KeyPressEventArgs e) => // Tell current view of key event FocusView?.KeyPress(e); - } /// /// Perform key up handling. @@ -218,10 +214,7 @@ public ViewBase FocusView #endregion #region Implementation - private void PerformNeedPaint(bool needLayout, Rectangle invalidRect) - { - _needPaintDelegate?.Invoke(this, new NeedLayoutEventArgs(needLayout, invalidRect)); - } + private void PerformNeedPaint(bool needLayout, Rectangle invalidRect) => _needPaintDelegate?.Invoke(this, new NeedLayoutEventArgs(needLayout, invalidRect)); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Base/ViewRibbonQATOverflowManager.cs b/Source/Krypton Components/Krypton.Ribbon/View Base/ViewRibbonQATOverflowManager.cs index 8f9b75c99..a5eb9d574 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Base/ViewRibbonQATOverflowManager.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Base/ViewRibbonQATOverflowManager.cs @@ -108,21 +108,17 @@ public override void Layout(ViewLayoutContext context) /// Perform key down handling. /// /// A KeyEventArgs that contains the event data. - public override void KeyDown(KeyEventArgs e) - { + public override void KeyDown(KeyEventArgs e) => // Tell current view of key event FocusView?.KeyDown(e); - } /// /// Perform key press handling. /// /// A KeyPressEventArgs that contains the event data. - public override void KeyPress(KeyPressEventArgs e) - { + public override void KeyPress(KeyPressEventArgs e) => // Tell current view of key event FocusView?.KeyPress(e); - } /// /// Perform key up handling. diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonAppMenuDocs.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonAppMenuDocs.cs index f067e9133..deae02caf 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonAppMenuDocs.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonAppMenuDocs.cs @@ -63,14 +63,11 @@ protected override void Dispose(bool disposing) /// Perform rendering before child elements are rendered. /// /// Rendering context. - public override void RenderBefore(RenderContext context) - { + public override void RenderBefore(RenderContext context) => // Draw the application menu outer background _memento = context.Renderer.RenderRibbon.DrawRibbonBack(_ribbon.RibbonShape, context, ClientRectangle, State, _ribbon.StateCommon.RibbonAppMenuDocs, VisualOrientation.Top, false, _memento); - - } #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonAppMenuInner.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonAppMenuInner.cs index 098c1d27c..40aa3d2f8 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonAppMenuInner.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonAppMenuInner.cs @@ -63,14 +63,11 @@ protected override void Dispose(bool disposing) /// Perform rendering before child elements are rendered. /// /// Rendering context. - public override void RenderBefore(RenderContext context) - { + public override void RenderBefore(RenderContext context) => // Draw the application menu outer background - _memento = context.Renderer.RenderRibbon.DrawRibbonBack(_ribbon.RibbonShape, context, ClientRectangle, State, + _memento = context.Renderer.RenderRibbon.DrawRibbonBack(_ribbon.RibbonShape, context, ClientRectangle, State, _ribbon.StateCommon.RibbonAppMenuInner, VisualOrientation.Top, false, _memento); - - } #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonAppMenuRecentDoc.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonAppMenuRecentDoc.cs index 51c6b7f83..e94b512ff 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonAppMenuRecentDoc.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonAppMenuRecentDoc.cs @@ -64,14 +64,14 @@ public ViewDrawRibbonAppMenuRecentDec(KryptonRibbon ribbon, recentDoc.ImageTransparentColor); var entryPalette = new RibbonRecentDocsEntryToContent(ribbon.StateCommon.RibbonGeneral, ribbon.StateCommon.RibbonAppMenuDocsEntry); - ViewDrawContent entryDraw = new ViewDrawContent(entryPalette, entryContent, VisualOrientation.Top); + var entryDraw = new ViewDrawContent(entryPalette, entryContent, VisualOrientation.Top); docker.Add(entryDraw, ViewDockStyle.Fill); // Shortcut to Content gap docker.Add(new ViewLayoutSeparator(5), ViewDockStyle.Left); // Add the shortcut column - FixedContentValue shortcutContent = new FixedContentValue(ShortcutText, null, null, Color.Empty); + var shortcutContent = new FixedContentValue(ShortcutText, null, null, Color.Empty); var shortcutPalette = new RibbonRecentDocsShortcutToContent(ribbon.StateCommon.RibbonGeneral, ribbon.StateCommon.RibbonAppMenuDocsEntry); var shortcutDraw = new ViewDrawRibbonRecentShortcut(shortcutPalette, shortcutContent); @@ -139,19 +139,13 @@ public override Size GetPreferredSize([DisallowNull] ViewLayoutContext context) /// Raises the Closing event on the provider. /// /// A CancelEventArgs containing the event data. - public void Closing(CancelEventArgs cea) - { - Provider.OnClosing(cea); - } + public void Closing(CancelEventArgs cea) => Provider.OnClosing(cea); /// /// Raises the Close event on the provider. /// /// A CancelEventArgs containing the event data. - public void Close(CloseReasonEventArgs e) - { - Provider.OnClose(e); - } + public void Close(CloseReasonEventArgs e) => Provider.OnClose(e); /// /// Gets direct access to the context menu provider. diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonCaptionArea.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonCaptionArea.cs index 15b470765..cad87ada2 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonCaptionArea.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonCaptionArea.cs @@ -849,24 +849,19 @@ public bool PreventIntegration /// /// Notify a change in the application button image. /// - public void AppButtonChanged() - { + public void AppButtonChanged() => // Requests a repaint to show the change. OnAppButtonNeedPaint(this, new NeedLayoutEventArgs(false)); - } #endregion #region AppButtonChanged /// /// Update the visible state of the caption area based on integration, app button, contexts and qat location. /// - public void UpdateVisible() - { - Visible = !_integrated && + public void UpdateVisible() => Visible = !_integrated && (_ribbon.RibbonAppButton.AppButtonVisible || (_ribbon.QATLocation == QATLocation.Above) || (_ribbon.RibbonContexts.Count > 0)); - } #endregion #region VisibleQAT @@ -1016,11 +1011,9 @@ public Padding RealWindowBorders /// /// Redecide if the custom chrome and integration can occur. /// - public void PerformFormChromeCheck() - { + public void PerformFormChromeCheck() => // Update decision about integrating or providing caption functionality OnFormChromeCheck(null, EventArgs.Empty); - } #endregion #region DoesClientMouseDownEndAllTracking @@ -1090,10 +1083,7 @@ protected NeedPaintHandler NeedPaintDelegate /// Fires a request to have painting/layout performed. /// /// Does the palette change require a layout. - protected void PerformNeedPaint(bool needLayout) - { - _needPaintDelegate(this, new NeedLayoutEventArgs(needLayout)); - } + protected void PerformNeedPaint(bool needLayout) => _needPaintDelegate(this, new NeedLayoutEventArgs(needLayout)); #endregion #region Implementation @@ -1147,13 +1137,11 @@ private void CreateViewElements() base.SetPalettes(_redirectCaption.PaletteBack, _redirectCaption.PaletteBorder!); } - private void SetupParentMonitoring() - { + private void SetupParentMonitoring() => // We have to know when the parent of the ribbon changes so we can then hook // into monitoring the top level custom chrome control. We need information this // decide if we integrate with top chrome or show this control instead. _ribbon.ParentChanged += OnRibbonParentChanged; - } private void OnRibbonParentChanged(object sender, EventArgs e) { @@ -1169,7 +1157,7 @@ private void OnRibbonParentChanged(object sender, EventArgs e) if (_ribbon is { IsDisposed: false, Disposing: false }) { // Find the new owning level form we are hosted inside - Form? ownerForm = _ribbon.Parent as Form; + var ownerForm = _ribbon.Parent as Form; // Should always be inside a form, but you never know! // We only care if the owner form is a KryptonForm instance diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonComposition.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonComposition.cs index 0c1f0a2dd..c85ae2cbd 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonComposition.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonComposition.cs @@ -130,11 +130,9 @@ public VisualForm CompOwnerForm /// Request a repaint and optional layout. /// /// Is a layout required. - public void CompNeedPaint(bool needLayout) - { + public void CompNeedPaint(bool needLayout) => // Pass request onto the ribbon instance _needPaint(this, new NeedLayoutEventArgs(needLayout)); - } #endregion #region Layout diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonContextTitle.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonContextTitle.cs index d4e698372..1ae3e43d4 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonContextTitle.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonContextTitle.cs @@ -424,8 +424,8 @@ private void RenderOnComposition(RenderContext context) if (rectClip.IntersectsWith(ClientRectangle)) { // Get the hDC for the graphics instance and create a memory DC - IntPtr gDC = context.Graphics.GetHdc(); - IntPtr mDC = PI.CreateCompatibleDC(gDC); + var gDC = context.Graphics.GetHdc(); + var mDC = PI.CreateCompatibleDC(gDC); var bmi = new PI.BITMAPINFO(); bmi.biSize = (uint)Marshal.SizeOf(bmi); @@ -436,7 +436,7 @@ private void RenderOnComposition(RenderContext context) bmi.biPlanes = 1; // Create a device independant bitmp and select into the memory DC - IntPtr hDIB = PI.CreateDIBSection(gDC, ref bmi, 0, out _, IntPtr.Zero, 0); + var hDIB = PI.CreateDIBSection(gDC, ref bmi, 0, out _, IntPtr.Zero, 0); PI.SelectObject(mDC, hDIB); // To call the renderer we need to convert from Win32 HDC to Graphics object @@ -454,7 +454,7 @@ private void RenderOnComposition(RenderContext context) } // Select the font for use when drawing - IntPtr hFont = _contentProvider.GetContentShortTextFont(State).ToHfont(); + var hFont = _contentProvider.GetContentShortTextFont(State).ToHfont(); PI.SelectObject(mDC, hFont); // Get renderer for the correct state diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignCluster.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignCluster.cs index 0a5184e02..e8d2b2fb9 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignCluster.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignCluster.cs @@ -131,15 +131,9 @@ protected override void OnClick(object sender, EventArgs e) #endregion #region Implementation - private void OnAddButton(object sender, EventArgs e) - { - _ribbonCluster.OnDesignTimeAddButton(); - } + private void OnAddButton(object sender, EventArgs e) => _ribbonCluster.OnDesignTimeAddButton(); - private void OnAddColorButton(object sender, EventArgs e) - { - _ribbonCluster.OnDesignTimeAddColorButton(); - } + private void OnAddColorButton(object sender, EventArgs e) => _ribbonCluster.OnDesignTimeAddColorButton(); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignGroup.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignGroup.cs index cb503c856..207f4fade 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignGroup.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignGroup.cs @@ -69,10 +69,7 @@ public override string ToString() => /// /// Source of the event. /// An EventArgs containing the event data. - protected override void OnClick(object sender, EventArgs e) - { - Ribbon.SelectedTab.OnDesignTimeAddGroup(); - } + protected override void OnClick(object sender, EventArgs e) => Ribbon.SelectedTab.OnDesignTimeAddGroup(); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignGroupContainer.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignGroupContainer.cs index 1aaed802a..af5f43633 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignGroupContainer.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignGroupContainer.cs @@ -137,25 +137,13 @@ protected override void OnClick(object sender, EventArgs e) #endregion #region Implementation - private void OnAddTriple(object sender, EventArgs e) - { - _ribbonGroup.OnDesignTimeAddTriple(); - } + private void OnAddTriple(object sender, EventArgs e) => _ribbonGroup.OnDesignTimeAddTriple(); - private void OnAddLines(object sender, EventArgs e) - { - _ribbonGroup.OnDesignTimeAddLines(); - } + private void OnAddLines(object sender, EventArgs e) => _ribbonGroup.OnDesignTimeAddLines(); - private void OnAddSeparator(object sender, EventArgs e) - { - _ribbonGroup.OnDesignTimeAddSeparator(); - } + private void OnAddSeparator(object sender, EventArgs e) => _ribbonGroup.OnDesignTimeAddSeparator(); - private void OnAddGallery(object sender, EventArgs e) - { - _ribbonGroup.OnDesignTimeAddGallery(); - } + private void OnAddGallery(object sender, EventArgs e) => _ribbonGroup.OnDesignTimeAddGallery(); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignGroupLines.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignGroupLines.cs index 6c2f5062d..98a3e7581 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignGroupLines.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignGroupLines.cs @@ -182,80 +182,35 @@ protected override void OnClick(object sender, EventArgs e) #endregion #region Implementation - private void OnAddButton(object sender, EventArgs e) - { - _ribbonLines.OnDesignTimeAddButton(); - } + private void OnAddButton(object sender, EventArgs e) => _ribbonLines.OnDesignTimeAddButton(); - private void OnAddColorButton(object sender, EventArgs e) - { - _ribbonLines.OnDesignTimeAddColorButton(); - } + private void OnAddColorButton(object sender, EventArgs e) => _ribbonLines.OnDesignTimeAddColorButton(); - private void OnAddCheckBox(object sender, EventArgs e) - { - _ribbonLines.OnDesignTimeAddCheckBox(); - } + private void OnAddCheckBox(object sender, EventArgs e) => _ribbonLines.OnDesignTimeAddCheckBox(); - private void OnAddRadioButton(object sender, EventArgs e) - { - _ribbonLines.OnDesignTimeAddRadioButton(); - } + private void OnAddRadioButton(object sender, EventArgs e) => _ribbonLines.OnDesignTimeAddRadioButton(); - private void OnAddCluster(object sender, EventArgs e) - { - _ribbonLines.OnDesignTimeAddCluster(); - } + private void OnAddCluster(object sender, EventArgs e) => _ribbonLines.OnDesignTimeAddCluster(); - private void OnAddLabel(object sender, EventArgs e) - { - _ribbonLines.OnDesignTimeAddLabel(); - } + private void OnAddLabel(object sender, EventArgs e) => _ribbonLines.OnDesignTimeAddLabel(); - private void OnAddCustomControl(object sender, EventArgs e) - { - _ribbonLines.OnDesignTimeAddCustomControl(); - } + private void OnAddCustomControl(object sender, EventArgs e) => _ribbonLines.OnDesignTimeAddCustomControl(); - private void OnAddTextBox(object sender, EventArgs e) - { - _ribbonLines.OnDesignTimeAddTextBox(); - } + private void OnAddTextBox(object sender, EventArgs e) => _ribbonLines.OnDesignTimeAddTextBox(); - private void OnAddMaskedTextBox(object sender, EventArgs e) - { - _ribbonLines.OnDesignTimeAddMaskedTextBox(); - } + private void OnAddMaskedTextBox(object sender, EventArgs e) => _ribbonLines.OnDesignTimeAddMaskedTextBox(); - private void OnAddRichTextBox(object sender, EventArgs e) - { - _ribbonLines.OnDesignTimeAddRichTextBox(); - } + private void OnAddRichTextBox(object sender, EventArgs e) => _ribbonLines.OnDesignTimeAddRichTextBox(); - private void OnAddComboBox(object sender, EventArgs e) - { - _ribbonLines.OnDesignTimeAddComboBox(); - } + private void OnAddComboBox(object sender, EventArgs e) => _ribbonLines.OnDesignTimeAddComboBox(); - private void OnAddNumericUpDown(object sender, EventArgs e) - { - _ribbonLines.OnDesignTimeAddNumericUpDown(); - } + private void OnAddNumericUpDown(object sender, EventArgs e) => _ribbonLines.OnDesignTimeAddNumericUpDown(); - private void OnAddDomainUpDown(object sender, EventArgs e) - { - _ribbonLines.OnDesignTimeAddDomainUpDown(); - } + private void OnAddDomainUpDown(object sender, EventArgs e) => _ribbonLines.OnDesignTimeAddDomainUpDown(); - private void OnAddDateTimePicker(object sender, EventArgs e) - { - _ribbonLines.OnDesignTimeAddDateTimePicker(); - } + private void OnAddDateTimePicker(object sender, EventArgs e) => _ribbonLines.OnDesignTimeAddDateTimePicker(); - private void OnAddTrackBar(object sender, EventArgs e) - { - _ribbonLines.OnDesignTimeAddTrackBar(); - } + private void OnAddTrackBar(object sender, EventArgs e) => _ribbonLines.OnDesignTimeAddTrackBar(); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignGroupTriple.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignGroupTriple.cs index c1d2a1ef6..61c3d62fa 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignGroupTriple.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignGroupTriple.cs @@ -185,75 +185,33 @@ protected override void OnClick(object sender, EventArgs e) #endregion #region Implementation - private void OnAddButton(object sender, EventArgs e) - { - _ribbonTriple.OnDesignTimeAddButton(); - } + private void OnAddButton(object sender, EventArgs e) => _ribbonTriple.OnDesignTimeAddButton(); - private void OnAddColorButton(object sender, EventArgs e) - { - _ribbonTriple.OnDesignTimeAddColorButton(); - } + private void OnAddColorButton(object sender, EventArgs e) => _ribbonTriple.OnDesignTimeAddColorButton(); - private void OnAddCheckBox(object sender, EventArgs e) - { - _ribbonTriple.OnDesignTimeAddCheckBox(); - } + private void OnAddCheckBox(object sender, EventArgs e) => _ribbonTriple.OnDesignTimeAddCheckBox(); - private void OnAddRadioButton(object sender, EventArgs e) - { - _ribbonTriple.OnDesignTimeAddRadioButton(); - } + private void OnAddRadioButton(object sender, EventArgs e) => _ribbonTriple.OnDesignTimeAddRadioButton(); - private void OnAddLabel(object sender, EventArgs e) - { - _ribbonTriple.OnDesignTimeAddLabel(); - } + private void OnAddLabel(object sender, EventArgs e) => _ribbonTriple.OnDesignTimeAddLabel(); - private void OnAddCustomControl(object sender, EventArgs e) - { - _ribbonTriple.OnDesignTimeAddCustomControl(); - } + private void OnAddCustomControl(object sender, EventArgs e) => _ribbonTriple.OnDesignTimeAddCustomControl(); - private void OnAddTextBox(object sender, EventArgs e) - { - _ribbonTriple.OnDesignTimeAddTextBox(); - } + private void OnAddTextBox(object sender, EventArgs e) => _ribbonTriple.OnDesignTimeAddTextBox(); - private void OnAddMaskedTextBox(object sender, EventArgs e) - { - _ribbonTriple.OnDesignTimeAddMaskedTextBox(); - } + private void OnAddMaskedTextBox(object sender, EventArgs e) => _ribbonTriple.OnDesignTimeAddMaskedTextBox(); - private void OnAddRichTextBox(object sender, EventArgs e) - { - _ribbonTriple.OnDesignTimeAddRichTextBox(); - } + private void OnAddRichTextBox(object sender, EventArgs e) => _ribbonTriple.OnDesignTimeAddRichTextBox(); - private void OnAddComboBox(object sender, EventArgs e) - { - _ribbonTriple.OnDesignTimeAddComboBox(); - } + private void OnAddComboBox(object sender, EventArgs e) => _ribbonTriple.OnDesignTimeAddComboBox(); - private void OnAddNumericUpDown(object sender, EventArgs e) - { - _ribbonTriple.OnDesignTimeAddNumericUpDown(); - } + private void OnAddNumericUpDown(object sender, EventArgs e) => _ribbonTriple.OnDesignTimeAddNumericUpDown(); - private void OnAddDomainUpDown(object sender, EventArgs e) - { - _ribbonTriple.OnDesignTimeAddDomainUpDown(); - } + private void OnAddDomainUpDown(object sender, EventArgs e) => _ribbonTriple.OnDesignTimeAddDomainUpDown(); - private void OnAddDateTimePicker(object sender, EventArgs e) - { - _ribbonTriple.OnDesignTimeAddDateTimePicker(); - } + private void OnAddDateTimePicker(object sender, EventArgs e) => _ribbonTriple.OnDesignTimeAddDateTimePicker(); - private void OnAddTrackBar(object sender, EventArgs e) - { - _ribbonTriple.OnDesignTimeAddTrackBar(); - } + private void OnAddTrackBar(object sender, EventArgs e) => _ribbonTriple.OnDesignTimeAddTrackBar(); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignTab.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignTab.cs index ca7ca1d23..9c00284b4 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignTab.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDesignTab.cs @@ -69,11 +69,9 @@ public override string ToString() => /// /// Source of the event. /// An EventArgs containing the event data. - protected override void OnClick(object sender, EventArgs e) - { + protected override void OnClick(object sender, EventArgs e) => // Ask the ribbon to add a new tab at design time Ribbon.OnDesignTimeAddTab(); - } #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDropArrow.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDropArrow.cs index cf24e953d..abb1ff580 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDropArrow.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonDropArrow.cs @@ -71,15 +71,13 @@ public override void Layout([DisallowNull] ViewLayoutContext context) /// Perform rendering before child elements are rendered. /// /// Rendering context. - public override void RenderBefore(RenderContext context) - { + public override void RenderBefore(RenderContext context) => // Use renderer to draw the drop arrow in the provided space - context.Renderer.RenderGlyph.DrawRibbonDropArrow(_ribbon.RibbonShape, - context, - ClientRectangle, - _ribbon.StateCommon.RibbonGeneral, + context.Renderer.RenderGlyph.DrawRibbonDropArrow(_ribbon.RibbonShape, + context, + ClientRectangle, + _ribbon.StateCommon.RibbonGeneral, State); - } #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGalleryButton.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGalleryButton.cs index 85cb3e5c2..7ca117768 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGalleryButton.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGalleryButton.cs @@ -194,10 +194,7 @@ public override void RenderBefore(RenderContext context) /// /// Force the mouse to leave the button. /// - public void ForceLeave() - { - _controller.ForceLeave(); - } + public void ForceLeave() => _controller.ForceLeave(); #endregion #region Implementation @@ -305,10 +302,7 @@ private GraphicsPath CreateBorderPath(Rectangle rect) #endregion #region Private - private void OnButtonClick(object sender, MouseEventArgs e) - { - Click?.Invoke(this, e); - } + private void OnButtonClick(object sender, MouseEventArgs e) => Click?.Invoke(this, e); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGalleryItem.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGalleryItem.cs index 3c6877921..8100c83ba 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGalleryItem.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGalleryItem.cs @@ -220,10 +220,7 @@ public override void Render([DisallowNull] RenderContext context) #endregion #region Private - private void OnItemClick(object sender, MouseEventArgs e) - { - _gallery.SelectedIndex = _imageIndex; - } + private void OnItemClick(object sender, MouseEventArgs e) => _gallery.SelectedIndex = _imageIndex; #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroup.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroup.cs index e58474756..1ac210cb4 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroup.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroup.cs @@ -310,10 +310,7 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList) /// /// Does the palette change require a layout. /// Rectangle to invalidate. - public void PerformNeedPaint(bool needLayout, Rectangle invalidRect) - { - OnNeedPaint(needLayout, invalidRect); - } + public void PerformNeedPaint(bool needLayout, Rectangle invalidRect) => OnNeedPaint(needLayout, invalidRect); #endregion #region Layout @@ -548,10 +545,7 @@ public override void RenderBefore(RenderContext context) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout, Rectangle.Empty); - } + protected virtual void OnNeedPaint(bool needLayout) => OnNeedPaint(needLayout, Rectangle.Empty); /// /// Raises the NeedPaint event. @@ -875,7 +869,7 @@ private void RenderCollapsedPressedBefore(RenderContext context) IPaletteRibbonBack paletteBack = _ribbon.StatePressed.RibbonGroupCollapsedBack; IPaletteRibbonBack paletteBorder = _ribbon.StatePressed.RibbonGroupCollapsedBorder; - PaletteState state = PaletteState.Pressed; + var state = PaletteState.Pressed; // Are we a group inside a context tab? if (!string.IsNullOrEmpty(_ribbon.SelectedTab?.ContextName)) @@ -1009,10 +1003,7 @@ private void OnGroupPropertyChanged(object sender, PropertyChangedEventArgs e) } } - private void OnContextClick(object sender, MouseEventArgs e) - { - _ribbonGroup.OnDesignTimeContextMenu(new MouseEventArgs(MouseButtons.Right, 1, e.X, e.Y, 0)); - } + private void OnContextClick(object sender, MouseEventArgs e) => _ribbonGroup.OnDesignTimeContextMenu(new MouseEventArgs(MouseButtons.Right, 1, e.X, e.Y, 0)); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupButton.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupButton.cs index 1f24c4f35..005d099a4 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupButton.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupButton.cs @@ -207,7 +207,7 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) // Get the screen location of the button Rectangle viewRect = _ribbon.KeyTipToScreen(this[0]); - Point screenPt = Point.Empty; + var screenPt = Point.Empty; GroupButtonController? controller = null; // Determine the screen position of the key tip dependant on item location/size @@ -235,18 +235,12 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) /// Override the group item size if possible. /// /// New size to use. - public void SetGroupItemSize(GroupItemSize size) - { - UpdateItemSizeState(size); - } + public void SetGroupItemSize(GroupItemSize size) => UpdateItemSizeState(size); /// /// Reset the group item size to the item definition. /// - public void ResetGroupItemSize() - { - UpdateItemSizeState(); - } + public void ResetGroupItemSize() => UpdateItemSizeState(); /// /// Discover the preferred size of the element. @@ -315,10 +309,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout, Rectangle.Empty); - } + protected virtual void OnNeedPaint(bool needLayout) => OnNeedPaint(needLayout, Rectangle.Empty); /// /// Raises the NeedPaint event. @@ -523,10 +514,7 @@ private void UpdateDropDownState() _viewMediumSmallText2Sep3.Visible = dropDown || splitButton; } - private void UpdateItemSizeState() - { - UpdateItemSizeState(GroupButton.ItemSizeCurrent); - } + private void UpdateItemSizeState() => UpdateItemSizeState(GroupButton.ItemSizeCurrent); private void UpdateItemSizeState(GroupItemSize size) { @@ -549,30 +537,15 @@ private void UpdateItemSizeState(GroupItemSize size) } } - private void OnLargeButtonClick(object sender, EventArgs e) - { - GroupButton.PerformClick(_viewLarge.FinishDelegate); - } + private void OnLargeButtonClick(object sender, EventArgs e) => GroupButton.PerformClick(_viewLarge.FinishDelegate); - private void OnLargeButtonDropDown(object sender, EventArgs e) - { - GroupButton.PerformDropDown(_viewLarge.FinishDelegate); - } + private void OnLargeButtonDropDown(object sender, EventArgs e) => GroupButton.PerformDropDown(_viewLarge.FinishDelegate); - private void OnMediumSmallButtonClick(object sender, EventArgs e) - { - GroupButton.PerformClick(_viewMediumSmall.FinishDelegate); - } + private void OnMediumSmallButtonClick(object sender, EventArgs e) => GroupButton.PerformClick(_viewMediumSmall.FinishDelegate); - private void OnMediumSmallButtonDropDown(object sender, EventArgs e) - { - GroupButton.PerformDropDown(_viewMediumSmall.FinishDelegate); - } + private void OnMediumSmallButtonDropDown(object sender, EventArgs e) => GroupButton.PerformDropDown(_viewMediumSmall.FinishDelegate); - private void OnContextClick(object sender, MouseEventArgs e) - { - GroupButton.OnDesignTimeContextMenu(e); - } + private void OnContextClick(object sender, MouseEventArgs e) => GroupButton.OnDesignTimeContextMenu(e); private void OnButtonPropertyChanged(object sender, PropertyChangedEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupButtonBackBorder.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupButtonBackBorder.cs index ba9133b10..cca04c980 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupButtonBackBorder.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupButtonBackBorder.cs @@ -740,20 +740,11 @@ private void ActionFinished(object sender, EventArgs e) Controller.RemoveFixed(); } - private void OnClick(object sender, EventArgs e) - { - Click?.Invoke(this, e); - } + private void OnClick(object sender, EventArgs e) => Click?.Invoke(this, e); - private void OnContextClick(object sender, MouseEventArgs e) - { - ContextClick?.Invoke(this, e); - } + private void OnContextClick(object sender, MouseEventArgs e) => ContextClick?.Invoke(this, e); - private void OnDropDown(object sender, EventArgs e) - { - DropDown?.Invoke(this, e); - } + private void OnDropDown(object sender, EventArgs e) => DropDown?.Invoke(this, e); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupCheckBox.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupCheckBox.cs index 8525b2bff..1bebaed99 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupCheckBox.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupCheckBox.cs @@ -38,7 +38,7 @@ internal class ViewDrawRibbonGroupCheckBox : ViewComposite, private ViewDrawRibbonGroupCheckBoxText _viewMediumSmallText2; private GroupCheckBoxController? _viewMediumSmallController; private readonly EventHandler? _finishDelegateMediumSmall; - private readonly NeedPaintHandler _needPaint; + private readonly NeedPaintHandler? _needPaint; private GroupItemSize _currentSize; #endregion @@ -101,14 +101,14 @@ protected override void Dispose(bool disposing) { if (disposing) { - if (GroupCheckBox != null) + if (GroupCheckBox != null!) { // Must unhook to prevent memory leaks GroupCheckBox.PropertyChanged -= OnCheckBoxPropertyChanged; // Remove association with definition - GroupCheckBox.CheckBoxView = null; - GroupCheckBox = null; + GroupCheckBox.CheckBoxView = null!; + GroupCheckBox = null!; } } @@ -206,7 +206,7 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) // Get the screen location of the check box Rectangle viewRect = _ribbon.KeyTipToScreen(this[0]); - Point screenPt = Point.Empty; + var screenPt = Point.Empty; GroupCheckBoxController? controller = null; // Determine the screen position of the key tip dependant on item location/size @@ -234,18 +234,12 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) /// Override the group item size if possible. /// /// New size to use. - public void SetGroupItemSize(GroupItemSize size) - { - UpdateItemSizeState(size); - } + public void SetGroupItemSize(GroupItemSize size) => UpdateItemSizeState(size); /// /// Reset the group item size to the item definition. /// - public void ResetGroupItemSize() - { - UpdateItemSizeState(); - } + public void ResetGroupItemSize() => UpdateItemSizeState(); /// /// Discover the preferred size of the element. @@ -277,7 +271,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) UpdateItemSizeState(); // We take on all the available display area - ClientRectangle = context.DisplayRectangle; + ClientRectangle = context!.DisplayRectangle; // Let child elements layout in given space base.Layout(context); @@ -289,10 +283,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout, Rectangle.Empty); - } + protected virtual void OnNeedPaint(bool needLayout) => OnNeedPaint(needLayout, Rectangle.Empty); /// /// Raises the NeedPaint event. @@ -321,7 +312,7 @@ private void CreateLargeCheckBoxView() // Add the large button at the top _viewLargeImage = new ViewDrawRibbonGroupCheckBoxImage(_ribbon, GroupCheckBox, true); - ViewLayoutRibbonCenterPadding largeImagePadding = new ViewLayoutRibbonCenterPadding(_largeImagePadding) + var largeImagePadding = new ViewLayoutRibbonCenterPadding(_largeImagePadding) { _viewLargeImage }; @@ -360,7 +351,7 @@ private void CreateMediumSmallCheckBoxView() _viewMediumSmallImage = new ViewDrawRibbonGroupCheckBoxImage(_ribbon, GroupCheckBox, false); _viewMediumSmallText1 = new ViewDrawRibbonGroupCheckBoxText(_ribbon, GroupCheckBox, true); _viewMediumSmallText2 = new ViewDrawRibbonGroupCheckBoxText(_ribbon, GroupCheckBox, false); - ViewLayoutRibbonCenterPadding imagePadding = new ViewLayoutRibbonCenterPadding(_smallImagePadding) + var imagePadding = new ViewLayoutRibbonCenterPadding(_smallImagePadding) { _viewMediumSmallImage }; @@ -389,7 +380,7 @@ private void CreateMediumSmallCheckBoxView() _viewMediumSmall, _viewMediumSmall.MouseController); } - private void DefineRootView(ViewBase view) + private void DefineRootView([DisallowNull] ViewBase view) { // Remove any existing view Clear(); @@ -434,10 +425,7 @@ private void UpdateCheckState() _viewMediumSmallImage.CheckState = newCheckState; } - private void UpdateItemSizeState() - { - UpdateItemSizeState(GroupCheckBox.ItemSizeCurrent); - } + private void UpdateItemSizeState() => UpdateItemSizeState(GroupCheckBox.ItemSizeCurrent); private void UpdateItemSizeState(GroupItemSize size) { @@ -455,37 +443,28 @@ private void UpdateItemSizeState(GroupItemSize size) } } - private void OnLargeCheckBoxClick(object sender, EventArgs e) - { - GroupCheckBox.PerformClick(_finishDelegateLarge); - } + private void OnLargeCheckBoxClick(object sender, EventArgs e) => GroupCheckBox.PerformClick(_finishDelegateLarge); - private void OnMediumSmallCheckBoxClick(object sender, EventArgs e) - { - GroupCheckBox.PerformClick(_finishDelegateMediumSmall); - } + private void OnMediumSmallCheckBoxClick(object sender, EventArgs e) => GroupCheckBox.PerformClick(_finishDelegateMediumSmall); - private void OnContextClick(object sender, MouseEventArgs e) - { - GroupCheckBox.OnDesignTimeContextMenu(e); - } + private void OnContextClick(object sender, MouseEventArgs e) => GroupCheckBox.OnDesignTimeContextMenu(e); private void ActionFinishedLarge(object sender, EventArgs e) { - // Remove any popups that result from an action occuring - _ribbon?.ActionOccurred(); + // Remove any popups that result from an action occurring + _ribbon.ActionOccurred(); // Remove the fixed pressed appearance - _viewLargeController.RemoveFixed(); + _viewLargeController?.RemoveFixed(); } private void ActionFinishedMediumSmall(object sender, EventArgs e) { - // Remove any popups that result from an action occuring - _ribbon?.ActionOccurred(); + // Remove any popups that result from an action occurring + _ribbon.ActionOccurred(); // Remove the fixed pressed appearance - _viewMediumSmallController.RemoveFixed(); + _viewMediumSmallController?.RemoveFixed(); } private void OnCheckBoxPropertyChanged(object sender, PropertyChangedEventArgs e) diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupClusterButton.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupClusterButton.cs index 3c8f5b3c3..45c1f17c9 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupClusterButton.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupClusterButton.cs @@ -258,18 +258,12 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) /// Override the group item size if possible. /// /// New size to use. - public void SetGroupItemSize(GroupItemSize size) - { - UpdateItemSizeState(size); - } + public void SetGroupItemSize(GroupItemSize size) => UpdateItemSizeState(size); /// /// Reset the group item size to the item definition. /// - public void ResetGroupItemSize() - { - UpdateItemSizeState(); - } + public void ResetGroupItemSize() => UpdateItemSizeState(); /// /// Discover the preferred size of the element. @@ -321,10 +315,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout, Rectangle.Empty); - } + protected virtual void OnNeedPaint(bool needLayout) => OnNeedPaint(needLayout, Rectangle.Empty); /// /// Raises the NeedPaint event. @@ -409,10 +400,7 @@ private void CreateView() Add(_viewMediumSmall); } - private void UpdateItemSizeState() - { - UpdateItemSizeState(GroupClusterButton.ItemSizeCurrent); - } + private void UpdateItemSizeState() => UpdateItemSizeState(GroupClusterButton.ItemSizeCurrent); private void UpdateItemSizeState(GroupItemSize size) { @@ -466,20 +454,11 @@ private void UpdateDropDownState() _viewMediumSmall.ButtonType = GroupClusterButton.ButtonType; } - private void OnSmallButtonClick(object sender, EventArgs e) - { - GroupClusterButton.PerformClick(_viewMediumSmall.FinishDelegate); - } + private void OnSmallButtonClick(object sender, EventArgs e) => GroupClusterButton.PerformClick(_viewMediumSmall.FinishDelegate); - private void OnSmallButtonDropDown(object sender, EventArgs e) - { - GroupClusterButton.PerformDropDown(_viewMediumSmall.FinishDelegate); - } + private void OnSmallButtonDropDown(object sender, EventArgs e) => GroupClusterButton.PerformDropDown(_viewMediumSmall.FinishDelegate); - private void OnContextClick(object sender, MouseEventArgs e) - { - GroupClusterButton.OnDesignTimeContextMenu(e); - } + private void OnContextClick(object sender, MouseEventArgs e) => GroupClusterButton.OnDesignTimeContextMenu(e); private void OnButtonPropertyChanged(object sender, PropertyChangedEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupClusterColorButton.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupClusterColorButton.cs index 44ab363b3..fe0dde65b 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupClusterColorButton.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupClusterColorButton.cs @@ -258,18 +258,12 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) /// Override the group item size if possible. /// /// New size to use. - public void SetGroupItemSize(GroupItemSize size) - { - UpdateItemSizeState(size); - } + public void SetGroupItemSize(GroupItemSize size) => UpdateItemSizeState(size); /// /// Reset the group item size to the item definition. /// - public void ResetGroupItemSize() - { - UpdateItemSizeState(); - } + public void ResetGroupItemSize() => UpdateItemSizeState(); /// /// Discover the preferred size of the element. @@ -321,10 +315,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout, Rectangle.Empty); - } + protected virtual void OnNeedPaint(bool needLayout) => OnNeedPaint(needLayout, Rectangle.Empty); /// /// Raises the NeedPaint event. @@ -409,10 +400,7 @@ private void CreateView() Add(_viewMediumSmall); } - private void UpdateItemSizeState() - { - UpdateItemSizeState(GroupClusterColorButton.ItemSizeCurrent); - } + private void UpdateItemSizeState() => UpdateItemSizeState(GroupClusterColorButton.ItemSizeCurrent); private void UpdateItemSizeState(GroupItemSize size) { @@ -464,20 +452,11 @@ private void UpdateDropDownState() } - private void OnSmallButtonClick(object sender, EventArgs e) - { - GroupClusterColorButton.PerformClick(_viewMediumSmall.FinishDelegate); - } + private void OnSmallButtonClick(object sender, EventArgs e) => GroupClusterColorButton.PerformClick(_viewMediumSmall.FinishDelegate); - private void OnSmallButtonDropDown(object sender, EventArgs e) - { - GroupClusterColorButton.PerformDropDown(_viewMediumSmall.FinishDelegate); - } + private void OnSmallButtonDropDown(object sender, EventArgs e) => GroupClusterColorButton.PerformDropDown(_viewMediumSmall.FinishDelegate); - private void OnContextClick(object sender, MouseEventArgs e) - { - GroupClusterColorButton.OnDesignTimeContextMenu(e); - } + private void OnContextClick(object sender, MouseEventArgs e) => GroupClusterColorButton.OnDesignTimeContextMenu(e); private void OnButtonPropertyChanged(object sender, PropertyChangedEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupColorButton.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupColorButton.cs index 041440500..58e85678c 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupColorButton.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupColorButton.cs @@ -205,7 +205,7 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) // Get the screen location of the button Rectangle viewRect = _ribbon.KeyTipToScreen(this[0]); - Point screenPt = Point.Empty; + var screenPt = Point.Empty; GroupButtonController? controller = null; // Determine the screen position of the key tip dependant on item location/size @@ -233,18 +233,12 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) /// Override the group item size if possible. /// /// New size to use. - public void SetGroupItemSize(GroupItemSize size) - { - UpdateItemSizeState(size); - } + public void SetGroupItemSize(GroupItemSize size) => UpdateItemSizeState(size); /// /// Reset the group item size to the item definition. /// - public void ResetGroupItemSize() - { - UpdateItemSizeState(); - } + public void ResetGroupItemSize() => UpdateItemSizeState(); /// /// Discover the preferred size of the element. @@ -313,10 +307,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout, Rectangle.Empty); - } + protected virtual void OnNeedPaint(bool needLayout) => OnNeedPaint(needLayout, Rectangle.Empty); /// /// Raises the NeedPaint event. @@ -520,10 +511,7 @@ private void UpdateDropDownState() _viewMediumSmallText2Sep3.Visible = dropDown; } - private void UpdateItemSizeState() - { - UpdateItemSizeState(GroupColorButton.ItemSizeCurrent); - } + private void UpdateItemSizeState() => UpdateItemSizeState(GroupColorButton.ItemSizeCurrent); private void UpdateItemSizeState(GroupItemSize size) { @@ -546,30 +534,15 @@ private void UpdateItemSizeState(GroupItemSize size) } } - private void OnLargeButtonClick(object sender, EventArgs e) - { - GroupColorButton.PerformClick(_viewLarge.FinishDelegate); - } + private void OnLargeButtonClick(object sender, EventArgs e) => GroupColorButton.PerformClick(_viewLarge.FinishDelegate); - private void OnLargeButtonDropDown(object sender, EventArgs e) - { - GroupColorButton.PerformDropDown(_viewLarge.FinishDelegate); - } + private void OnLargeButtonDropDown(object sender, EventArgs e) => GroupColorButton.PerformDropDown(_viewLarge.FinishDelegate); - private void OnMediumSmallButtonClick(object sender, EventArgs e) - { - GroupColorButton.PerformClick(_viewMediumSmall.FinishDelegate); - } + private void OnMediumSmallButtonClick(object sender, EventArgs e) => GroupColorButton.PerformClick(_viewMediumSmall.FinishDelegate); - private void OnMediumSmallButtonDropDown(object sender, EventArgs e) - { - GroupColorButton.PerformDropDown(_viewMediumSmall.FinishDelegate); - } + private void OnMediumSmallButtonDropDown(object sender, EventArgs e) => GroupColorButton.PerformDropDown(_viewMediumSmall.FinishDelegate); - private void OnContextClick(object sender, MouseEventArgs e) - { - GroupColorButton.OnDesignTimeContextMenu(e); - } + private void OnContextClick(object sender, MouseEventArgs e) => GroupColorButton.OnDesignTimeContextMenu(e); private void OnButtonPropertyChanged(object sender, PropertyChangedEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupComboBox.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupComboBox.cs index a1959081c..4dd2e6f02 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupComboBox.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupComboBox.cs @@ -224,7 +224,7 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) Rectangle viewRect = _ribbon.KeyTipToScreen(this); // Determine the screen position of the key tip - Point screenPt = Point.Empty; + var screenPt = Point.Empty; // Determine the screen position of the key tip dependant on item location/size switch (_currentSize) @@ -252,18 +252,12 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) /// Override the group item size if possible. /// /// New size to use. - public void SetGroupItemSize(GroupItemSize size) - { - _currentSize = size; - } + public void SetGroupItemSize(GroupItemSize size) => _currentSize = size; /// /// Reset the group item size to the item definition. /// - public void ResetGroupItemSize() - { - _currentSize = GroupComboBox.ItemSizeCurrent; - } + public void ResetGroupItemSize() => _currentSize = GroupComboBox.ItemSizeCurrent; /// /// Discover the preferred size of the element. @@ -271,7 +265,7 @@ public void ResetGroupItemSize() /// Layout context. public override Size GetPreferredSize(ViewLayoutContext context) { - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Ensure the control has the correct parent UpdateParent(context.Control); @@ -358,10 +352,7 @@ public override void Render([DisallowNull] RenderContext context) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout, Rectangle.Empty); - } + protected virtual void OnNeedPaint(bool needLayout) => OnNeedPaint(needLayout, Rectangle.Empty); /// /// Raises the NeedPaint event. @@ -383,10 +374,7 @@ protected virtual void OnNeedPaint(bool needLayout, Rectangle invalidRect) #endregion #region Implementation - private void OnContextClick(object sender, MouseEventArgs e) - { - GroupComboBox.OnDesignTimeContextMenu(e); - } + private void OnContextClick(object sender, MouseEventArgs e) => GroupComboBox.OnDesignTimeContextMenu(e); private void OnComboBoxPropertyChanged(object sender, PropertyChangedEventArgs e) { @@ -554,8 +542,7 @@ private void UpdateVisible(Control c) else { // Check the owning group is visible - if ((GroupComboBox.RibbonContainer?.RibbonGroup != null) - && !GroupComboBox.RibbonContainer.RibbonGroup.Visible + if (GroupComboBox.RibbonContainer?.RibbonGroup is { Visible: false } && !_ribbon.InDesignMode ) { diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupCustomControl.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupCustomControl.cs index e9e909bce..1d78c135d 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupCustomControl.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupCustomControl.cs @@ -223,7 +223,7 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) Rectangle viewRect = _ribbon.KeyTipToScreen(this); // Determine the screen position of the key tip - Point screenPt = Point.Empty; + var screenPt = Point.Empty; // Determine the screen position of the key tip dependant on item location/size switch (_currentSize) @@ -251,18 +251,12 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) /// Override the group item size if possible. /// /// New size to use. - public void SetGroupItemSize(GroupItemSize size) - { - _currentSize = size; - } + public void SetGroupItemSize(GroupItemSize size) => _currentSize = size; /// /// Reset the group item size to the item definition. /// - public void ResetGroupItemSize() - { - _currentSize = GroupCustomControl.ItemSizeCurrent; - } + public void ResetGroupItemSize() => _currentSize = GroupCustomControl.ItemSizeCurrent; /// /// Discover the preferred size of the element. @@ -270,7 +264,7 @@ public void ResetGroupItemSize() /// Layout context. public override Size GetPreferredSize(ViewLayoutContext context) { - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Ensure the control has the correct parent UpdateParent(context.Control); @@ -357,10 +351,7 @@ public override void Render([DisallowNull] RenderContext context) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout, Rectangle.Empty); - } + protected virtual void OnNeedPaint(bool needLayout) => OnNeedPaint(needLayout, Rectangle.Empty); /// /// Raises the NeedPaint event. @@ -382,10 +373,7 @@ protected virtual void OnNeedPaint(bool needLayout, Rectangle invalidRect) #endregion #region Implementation - private void OnContextClick(object sender, MouseEventArgs e) - { - GroupCustomControl.OnDesignTimeContextMenu(e); - } + private void OnContextClick(object sender, MouseEventArgs e) => GroupCustomControl.OnDesignTimeContextMenu(e); private void OnCustomPropertyChanged(object sender, PropertyChangedEventArgs e) { @@ -553,7 +541,7 @@ private void UpdateVisible(Control c) else { // Check the owning group is visible - if ((GroupCustomControl.RibbonContainer?.RibbonGroup != null) && !GroupCustomControl.RibbonContainer.RibbonGroup.Visible && !_ribbon.InDesignMode) + if (GroupCustomControl.RibbonContainer?.RibbonGroup is { Visible: false } && !_ribbon.InDesignMode) { visible = false; } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupDateTimePicker.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupDateTimePicker.cs index e57319ba6..144455890 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupDateTimePicker.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupDateTimePicker.cs @@ -223,7 +223,7 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) Rectangle viewRect = _ribbon.KeyTipToScreen(this); // Determine the screen position of the key tip - Point screenPt = Point.Empty; + var screenPt = Point.Empty; // Determine the screen position of the key tip dependant on item location/size switch (_currentSize) @@ -251,18 +251,12 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) /// Override the group item size if possible. /// /// New size to use. - public void SetGroupItemSize(GroupItemSize size) - { - _currentSize = size; - } + public void SetGroupItemSize(GroupItemSize size) => _currentSize = size; /// /// Reset the group item size to the item definition. /// - public void ResetGroupItemSize() - { - _currentSize = GroupDateTimePicker.ItemSizeCurrent; - } + public void ResetGroupItemSize() => _currentSize = GroupDateTimePicker.ItemSizeCurrent; /// /// Discover the preferred size of the element. @@ -270,7 +264,7 @@ public void ResetGroupItemSize() /// Layout context. public override Size GetPreferredSize(ViewLayoutContext context) { - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Ensure the control has the correct parent UpdateParent(context.Control); @@ -357,10 +351,7 @@ public override void Render([DisallowNull] RenderContext context) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout, Rectangle.Empty); - } + protected virtual void OnNeedPaint(bool needLayout) => OnNeedPaint(needLayout, Rectangle.Empty); /// /// Raises the NeedPaint event. @@ -382,10 +373,7 @@ protected virtual void OnNeedPaint(bool needLayout, Rectangle invalidRect) #endregion #region Implementation - private void OnContextClick(object sender, MouseEventArgs e) - { - GroupDateTimePicker.OnDesignTimeContextMenu(e); - } + private void OnContextClick(object sender, MouseEventArgs e) => GroupDateTimePicker.OnDesignTimeContextMenu(e); private void OnDateTimePickerPropertyChanged(object sender, PropertyChangedEventArgs e) { @@ -552,7 +540,7 @@ private void UpdateVisible(Control c) else { // Check the owning group is visible - if ((GroupDateTimePicker.RibbonContainer?.RibbonGroup != null) && !GroupDateTimePicker.RibbonContainer.RibbonGroup.Visible && !_ribbon.InDesignMode) + if (GroupDateTimePicker.RibbonContainer?.RibbonGroup is { Visible: false } && !_ribbon.InDesignMode) { visible = false; } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupDomainUpDown.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupDomainUpDown.cs index caa4ba5aa..8901f3b1b 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupDomainUpDown.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupDomainUpDown.cs @@ -165,12 +165,9 @@ public override void LostFocus(Control c) /// Gets the last focus item from the item. /// /// ViewBase of item; otherwise false. - public ViewBase? GetLastFocusItem() - { - return GroupDomainUpDown is { Visible: true, LastDomainUpDown.DomainUpDown.CanSelect: true } - ? this + public ViewBase? GetLastFocusItem() => GroupDomainUpDown is { Visible: true, LastDomainUpDown.DomainUpDown.CanSelect: true } + ? this : null; - } #endregion #region GetNextFocusItem @@ -218,7 +215,7 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) Rectangle viewRect = _ribbon.KeyTipToScreen(this); // Determine the screen position of the key tip - Point screenPt = Point.Empty; + var screenPt = Point.Empty; // Determine the screen position of the key tip dependant on item location/size switch (_currentSize) @@ -246,18 +243,12 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) /// Override the group item size if possible. /// /// New size to use. - public void SetGroupItemSize(GroupItemSize size) - { - _currentSize = size; - } + public void SetGroupItemSize(GroupItemSize size) => _currentSize = size; /// /// Reset the group item size to the item definition. /// - public void ResetGroupItemSize() - { - _currentSize = GroupDomainUpDown.ItemSizeCurrent; - } + public void ResetGroupItemSize() => _currentSize = GroupDomainUpDown.ItemSizeCurrent; /// /// Discover the preferred size of the element. @@ -265,7 +256,7 @@ public void ResetGroupItemSize() /// Layout context. public override Size GetPreferredSize(ViewLayoutContext context) { - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Ensure the control has the correct parent UpdateParent(context.Control); @@ -352,10 +343,7 @@ public override void Render([DisallowNull] RenderContext context) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout, Rectangle.Empty); - } + protected virtual void OnNeedPaint(bool needLayout) => OnNeedPaint(needLayout, Rectangle.Empty); /// /// Raises the NeedPaint event. @@ -377,10 +365,7 @@ protected virtual void OnNeedPaint(bool needLayout, Rectangle invalidRect) #endregion #region Implementation - private void OnContextClick(object sender, MouseEventArgs e) - { - GroupDomainUpDown.OnDesignTimeContextMenu(e); - } + private void OnContextClick(object sender, MouseEventArgs e) => GroupDomainUpDown.OnDesignTimeContextMenu(e); private void OnDomainUpDownPropertyChanged(object sender, PropertyChangedEventArgs e) { @@ -547,7 +532,7 @@ private void UpdateVisible(Control c) else { // Check the owning group is visible - if ((GroupDomainUpDown.RibbonContainer?.RibbonGroup != null) && !GroupDomainUpDown.RibbonContainer.RibbonGroup.Visible && !_ribbon.InDesignMode) + if (GroupDomainUpDown.RibbonContainer?.RibbonGroup is { Visible: false } && !_ribbon.InDesignMode) { visible = false; } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupGallery.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupGallery.cs index 8757dce4b..2df0df6e5 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupGallery.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupGallery.cs @@ -25,7 +25,7 @@ internal class ViewDrawRibbonGroupGallery : ViewComposite, private readonly int NULL_CONTROL_WIDTH; // = 50; private readonly Padding _largeImagePadding; // = new(3, 2, 3, 3); private readonly KryptonRibbon _ribbon; - private ViewDrawRibbonGroup _activeGroup; + private ViewDrawRibbonGroup? _activeGroup; private readonly GalleryController? _controller; private readonly NeedPaintHandler _needPaint; private GroupItemSize _currentSize; @@ -144,21 +144,18 @@ protected override void Dispose(bool disposing) /// /// Perform action expected when a key tip is used to select the item. /// - public void KeyTipSelect() - { - GroupGallery.LastGallery?.ShownGalleryDropDown(GroupGallery.LastGallery.RectangleToScreen(GroupGallery.LastGallery.ClientRectangle), + public void KeyTipSelect() => GroupGallery.LastGallery?.ShownGalleryDropDown(GroupGallery.LastGallery.RectangleToScreen(GroupGallery.LastGallery.ClientRectangle), KryptonContextMenuPositionH.Left, KryptonContextMenuPositionV.Top, null, GroupGallery.DropButtonItemWidth); - } #endregion #region GroupGallery /// /// Gets access to the owning group gallery instance. /// - public KryptonRibbonGroupGallery GroupGallery { get; private set; } + public KryptonRibbonGroupGallery? GroupGallery { get; private set; } #endregion @@ -170,7 +167,7 @@ public void KeyTipSelect() public override void LostFocus(Control c) { // Ask ribbon to shift focus to the embedded control - _ribbon.HideFocus(GroupGallery.Gallery); + _ribbon.HideFocus(GroupGallery!.Gallery); base.LostFocus(c); } #endregion @@ -262,7 +259,7 @@ public override void LostFocus(Control c) /// List to add new entries into. public void GetGroupKeyTips(KeyTipInfoList keyTipList) { - if (GroupGallery.Visible) + if (GroupGallery!.Visible) { if (_viewLarge.Visible) { @@ -421,7 +418,7 @@ public void ResetSolutionSize() /// Layout context. public override Size GetPreferredSize(ViewLayoutContext context) { - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Ensure the control has the correct parent UpdateParent(context.Control); @@ -517,10 +514,7 @@ public override void Render([DisallowNull] RenderContext context) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout, Rectangle.Empty); - } + protected virtual void OnNeedPaint(bool needLayout) => OnNeedPaint(needLayout, Rectangle.Empty); /// /// Raises the NeedPaint event. @@ -601,19 +595,13 @@ private void CreateLargeButtonView() Add(_viewLarge); } - private void OnLargeButtonDropDown(object sender, EventArgs e) - { - GroupGallery.LastGallery?.ShownGalleryDropDown(_ribbon.ViewRectangleToScreen(_viewLarge), + private void OnLargeButtonDropDown(object sender, EventArgs e) => GroupGallery.LastGallery.ShownGalleryDropDown(_ribbon.ViewRectangleToScreen(_viewLarge), KryptonContextMenuPositionH.Left, KryptonContextMenuPositionV.Below, _viewLarge.FinishDelegate, GroupGallery.DropButtonItemWidth); - } - private void OnContextClick(object sender, MouseEventArgs e) - { - GroupGallery.OnDesignTimeContextMenu(e); - } + private void OnContextClick(object sender, MouseEventArgs e) => GroupGallery.OnDesignTimeContextMenu(e); private void OnGalleryPropertyChanged(object sender, PropertyChangedEventArgs e) { @@ -626,10 +614,12 @@ private void OnGalleryPropertyChanged(object sender, PropertyChangedEventArgs e) _viewLargeText1.MakeDirty(); updateLayout = true; break; + case "TextLine2": _viewLargeText2.MakeDirty(); updateLayout = true; break; + case "ImageLarge": case nameof(ImageList): case "LargeItemCount": @@ -639,9 +629,11 @@ private void OnGalleryPropertyChanged(object sender, PropertyChangedEventArgs e) case "ItemSizeCurrent": updateLayout = true; break; + case nameof(Enabled): UpdateEnabled(LastGallery); break; + case nameof(Visible): UpdateVisible(LastGallery); updateLayout = true; @@ -677,13 +669,13 @@ private void OnGalleryPropertyChanged(object sender, PropertyChangedEventArgs e) #pragma warning restore 162 } - private Control LastParentControl + private Control? LastParentControl { get => GroupGallery.LastParentControl; set => GroupGallery.LastParentControl = value; } - private KryptonGallery LastGallery + private KryptonGallery? LastGallery { get => GroupGallery.LastGallery; set => GroupGallery.LastGallery = value; @@ -700,7 +692,7 @@ private void UpdateParent(Control parentControl) if ((GroupGallery.RibbonGroup.ShowingAsPopup && (parentControl is VisualPopupGroup)) || (!GroupGallery.RibbonGroup.ShowingAsPopup && parentControl is not VisualPopupGroup)) { - // If we have added the custrom control to a parent before + // If we have added the custom control to a parent before if ((LastGallery != null) && (LastParentControl != null)) { // If that control is still a child of the old parent @@ -744,7 +736,7 @@ private void UpdateParent(Control parentControl) } } - private void UpdateEnabled(Control c) + private void UpdateEnabled(Control? c) { if (c != null) { @@ -762,7 +754,7 @@ private void UpdateEnabled(Control c) } } - private bool ActualVisible(Control c) + private bool ActualVisible(Control? c) { if (c != null) { @@ -782,7 +774,7 @@ private bool ActualVisible(Control c) return false; } - private void UpdateVisible(Control c) + private void UpdateVisible(Control? c) { if (c != null) { @@ -845,7 +837,7 @@ private void OnMouseEnterControl(object sender, EventArgs e) _activeGroup = null; // Find the parent group instance - ViewBase parent = Parent; + ViewBase? parent = Parent; // Keep going till we get to the top or find a group while (parent != null) diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupImage.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupImage.cs index 9cf101683..92c7ab2d0 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupImage.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupImage.cs @@ -122,11 +122,9 @@ public override Size GetPreferredSize(ViewLayoutContext context) /// Perform a layout of the elements. /// /// Layout context. - public override void Layout(ViewLayoutContext context) - { + public override void Layout(ViewLayoutContext context) => // Take on all the provided area ClientRectangle = context.DisplayRectangle; - } #endregion #region Paint diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupImageBase.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupImageBase.cs index 18b69f8de..85ec39019 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupImageBase.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupImageBase.cs @@ -52,11 +52,9 @@ public override string ToString() => /// Perform a layout of the elements. /// /// Layout context. - public override void Layout(ViewLayoutContext context) - { + public override void Layout(ViewLayoutContext context) => // Take on all the provided area ClientRectangle = context.DisplayRectangle; - } #endregion #region Paint diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupLabel.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupLabel.cs index 429634b89..5878cbed9 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupLabel.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupLabel.cs @@ -187,18 +187,12 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) /// Override the group item size if possible. /// /// New size to use. - public void SetGroupItemSize(GroupItemSize size) - { - UpdateItemSizeState(size); - } + public void SetGroupItemSize(GroupItemSize size) => UpdateItemSizeState(size); /// /// Reset the group item size to the item definition. /// - public void ResetGroupItemSize() - { - UpdateItemSizeState(); - } + public void ResetGroupItemSize() => UpdateItemSizeState(); /// /// Discover the preferred size of the element. @@ -241,10 +235,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout, Rectangle.Empty); - } + protected virtual void OnNeedPaint(bool needLayout) => OnNeedPaint(needLayout, Rectangle.Empty); /// /// Raises the NeedPaint event. @@ -380,15 +371,9 @@ private void UpdateEnabledState() _viewMediumSmallText2.Enabled = enabled; } - private void UpdateImageSmallState() - { - _viewMediumSmallImage.Visible = GroupLabel.ImageSmall != null; - } + private void UpdateImageSmallState() => _viewMediumSmallImage.Visible = GroupLabel.ImageSmall != null; - private void UpdateItemSizeState() - { - UpdateItemSizeState(GroupLabel.ItemSizeCurrent); - } + private void UpdateItemSizeState() => UpdateItemSizeState(GroupLabel.ItemSizeCurrent); private void UpdateItemSizeState(GroupItemSize size) { @@ -410,10 +395,7 @@ private void UpdateItemSizeState(GroupItemSize size) } } - private void OnContextClick(object sender, MouseEventArgs e) - { - GroupLabel.OnDesignTimeContextMenu(e); - } + private void OnContextClick(object sender, MouseEventArgs e) => GroupLabel.OnDesignTimeContextMenu(e); private void OnLabelPropertyChanged(object sender, PropertyChangedEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupMaskedTextBox.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupMaskedTextBox.cs index 510f2246a..16d264877 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupMaskedTextBox.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupMaskedTextBox.cs @@ -223,7 +223,7 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) Rectangle viewRect = _ribbon.KeyTipToScreen(this); // Determine the screen position of the key tip - Point screenPt = Point.Empty; + var screenPt = Point.Empty; // Determine the screen position of the key tip dependant on item location/size switch (_currentSize) @@ -251,18 +251,12 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) /// Override the group item size if possible. /// /// New size to use. - public void SetGroupItemSize(GroupItemSize size) - { - _currentSize = size; - } + public void SetGroupItemSize(GroupItemSize size) => _currentSize = size; /// /// Reset the group item size to the item definition. /// - public void ResetGroupItemSize() - { - _currentSize = GroupMaskedTextBox.ItemSizeCurrent; - } + public void ResetGroupItemSize() => _currentSize = GroupMaskedTextBox.ItemSizeCurrent; /// /// Discover the preferred size of the element. @@ -270,7 +264,7 @@ public void ResetGroupItemSize() /// Layout context. public override Size GetPreferredSize(ViewLayoutContext context) { - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Ensure the control has the correct parent UpdateParent(context.Control); @@ -357,10 +351,7 @@ public override void Render([DisallowNull] RenderContext context) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout, Rectangle.Empty); - } + protected virtual void OnNeedPaint(bool needLayout) => OnNeedPaint(needLayout, Rectangle.Empty); /// /// Raises the NeedPaint event. @@ -382,10 +373,7 @@ protected virtual void OnNeedPaint(bool needLayout, Rectangle invalidRect) #endregion #region Implementation - private void OnContextClick(object sender, MouseEventArgs e) - { - GroupMaskedTextBox.OnDesignTimeContextMenu(e); - } + private void OnContextClick(object sender, MouseEventArgs e) => GroupMaskedTextBox.OnDesignTimeContextMenu(e); private void OnMaskedTextBoxPropertyChanged(object sender, PropertyChangedEventArgs e) { @@ -553,7 +541,7 @@ private void UpdateVisible(Control c) else { // Check the owning group is visible - if ((GroupMaskedTextBox.RibbonContainer?.RibbonGroup != null) && !GroupMaskedTextBox.RibbonContainer.RibbonGroup.Visible && !_ribbon.InDesignMode) + if (GroupMaskedTextBox.RibbonContainer?.RibbonGroup is { Visible: false } && !_ribbon.InDesignMode) { visible = false; } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupNumericUpDown.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupNumericUpDown.cs index 45d58efcc..00dc85085 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupNumericUpDown.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupNumericUpDown.cs @@ -223,7 +223,7 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) Rectangle viewRect = _ribbon.KeyTipToScreen(this); // Determine the screen position of the key tip - Point screenPt = Point.Empty; + var screenPt = Point.Empty; // Determine the screen position of the key tip dependant on item location/size switch (_currentSize) @@ -251,18 +251,12 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) /// Override the group item size if possible. /// /// New size to use. - public void SetGroupItemSize(GroupItemSize size) - { - _currentSize = size; - } + public void SetGroupItemSize(GroupItemSize size) => _currentSize = size; /// /// Reset the group item size to the item definition. /// - public void ResetGroupItemSize() - { - _currentSize = GroupNumericUpDown.ItemSizeCurrent; - } + public void ResetGroupItemSize() => _currentSize = GroupNumericUpDown.ItemSizeCurrent; /// /// Discover the preferred size of the element. @@ -270,7 +264,7 @@ public void ResetGroupItemSize() /// Layout context. public override Size GetPreferredSize(ViewLayoutContext context) { - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Ensure the control has the correct parent UpdateParent(context.Control); @@ -357,10 +351,7 @@ public override void Render([DisallowNull] RenderContext context) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout, Rectangle.Empty); - } + protected virtual void OnNeedPaint(bool needLayout) => OnNeedPaint(needLayout, Rectangle.Empty); /// /// Raises the NeedPaint event. @@ -382,10 +373,7 @@ protected virtual void OnNeedPaint(bool needLayout, Rectangle invalidRect) #endregion #region Implementation - private void OnContextClick(object sender, MouseEventArgs e) - { - GroupNumericUpDown.OnDesignTimeContextMenu(e); - } + private void OnContextClick(object sender, MouseEventArgs e) => GroupNumericUpDown.OnDesignTimeContextMenu(e); private void OnNumericUpDownPropertyChanged(object sender, PropertyChangedEventArgs e) { @@ -552,8 +540,7 @@ private void UpdateVisible(Control c) else { // Check the owning group is visible - if ((GroupNumericUpDown.RibbonContainer?.RibbonGroup != null) - && !GroupNumericUpDown.RibbonContainer.RibbonGroup.Visible + if (GroupNumericUpDown.RibbonContainer?.RibbonGroup is { Visible: false } && !_ribbon.InDesignMode ) { diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupRadioButton.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupRadioButton.cs index 50473e12f..a32c5f130 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupRadioButton.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupRadioButton.cs @@ -38,7 +38,7 @@ internal class ViewDrawRibbonGroupRadioButton : ViewComposite, private ViewDrawRibbonGroupRadioButtonText _viewMediumSmallText2; private GroupRadioButtonController? _viewMediumSmallController; private readonly EventHandler? _finishDelegateMediumSmall; - private readonly NeedPaintHandler _needPaint; + private readonly NeedPaintHandler? _needPaint; private GroupItemSize _currentSize; #endregion @@ -58,9 +58,9 @@ public ViewDrawRibbonGroupRadioButton([DisallowNull] KryptonRibbon ribbon, Debug.Assert(needPaint != null); // Remember incoming references - _ribbon = ribbon; - GroupRadioButton = ribbonRadioButton; - _needPaint = needPaint; + _ribbon = ribbon!; + GroupRadioButton = ribbonRadioButton!; + _needPaint = needPaint!; _currentSize = GroupRadioButton.ItemSizeCurrent; // Create delegate used to process end of click action @@ -101,14 +101,14 @@ protected override void Dispose(bool disposing) { if (disposing) { - if (GroupRadioButton != null) + if (GroupRadioButton != null!) { // Must unhook to prevent memory leaks GroupRadioButton.PropertyChanged -= OnRadioButtonPropertyChanged; // Remove association with definition - GroupRadioButton.RadioButtonView = null; - GroupRadioButton = null; + GroupRadioButton.RadioButtonView = null!; + GroupRadioButton = null!; } } @@ -206,7 +206,7 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) // Get the screen location of the radio button Rectangle viewRect = _ribbon.KeyTipToScreen(this[0]); - Point screenPt = Point.Empty; + var screenPt = Point.Empty; GroupRadioButtonController? controller = null; // Determine the screen position of the key tip dependant on item location/size @@ -234,18 +234,12 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) /// Override the group item size if possible. /// /// New size to use. - public void SetGroupItemSize(GroupItemSize size) - { - UpdateItemSizeState(size); - } + public void SetGroupItemSize(GroupItemSize size) => UpdateItemSizeState(size); /// /// Reset the group item size to the item definition. /// - public void ResetGroupItemSize() - { - UpdateItemSizeState(); - } + public void ResetGroupItemSize() => UpdateItemSizeState(); /// /// Discover the preferred size of the element. @@ -289,10 +283,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout, Rectangle.Empty); - } + protected virtual void OnNeedPaint(bool needLayout) => OnNeedPaint(needLayout, Rectangle.Empty); /// /// Raises the NeedPaint event. @@ -424,10 +415,7 @@ private void UpdateCheckedState() _viewMediumSmallImage.Checked = GroupRadioButton.Checked; } - private void UpdateItemSizeState() - { - UpdateItemSizeState(GroupRadioButton.ItemSizeCurrent); - } + private void UpdateItemSizeState() => UpdateItemSizeState(GroupRadioButton.ItemSizeCurrent); private void UpdateItemSizeState(GroupItemSize size) { @@ -445,37 +433,28 @@ private void UpdateItemSizeState(GroupItemSize size) } } - private void OnLargeRadioButtonClick(object sender, EventArgs e) - { - GroupRadioButton.PerformClick(_finishDelegateLarge); - } + private void OnLargeRadioButtonClick(object sender, EventArgs e) => GroupRadioButton.PerformClick(_finishDelegateLarge); - private void OnMediumSmallRadioButtonClick(object sender, EventArgs e) - { - GroupRadioButton.PerformClick(_finishDelegateMediumSmall); - } + private void OnMediumSmallRadioButtonClick(object sender, EventArgs e) => GroupRadioButton.PerformClick(_finishDelegateMediumSmall); - private void OnContextClick(object sender, MouseEventArgs e) - { - GroupRadioButton.OnDesignTimeContextMenu(e); - } + private void OnContextClick(object sender, MouseEventArgs e) => GroupRadioButton.OnDesignTimeContextMenu(e); private void ActionFinishedLarge(object sender, EventArgs e) { - // Remove any popups that result from an action occuring - _ribbon?.ActionOccurred(); + // Remove any popups that result from an action occurring + _ribbon.ActionOccurred(); // Remove the fixed pressed appearance - _viewLargeController.RemoveFixed(); + _viewLargeController?.RemoveFixed(); } private void ActionFinishedMediumSmall(object sender, EventArgs e) { - // Remove any popups that result from an action occuring - _ribbon?.ActionOccurred(); + // Remove any popups that result from an action occurring + _ribbon.ActionOccurred(); // Remove the fixed pressed appearance - _viewMediumSmallController.RemoveFixed(); + _viewMediumSmallController?.RemoveFixed(); } private void OnRadioButtonPropertyChanged(object sender, PropertyChangedEventArgs e) diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupRichTextBox.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupRichTextBox.cs index 2744932f6..5c550febb 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupRichTextBox.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupRichTextBox.cs @@ -223,7 +223,7 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) Rectangle viewRect = LastRichTextBox.Parent.RectangleToScreen(ClientRectangle); // Determine the screen position of the key tip - Point screenPt = Point.Empty; + var screenPt = Point.Empty; // Determine the screen position of the key tip dependant on item location/size switch (_currentSize) @@ -251,18 +251,12 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) /// Override the group item size if possible. /// /// New size to use. - public void SetGroupItemSize(GroupItemSize size) - { - _currentSize = size; - } + public void SetGroupItemSize(GroupItemSize size) => _currentSize = size; /// /// Reset the group item size to the item definition. /// - public void ResetGroupItemSize() - { - _currentSize = GroupRichTextBox.ItemSizeCurrent; - } + public void ResetGroupItemSize() => _currentSize = GroupRichTextBox.ItemSizeCurrent; /// /// Discover the preferred size of the element. @@ -270,7 +264,7 @@ public void ResetGroupItemSize() /// Layout context. public override Size GetPreferredSize(ViewLayoutContext context) { - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Ensure the control has the correct parent UpdateParent(context.Control); @@ -357,10 +351,7 @@ public override void Render([DisallowNull] RenderContext context) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout, Rectangle.Empty); - } + protected virtual void OnNeedPaint(bool needLayout) => OnNeedPaint(needLayout, Rectangle.Empty); /// /// Raises the NeedPaint event. @@ -382,10 +373,7 @@ protected virtual void OnNeedPaint(bool needLayout, Rectangle invalidRect) #endregion #region Implementation - private void OnContextClick(object sender, MouseEventArgs e) - { - GroupRichTextBox.OnDesignTimeContextMenu(e); - } + private void OnContextClick(object sender, MouseEventArgs e) => GroupRichTextBox.OnDesignTimeContextMenu(e); private void OnRichTextBoxPropertyChanged(object sender, PropertyChangedEventArgs e) { @@ -553,8 +541,7 @@ private void UpdateVisible(Control c) else { // Check the owning group is visible - if ((GroupRichTextBox.RibbonContainer?.RibbonGroup != null) - && !GroupRichTextBox.RibbonContainer.RibbonGroup.Visible + if (GroupRichTextBox.RibbonContainer?.RibbonGroup is { Visible: false } && !_ribbon.InDesignMode ) { diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupSeparator.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupSeparator.cs index cdacd5f11..8bfa9b589 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupSeparator.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupSeparator.cs @@ -193,11 +193,9 @@ public ItemSizeWidth[] GetPossibleSizes(ViewLayoutContext context) /// Update the group with the provided sizing solution. /// /// Value for the container. - public void SetSolutionSize(ItemSizeWidth size) - { + public void SetSolutionSize(ItemSizeWidth size) => // Solution should always be the large, the only size we can be Debug.Assert(size.GroupItemSize == GroupItemSize.Large); - } /// /// Reset the container back to its requested size. @@ -230,14 +228,11 @@ public override void Layout([DisallowNull] ViewLayoutContext context) /// Perform rendering before child elements are rendered. /// /// Rendering context. - public override void RenderBefore(RenderContext context) - { - context.Renderer.RenderGlyph.DrawRibbonGroupSeparator(_ribbon.RibbonShape, - context, - ClientRectangle, - _ribbon.StateCommon.RibbonGeneral, + public override void RenderBefore(RenderContext context) => context.Renderer.RenderGlyph.DrawRibbonGroupSeparator(_ribbon.RibbonShape, + context, + ClientRectangle, + _ribbon.StateCommon.RibbonGeneral, State); - } #endregion #region Protected @@ -260,10 +255,7 @@ protected virtual void OnNeedPaint(bool needLayout) #endregion #region Implementation - private void OnContextClick(object sender, MouseEventArgs e) - { - _ribbonSeparator.OnDesignTimeContextMenu(e); - } + private void OnContextClick(object sender, MouseEventArgs e) => _ribbonSeparator.OnDesignTimeContextMenu(e); private void OnSeparatorPropertyChanged(object sender, PropertyChangedEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupTextBox.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupTextBox.cs index 6e98b3fbe..9e7f1ae85 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupTextBox.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupTextBox.cs @@ -223,7 +223,7 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) Rectangle viewRect = _ribbon.KeyTipToScreen(this); // Determine the screen position of the key tip - Point screenPt = Point.Empty; + var screenPt = Point.Empty; // Determine the screen position of the key tip dependant on item location/size switch (_currentSize) @@ -251,18 +251,12 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) /// Override the group item size if possible. /// /// New size to use. - public void SetGroupItemSize(GroupItemSize size) - { - _currentSize = size; - } + public void SetGroupItemSize(GroupItemSize size) => _currentSize = size; /// /// Reset the group item size to the item definition. /// - public void ResetGroupItemSize() - { - _currentSize = GroupTextBox.ItemSizeCurrent; - } + public void ResetGroupItemSize() => _currentSize = GroupTextBox.ItemSizeCurrent; /// /// Discover the preferred size of the element. @@ -270,7 +264,7 @@ public void ResetGroupItemSize() /// Layout context. public override Size GetPreferredSize(ViewLayoutContext context) { - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Ensure the control has the correct parent UpdateParent(context.Control); @@ -357,10 +351,7 @@ public override void Render([DisallowNull] RenderContext context) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout, Rectangle.Empty); - } + protected virtual void OnNeedPaint(bool needLayout) => OnNeedPaint(needLayout, Rectangle.Empty); /// /// Raises the NeedPaint event. @@ -382,10 +373,7 @@ protected virtual void OnNeedPaint(bool needLayout, Rectangle invalidRect) #endregion #region Implementation - private void OnContextClick(object sender, MouseEventArgs e) - { - GroupTextBox.OnDesignTimeContextMenu(e); - } + private void OnContextClick(object sender, MouseEventArgs e) => GroupTextBox.OnDesignTimeContextMenu(e); private void OnTextBoxPropertyChanged(object sender, PropertyChangedEventArgs e) { @@ -552,8 +540,7 @@ private void UpdateVisible(Control c) else { // Check the owning group is visible - if ((GroupTextBox.RibbonContainer?.RibbonGroup != null) - && !GroupTextBox.RibbonContainer.RibbonGroup.Visible + if (GroupTextBox.RibbonContainer?.RibbonGroup is { Visible: false } && !_ribbon.InDesignMode ) { diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupTitle.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupTitle.cs index 4f2a08a03..df16f84ad 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupTitle.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupTitle.cs @@ -81,10 +81,7 @@ protected override void Dispose(bool disposing) /// /// Make dirty so cached values are not used. /// - public void MakeDirty() - { - _dirtyPaletteLayout = 0; - } + public void MakeDirty() => _dirtyPaletteLayout = 0; #endregion #region PaletteRibbonGroup diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupTrackBar.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupTrackBar.cs index 7f43e430e..13aa5a4a2 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupTrackBar.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupTrackBar.cs @@ -223,7 +223,7 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) Rectangle viewRect = _ribbon.KeyTipToScreen(this); // Determine the screen position of the key tip - Point screenPt = Point.Empty; + var screenPt = Point.Empty; // Determine the screen position of the key tip dependant on item location/size switch (_currentSize) @@ -251,18 +251,12 @@ public void GetGroupKeyTips(KeyTipInfoList keyTipList, int lineHint) /// Override the group item size if possible. /// /// New size to use. - public void SetGroupItemSize(GroupItemSize size) - { - _currentSize = size; - } + public void SetGroupItemSize(GroupItemSize size) => _currentSize = size; /// /// Reset the group item size to the item definition. /// - public void ResetGroupItemSize() - { - _currentSize = GroupTrackBar.ItemSizeCurrent; - } + public void ResetGroupItemSize() => _currentSize = GroupTrackBar.ItemSizeCurrent; /// /// Discover the preferred size of the element. @@ -270,7 +264,7 @@ public void ResetGroupItemSize() /// Layout context. public override Size GetPreferredSize(ViewLayoutContext context) { - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Ensure the control has the correct parent UpdateParent(context.Control); @@ -357,10 +351,7 @@ public override void Render([DisallowNull] RenderContext context) /// Raises the NeedPaint event. /// /// Does the palette change require a layout. - protected virtual void OnNeedPaint(bool needLayout) - { - OnNeedPaint(needLayout, Rectangle.Empty); - } + protected virtual void OnNeedPaint(bool needLayout) => OnNeedPaint(needLayout, Rectangle.Empty); /// /// Raises the NeedPaint event. @@ -382,10 +373,7 @@ protected virtual void OnNeedPaint(bool needLayout, Rectangle invalidRect) #endregion #region Implementation - private void OnContextClick(object sender, MouseEventArgs e) - { - GroupTrackBar.OnDesignTimeContextMenu(e); - } + private void OnContextClick(object sender, MouseEventArgs e) => GroupTrackBar.OnDesignTimeContextMenu(e); private void OnTextBoxPropertyChanged(object sender, PropertyChangedEventArgs e) { @@ -552,8 +540,7 @@ private void UpdateVisible(Control c) else { // Check the owning group is visible - if ((GroupTrackBar.RibbonContainer?.RibbonGroup != null) - && !GroupTrackBar.RibbonContainer.RibbonGroup.Visible + if (GroupTrackBar.RibbonContainer?.RibbonGroup is { Visible: false } && !_ribbon.InDesignMode ) { diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupsBorderSynch.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupsBorderSynch.cs index 77c561da0..ae06ade5f 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupsBorderSynch.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonGroupsBorderSynch.cs @@ -70,10 +70,10 @@ public override string ToString() => ViewLayoutRibbonScrollPort viewScrollPort = _tabToView[Ribbon.SelectedTab]; // The first child of the scroll port is always the view control - ViewLayoutControl? viewControl = viewScrollPort[0] as ViewLayoutControl; + var viewControl = viewScrollPort[0] as ViewLayoutControl; // The first child of the view control is always the ribbon groups - ViewLayoutRibbonGroups? viewGroups = viewControl?.ChildView as ViewLayoutRibbonGroups; + var viewGroups = viewControl?.ChildView as ViewLayoutRibbonGroups; // Ask the view groups to find a matching group return viewGroups?.ViewGroupFromPoint(pt); diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonQATBorder.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonQATBorder.cs index 08f328a8e..61c4424fe 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonQATBorder.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonQATBorder.cs @@ -194,7 +194,7 @@ public override void RenderBefore(RenderContext context) } IPaletteRibbonBack palette; - PaletteState state = PaletteState.Normal; + var state = PaletteState.Normal; Rectangle drawRect = ClientRectangle; // Get the correct drawing palette diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonQATButton.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonQATButton.cs index fcfdac01e..eed834d78 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonQATButton.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonQATButton.cs @@ -204,17 +204,12 @@ public override void RenderBefore(RenderContext context) #endregion #region Implementation - private void OnRibbonEnableChanged(object sender, EventArgs e) - { - UpdateEnabled(); - } + private void OnRibbonEnableChanged(object sender, EventArgs e) => UpdateEnabled(); - private void UpdateEnabled() - { + private void UpdateEnabled() => // Content is only enabled if the QAT button is enabled // and the owning ribbon control is also enabled _drawContent.Enabled = base.Enabled && _ribbon.Enabled; - } private void OnClick(object sender, MouseEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonQATExtraButton.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonQATExtraButton.cs index eb61cad92..25ea77dbb 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonQATExtraButton.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonQATExtraButton.cs @@ -49,14 +49,14 @@ public ViewDrawRibbonQATExtraButton([DisallowNull] KryptonRibbon ribbon, Debug.Assert(ribbon != null); // Remember incoming references - _ribbon = ribbon; + _ribbon = ribbon!; // Create delegate used to process end of click action - _finishDelegate = ClickFinished!; + _finishDelegate = ClickFinished; // Attach a controller to this element for the pressing of the button var controller = new QATExtraButtonController(ribbon, this, needPaint); - controller.Click += OnClick!; + controller.Click += OnClick; MouseController = controller; SourceController = controller; KeyController = controller; @@ -133,7 +133,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) Debug.Assert(context != null); // We take on all the available display area - ClientRectangle = context.DisplayRectangle; + ClientRectangle = context!.DisplayRectangle; } #endregion @@ -194,26 +194,28 @@ public override void RenderBefore(RenderContext context) private void ClickFinished(object sender, EventArgs e) { // Get access to our mouse controller - LeftDownButtonController controller = (LeftDownButtonController)MouseController; + var controller = (LeftDownButtonController)MouseController; // Remove the fixed pressed appearance - controller.RemoveFixed(); + controller?.RemoveFixed(); } private void OnClick(object sender, MouseEventArgs e) { - Form ownerForm = _ribbon.FindForm(); + Form? ownerForm = _ribbon.FindForm(); // Ensure the form we are inside is active ownerForm?.Activate(); - - if ((ClickAndFinish != null) && !_ribbon.InDesignMode) - { - ClickAndFinish(this, _finishDelegate); - } - else + if ((ClickAndFinish != null)) { - ClickFinished(this, EventArgs.Empty); + if (!_ribbon.InDesignMode) + { + ClickAndFinish(this, _finishDelegate); + } + else + { + ClickFinished(this, EventArgs.Empty); + } } } #endregion diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonQATOverflow.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonQATOverflow.cs index 2305d9df1..27abfa427 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonQATOverflow.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonQATOverflow.cs @@ -118,9 +118,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) /// Perform rendering before child elements are rendered. /// /// Rendering context. - public override void RenderBefore(RenderContext context) - { - _memento = context.Renderer.RenderRibbon.DrawRibbonBack(_ribbon.RibbonShape, + public override void RenderBefore(RenderContext context) => _memento = context.Renderer.RenderRibbon.DrawRibbonBack(_ribbon.RibbonShape, context, ClientRectangle, PaletteState.Normal, @@ -128,7 +126,6 @@ public override void RenderBefore(RenderContext context) VisualOrientation.Top, false, _memento); - } #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonTab.cs b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonTab.cs index ac2a537f3..b0820c077 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonTab.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Draw/ViewDrawRibbonTab.cs @@ -712,10 +712,7 @@ private void CheckPaletteState(ViewContext context) } } - private void OnTabPropertyChanged(object sender, PropertyChangedEventArgs e) - { - MakeDirty(); - } + private void OnTabPropertyChanged(object sender, PropertyChangedEventArgs e) => MakeDirty(); private void OnTabClicked(object sender, MouseEventArgs e) { diff --git a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonContextTitles.cs b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonContextTitles.cs index 1ed6c4191..460cba295 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonContextTitles.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonContextTitles.cs @@ -210,7 +210,7 @@ private void SyncChildrenToContexts() for (var i = 0; i < ViewLayoutRibbonTabs.ContextTabSets.Count; i++) { ViewDrawRibbonContextTitle viewContext = _contextTitlesCache[i]; - ContextTitleController viewController = (ContextTitleController)viewContext.MouseController; + var viewController = (ContextTitleController)viewContext.MouseController; viewContext.ContextTabSet = ViewLayoutRibbonTabs.ContextTabSets[i]; viewController.ContextTabSet = viewContext.ContextTabSet; Add(viewContext); diff --git a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGalleryButtons.cs b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGalleryButtons.cs index 0817fd7c6..ea028a52d 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGalleryButtons.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGalleryButtons.cs @@ -44,7 +44,7 @@ public override string ToString() => /// Layout context. public override Size GetPreferredSize(ViewLayoutContext context) { - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Height is the total height of all children, but width is just the widest found foreach (ViewBase child in this) diff --git a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGalleryItems.cs b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGalleryItems.cs index 68c5f7b75..79862cb3a 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGalleryItems.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGalleryItems.cs @@ -365,7 +365,7 @@ public override Size GetPreferredSize([DisallowNull] ViewLayoutContext context) // Ensure that the correct number of children are created SyncChildren(); - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Find size of the first item, if there is one if (Count > 0) @@ -568,7 +568,7 @@ public void SyncChildren() // Tell each item the image it should be displaying for (var i = 0; i < required; i++) { - ViewDrawRibbonGalleryItem item = (ViewDrawRibbonGalleryItem)this[i]; + var item = (ViewDrawRibbonGalleryItem)this[i]; item.ImageList = imageList; item.ImageIndex = i; item.Checked = selectedIndex == i; diff --git a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGroupCluster.cs b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGroupCluster.cs index 1f714a553..93e15bdba 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGroupCluster.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGroupCluster.cs @@ -317,7 +317,7 @@ public void SetGroupItemSize(GroupItemSize size) foreach (KryptonRibbonGroupItem item in _ribbonCluster.Items) { - IRibbonViewGroupItemView? viewItemSize = _itemToView[item] as IRibbonViewGroupItemView; + var viewItemSize = _itemToView[item] as IRibbonViewGroupItemView; viewItemSize?.SetGroupItemSize(size); } @@ -331,12 +331,12 @@ public void ResetGroupItemSize() { foreach (KryptonRibbonGroupItem item in _ribbonCluster.Items) { - IRibbonViewGroupItemView? viewItemSize = _itemToView[item] as IRibbonViewGroupItemView; + var viewItemSize = _itemToView[item] as IRibbonViewGroupItemView; viewItemSize?.ResetGroupItemSize(); } // Our current size is based on the parent one - ViewLayoutRibbonGroupLines? viewLines = (ViewLayoutRibbonGroupLines)Parent; + var viewLines = (ViewLayoutRibbonGroupLines)Parent; _currentSize = viewLines.CurrentSize == GroupItemSize.Small ? GroupItemSize.Small : GroupItemSize.Medium; } @@ -355,7 +355,7 @@ public override Size GetPreferredSize(ViewLayoutContext context) viewToSize.Clear(); - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Find total width and maximum height across all child elements for (var i = 0; i < Count; i++) diff --git a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGroupContent.cs b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGroupContent.cs index 6cf04dfff..57b2aee20 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGroupContent.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGroupContent.cs @@ -575,7 +575,7 @@ public override Size GetPreferredSize(ViewLayoutContext context) // Sync child elements to the current group items SyncChildrenToRibbonGroupItems(); - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Find total width and maximum height across all child elements for (int i = 0, j = 0; i < Count; i++) diff --git a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGroupLines.cs b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGroupLines.cs index 9720a5d2b..f6aaf8bf5 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGroupLines.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGroupLines.cs @@ -672,7 +672,7 @@ protected virtual void OnNeedPaint(bool needLayout) private void ApplySize(GroupItemSize size) { CurrentSize = size; - GroupItemSize itemSize = GroupItemSize.Medium; + var itemSize = GroupItemSize.Medium; switch (size) { @@ -785,7 +785,7 @@ private void SyncChildrenToRibbonGroupItems() private Size LargeMediumPreferredSize(int totalWidth, ref int split1) { - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Default to not splitting anywhere split1 = int.MaxValue; @@ -853,7 +853,7 @@ private Size LargeMediumPreferredSize(int totalWidth, ref int split1) private Size SmallPreferredSize(int totalWidth) { - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Default to not splitting anywhere _split1Small = int.MaxValue; diff --git a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGroupTriple.cs b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGroupTriple.cs index 43903e9be..13622474d 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGroupTriple.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGroupTriple.cs @@ -352,12 +352,10 @@ public ItemSizeWidth[] GetPossibleSizes(ViewLayoutContext context) /// Update the group with the provided sizing solution. /// /// Value for the container. - public void SetSolutionSize(ItemSizeWidth size) - { + public void SetSolutionSize(ItemSizeWidth size) => // Update the container definition, which itself will then // update all the child items inside the container for us _ribbonTriple.ItemSizeCurrent = size.GroupItemSize; - } /// /// Reset the container back to its requested size. @@ -394,7 +392,7 @@ public override Size GetPreferredSize(ViewLayoutContext context) // Sync child elements to the current group items SyncChildrenToRibbonGroupItems(); - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Are we sizing horizontal or vertical? var horizontal = _currentSize == GroupItemSize.Large; @@ -497,7 +495,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) if (child.Visible) { // Get the cached size of this view - Size childSize = Size.Empty; + var childSize = Size.Empty; switch (_currentSize) { case GroupItemSize.Small: diff --git a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGroups.cs b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGroups.cs index 1ce4d8503..f1bf4aa57 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGroups.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonGroups.cs @@ -123,7 +123,7 @@ public NeedPaintHandler NeedPaintDelegate public ViewDrawRibbonGroup? ViewGroupFromPoint(Point pt) { // Parent element should be a view layout - ViewLayoutControl layoutControl = (ViewLayoutControl)Parent; + var layoutControl = (ViewLayoutControl)Parent; // Get the location of the child control it contains Point layoutLocation = layoutControl.ChildControl.Location; @@ -362,7 +362,7 @@ private Size SeparatorSize { get { - Size retSize = Size.Empty; + var retSize = Size.Empty; if (_ribbon != null) { @@ -448,7 +448,7 @@ private void SyncChildrenToRibbonGroups() } // When in design time help mode - if (_ribbon != null && _ribbon.InDesignHelperMode) + if (_ribbon is { InDesignHelperMode: true }) { // Create the design time 'Add Group' first time it is needed _viewAddGroup ??= new ViewDrawRibbonDesignGroup(_ribbon, _needPaint); diff --git a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonQATContents.cs b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonQATContents.cs index 47eeee58a..b66bd82fd 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonQATContents.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonQATContents.cs @@ -133,7 +133,7 @@ public KeyTipInfo[] GetQATKeyTips(KryptonForm? ownerForm) } // If integrated into the caption area then get the caption area height - Padding borders = Padding.Empty; + var borders = Padding.Empty; if (ownerForm is { ApplyComposition: false }) { borders = ownerForm.RealWindowBorders; @@ -198,7 +198,7 @@ public override Size GetPreferredSize(ViewLayoutContext context) // Sync to represent the current ribbon QAT buttons SyncChildren(false); - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Find total width and maximum height across all child elements for (var i = 0; i < Count; i++) @@ -209,7 +209,7 @@ public override Size GetPreferredSize(ViewLayoutContext context) if (child != _extraButton) { // Cast child to correct type - ViewDrawRibbonQATButton view = (ViewDrawRibbonQATButton)child; + var view = (ViewDrawRibbonQATButton)child; // If the quick access toolbar button wants to be visible if (view.QATButton.GetVisible() || Ribbon.InDesignHelperMode) @@ -320,7 +320,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) else { // Cast child to correct type - ViewDrawRibbonQATButton view = (ViewDrawRibbonQATButton)child; + var view = (ViewDrawRibbonQATButton)child; // If the quick access toolbar button wants to be visible if (view.QATButton.GetVisible() || Ribbon.InDesignHelperMode) @@ -578,7 +578,7 @@ private void SyncChildren(bool layout) private void OnExtraButtonClick(object sender, EventHandler? finishDelegate) { - ViewDrawRibbonQATExtraButton button = (ViewDrawRibbonQATExtraButton)sender; + var button = (ViewDrawRibbonQATExtraButton)sender; // Convert the button rectangle to screen coordinates Rectangle screenRect = ParentControl.RectangleToScreen(button.ClientRectangle); diff --git a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonQATMini.cs b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonQATMini.cs index 4db9a01ba..62e725b6d 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonQATMini.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonQATMini.cs @@ -137,7 +137,7 @@ public KeyTipInfo[] GetQATKeyTips() if (_extraButton is {Overflow : true }) { // If integrated into the caption area then get the caption area height - Padding borders = Padding.Empty; + var borders = Padding.Empty; if (OwnerForm is { ApplyComposition: false }) { borders = OwnerForm.RealWindowBorders; @@ -281,7 +281,7 @@ public override void Layout(ViewLayoutContext context) private void OnExtraButtonClick(object sender, EventHandler? finishDelegate) { - ViewDrawRibbonQATExtraButton button = (ViewDrawRibbonQATExtraButton)sender; + var button = (ViewDrawRibbonQATExtraButton)sender; // Convert the button rectangle to screen coordinates Rectangle screenRect = _ribbon.RectangleToScreen(button.ClientRectangle); diff --git a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonRowCenter.cs b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonRowCenter.cs index e4de691bd..3769f2cf3 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonRowCenter.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonRowCenter.cs @@ -90,7 +90,7 @@ public override Size GetPreferredSize([DisallowNull] ViewLayoutContext context) break; } - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; foreach (ViewBase child in this) { @@ -156,7 +156,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) // We take on all the available display area ClientRectangle = context.DisplayRectangle; - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Cache the size for the current item switch (CurrentSize) @@ -182,7 +182,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) if (child.Visible) { // Get the cached size of the child - Size childPreferred = Size.Empty; + var childPreferred = Size.Empty; switch (CurrentSize) { diff --git a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonScrollPort.cs b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonScrollPort.cs index 138eb838b..02858b145 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonScrollPort.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonScrollPort.cs @@ -52,10 +52,7 @@ public RibbonViewControl([DisallowNull] KryptonRibbon ribbon) /// /// Hide focus by giving it to the hidden control. /// - public void HideFocus() - { - _hiddenFocusTarget.Focus(); - } + public void HideFocus() => _hiddenFocusTarget.Focus(); #endregion #region Protected @@ -76,13 +73,13 @@ protected override bool ProcessDialogKey(Keys keyData) { case VisualPopupGroup popGroup: { - ViewRibbonPopupGroupManager manager = (ViewRibbonPopupGroupManager)popGroup.GetViewManager(); + var manager = (ViewRibbonPopupGroupManager)popGroup.GetViewManager(); focusView = manager.FocusView; break; } case VisualPopupMinimized minimized: { - ViewRibbonMinimizedManager manager = (ViewRibbonMinimizedManager)minimized.GetViewManager(); + var manager = (ViewRibbonMinimizedManager)minimized.GetViewManager(); focusView = manager.FocusView; break; } @@ -770,10 +767,7 @@ private void OnFarClick(object sender, EventArgs e) _needPaintDelegate(this, new NeedLayoutEventArgs(true)); } - private void OnViewControlPaintBackground(object sender, PaintEventArgs e) - { - PaintBackground?.Invoke(sender, e); - } + private void OnViewControlPaintBackground(object sender, PaintEventArgs e) => PaintBackground?.Invoke(sender, e); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonScroller.cs b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonScroller.cs index 36c44a0e6..a81fae1ba 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonScroller.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonScroller.cs @@ -169,10 +169,7 @@ private Rectangle AdjustRectForTabs(Rectangle rect) return rect; } - private void OnButtonClick(object sender, MouseEventArgs e) - { - Click?.Invoke(this, EventArgs.Empty); - } + private void OnButtonClick(object sender, MouseEventArgs e) => Click?.Invoke(this, EventArgs.Empty); #endregion } } diff --git a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonTabs.cs b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonTabs.cs index 3743e526e..17ea64e6c 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonTabs.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonTabs.cs @@ -138,12 +138,9 @@ public NeedPaintHandler NeedPaintDelegate /// /// Tab for which view element is needed. /// View element for tab; otherwise null. - public ViewDrawRibbonTab? GetViewForRibbonTab(KryptonRibbonTab? ribbonTab) - { - return ribbonTab == null - ? null + public ViewDrawRibbonTab? GetViewForRibbonTab(KryptonRibbonTab? ribbonTab) => ribbonTab == null + ? null : _tabCache.FirstOrDefault(viewTab => viewTab.RibbonTab == ribbonTab); - } /// /// Gets the view element for drawing the first visible ribbon tab. @@ -349,7 +346,7 @@ public override Size GetPreferredSize(ViewLayoutContext context) // Sync child elements to represent the current ribbon tabs collection setup SyncChildrenToRibbonTabs(); - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Reset cached variables _cachedSizes = new Size[Count]; @@ -496,7 +493,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) } // Fill remainder space with the tabs spare element - Rectangle customCaptionRect = Rectangle.Empty; + var customCaptionRect = Rectangle.Empty; if (GetViewForSpare != null) { GetViewForSpare.Visible = false; diff --git a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonTabsArea.cs b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonTabsArea.cs index 8350b55eb..8d82da9df 100644 --- a/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonTabsArea.cs +++ b/Source/Krypton Components/Krypton.Ribbon/View Layout/ViewLayoutRibbonTabsArea.cs @@ -599,7 +599,7 @@ private void OnRibbonFormDeactivate(object sender, EventArgs e) private void OnRibbonMdiChildActivate(object sender, EventArgs e) { // Cast to correct type - Form? topForm = sender as Form; + var topForm = sender as Form; // Unhook from watching any previous mdi child if (_activeMdiChild != null) @@ -645,7 +645,7 @@ private void OnRedrawTick(object sender, EventArgs e) { _invalidateTimer.Stop(); - if (_captionArea is { KryptonForm: { }, UsingCustomChrome: true }) + if (_captionArea is { KryptonForm: not null, UsingCustomChrome: true }) { if (_captionArea.KryptonForm.PaintCount == _paintCount) { @@ -756,7 +756,7 @@ private void OnAppMenuDisposed(object sender, EventArgs e) _appMenu.Disposed -= OnAppMenuDisposed; // Discover the reason for the menu close - ToolStripDropDownCloseReason closeReason = ToolStripDropDownCloseReason.AppFocusChange; + var closeReason = ToolStripDropDownCloseReason.AppFocusChange; if (_appMenu.CloseReason.HasValue) { closeReason = _appMenu.CloseReason.Value; @@ -793,8 +793,8 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e) if (!_ribbon.InDesignMode) { IContentValues? sourceContent = null; - LabelStyle toolTipStyle = LabelStyle.SuperTip; - bool shadow = true; + var toolTipStyle = LabelStyle.SuperTip; + var shadow = true; var screenRect = new Rectangle(e.ControlMousePosition, new Size(1, 1)); // If the target is the application button @@ -926,7 +926,7 @@ private void OnCancelToolTip(object sender, EventArgs e) => private void OnVisualPopupToolTipDisposed(object sender, EventArgs e) { // Unhook events from the specific instance that generated event - VisualPopupToolTip popupToolTip = (VisualPopupToolTip)sender; + var popupToolTip = (VisualPopupToolTip)sender; popupToolTip.Disposed -= OnVisualPopupToolTipDisposed!; // Not showing a popup page any more diff --git a/Source/Krypton Components/Krypton.Toolkit/AccurateText/AccurateText.cs b/Source/Krypton Components/Krypton.Toolkit/AccurateText/AccurateText.cs index 8ffdffd7d..02ae9840c 100644 --- a/Source/Krypton Components/Krypton.Toolkit/AccurateText/AccurateText.cs +++ b/Source/Krypton Components/Krypton.Toolkit/AccurateText/AccurateText.cs @@ -279,7 +279,7 @@ public static bool DrawString([DisallowNull] Graphics g, case true when composition: { //Check if correct in all cases - SolidBrush? tmpBrush = brush as SolidBrush; + var tmpBrush = brush as SolidBrush; Color tmpColor = tmpBrush?.Color ?? SystemColors.ActiveCaptionText; DrawCompositionText(g, memento.Text, memento.Font, rect, state, @@ -352,10 +352,10 @@ public static void DrawCompositionGlowingText(Graphics? g, bool copyBackground) { // Get the hDC for the graphics instance and create a memory DC - IntPtr gDC = g?.GetHdc() ?? IntPtr.Zero; + var gDC = g?.GetHdc() ?? IntPtr.Zero; try { - IntPtr mDC = PI.CreateCompatibleDC(gDC); + var mDC = PI.CreateCompatibleDC(gDC); var bmi = new PI.BITMAPINFO { @@ -369,7 +369,7 @@ public static void DrawCompositionGlowingText(Graphics? g, // Create a device independent bitmap and select into the memory DC - IntPtr hDIB = PI.CreateDIBSection(gDC, ref bmi, 0, out _, IntPtr.Zero, 0); + var hDIB = PI.CreateDIBSection(gDC, ref bmi, 0, out _, IntPtr.Zero, 0); PI.SelectObject(mDC, hDIB); if (copyBackground) @@ -380,7 +380,7 @@ public static void DrawCompositionGlowingText(Graphics? g, } // Select the font for use when drawing - IntPtr hFont = font.ToHfont(); + var hFont = font.ToHfont(); PI.SelectObject(mDC, hFont); // Get renderer for the correct state @@ -459,10 +459,10 @@ public static void DrawCompositionText(Graphics? g, StringFormat sf) { // Get the hDC for the graphics instance and create a memory DC - IntPtr gDC = g?.GetHdc() ?? IntPtr.Zero; + var gDC = g?.GetHdc() ?? IntPtr.Zero; try { - IntPtr mDC = PI.CreateCompatibleDC(gDC); + var mDC = PI.CreateCompatibleDC(gDC); var bmi = new PI.BITMAPINFO { @@ -475,7 +475,7 @@ public static void DrawCompositionText(Graphics? g, bmi.biSize = (uint)Marshal.SizeOf(bmi); // Create a device independent bitmap and select into the memory DC - IntPtr hDIB = PI.CreateDIBSection(gDC, ref bmi, 0, out _, IntPtr.Zero, 0); + var hDIB = PI.CreateDIBSection(gDC, ref bmi, 0, out _, IntPtr.Zero, 0); PI.SelectObject(mDC, hDIB); if (copyBackground) @@ -486,7 +486,7 @@ public static void DrawCompositionText(Graphics? g, } // Select the font for use when drawing - IntPtr hFont = font.ToHfont(); + var hFont = font.ToHfont(); PI.SelectObject(mDC, hFont); // Get renderer for the correct state diff --git a/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpec.cs b/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpec.cs index 5c4c927c0..4bbfdfeb0 100644 --- a/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpec.cs +++ b/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpec.cs @@ -113,7 +113,7 @@ protected ButtonSpec() public virtual object Clone() { // ReSharper disable RedundantBaseQualifier - ButtonSpec clone = (ButtonSpec)Activator.CreateInstance(base.GetType())!; + var clone = (ButtonSpec)Activator.CreateInstance(base.GetType())!; // ReSharper restore RedundantBaseQualifier clone.Image = Image; clone.ImageTransparentColor = ImageTransparentColor; @@ -936,37 +936,28 @@ public virtual string GetLongText(PaletteBase? palette) /// /// Palette to use for inheriting values. /// Tooltip title string. - public virtual string GetToolTipTitle(PaletteBase? palette) - { - return !string.IsNullOrEmpty(ToolTipTitle) + public virtual string GetToolTipTitle(PaletteBase? palette) => !string.IsNullOrEmpty(ToolTipTitle) || !AllowInheritToolTipTitle ? ToolTipTitle : palette?.GetButtonSpecToolTipTitle(ProtectedType) ?? string.Empty; - } /// /// Gets the color to remap from the image to the container foreground. /// /// Palette to use for inheriting values. /// Color value. - public virtual Color GetColorMap(PaletteBase? palette) - { - return ColorMap != Color.Empty + public virtual Color GetColorMap(PaletteBase? palette) => ColorMap != Color.Empty ? ColorMap : palette?.GetButtonSpecColorMap(ProtectedType) ?? Color.Empty; - } /// /// Gets the button style. /// /// Palette to use for inheriting values. /// Button style. - public virtual ButtonStyle GetStyle(PaletteBase? palette) - { - return ConvertToButtonStyle(Style != PaletteButtonStyle.Inherit + public virtual ButtonStyle GetStyle(PaletteBase? palette) => ConvertToButtonStyle(Style != PaletteButtonStyle.Inherit ? Style : palette?.GetButtonSpecStyle(ProtectedType)); - } /// /// Gets the button orientation. diff --git a/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecAny.cs b/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecAny.cs index d3eec91e1..5b91b8f5c 100644 --- a/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecAny.cs +++ b/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecAny.cs @@ -46,7 +46,7 @@ public ButtonSpecAny() /// New instance. public override object Clone() { - ButtonSpecAny clone = (ButtonSpecAny)base.Clone(); + var clone = (ButtonSpecAny)base.Clone(); clone.Visible = Visible; clone.Enabled = Enabled; clone.Checked = Checked; @@ -93,10 +93,7 @@ public bool Visible /// /// Resets the Visible property to its default value. /// - public void ResetVisible() - { - Visible = true; - } + public void ResetVisible() => Visible = true; #endregion #region Enabled diff --git a/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecFormWindowClose.cs b/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecFormWindowClose.cs index ec084ca98..40b5aa23b 100644 --- a/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecFormWindowClose.cs +++ b/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecFormWindowClose.cs @@ -43,7 +43,7 @@ public bool Enabled if (_enabled != value) { _enabled = value; - IntPtr hSystemMenu = PI.GetSystemMenu(KryptonForm.Handle, false); + var hSystemMenu = PI.GetSystemMenu(KryptonForm.Handle, false); if (hSystemMenu != IntPtr.Zero) { PI.EnableMenuItem(hSystemMenu, PI.SC_.CLOSE, _enabled ? PI.MF_.ENABLED : PI.MF_.DISABLED); @@ -105,7 +105,7 @@ protected override void OnClick(EventArgs e) if (!KryptonForm.InertForm) { // Only if the mouse is still within the button bounds do we perform action - MouseEventArgs mea = (MouseEventArgs)e; + var mea = (MouseEventArgs)e; if (GetView()!.ClientRectangle.Contains(mea.Location)) { PropertyInfo pi = typeof(Form).GetProperty(nameof(CloseReason), @@ -118,8 +118,8 @@ protected override void OnClick(EventArgs e) // Convert screen position to LPARAM format of WM_SYSCOMMAND message Point screenPos = Control.MousePosition; - IntPtr lParam = (IntPtr)(PI.MAKELOWORD(screenPos.X) | - PI.MAKEHIWORD(screenPos.Y)); + var lParam = (IntPtr)(PI.MAKELOWORD(screenPos.X) | + PI.MAKEHIWORD(screenPos.Y)); // Request the form be closed down KryptonForm.SendSysCommand(PI.SC_.CLOSE, lParam); diff --git a/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecFormWindowMax.cs b/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecFormWindowMax.cs index b852ddc06..f4d17bcd1 100644 --- a/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecFormWindowMax.cs +++ b/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecFormWindowMax.cs @@ -95,7 +95,7 @@ protected override void OnClick(EventArgs e) if (!KryptonForm.InertForm) { // Only if the mouse is still within the button bounds do we perform action - MouseEventArgs mea = (MouseEventArgs)e; + var mea = (MouseEventArgs)e; if (GetView().ClientRectangle.Contains(mea.Location)) { // Toggle between maximized and restored diff --git a/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecFormWindowMin.cs b/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecFormWindowMin.cs index 029e09696..45b10e897 100644 --- a/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecFormWindowMin.cs +++ b/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecFormWindowMin.cs @@ -95,7 +95,7 @@ protected override void OnClick(EventArgs e) if (!KryptonForm.InertForm) { // Only if the mouse is still within the button bounds do we perform action - MouseEventArgs mea = (MouseEventArgs)e; + var mea = (MouseEventArgs)e; if (GetView()!.ClientRectangle.Contains(mea.Location)) { // Toggle between minimized and restored diff --git a/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecManagerBase.cs b/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecManagerBase.cs index c346acea0..bbd29261e 100644 --- a/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecManagerBase.cs +++ b/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecManagerBase.cs @@ -401,14 +401,12 @@ public Rectangle GetButtonRectangle(ButtonSpec buttonSpec) /// /// Mouse point. /// True if the view wants the mouse position; otherwise false. - public bool DesignerGetHitTest(Point pt) - { + public bool DesignerGetHitTest(Point pt) => // Search all buttons for any that contain the provided point - return _specLookup.Values.Any(buttonView => + _specLookup.Values.Any(buttonView => buttonView.ViewButton is { Visible: true, Enabled: true } && buttonView.ViewButton.ClientRectangle.Contains(pt) ); - } /// /// Get a tool strip renderer appropriate for the hosting control. @@ -436,29 +434,23 @@ public void PerformNeedPaint(object sender, bool needLayout) => /// /// View to use when searching. /// ButtonSpec reference if found; otherwise null. - public virtual ButtonSpec? GetButtonSpecFromView(ViewDrawButton viewButton) - { - return (from specView in _specLookup.Values - where specView.ViewButton == viewButton - select specView.ButtonSpec + public virtual ButtonSpec? GetButtonSpecFromView(ViewDrawButton viewButton) => (from specView in _specLookup.Values + where specView.ViewButton == viewButton + select specView.ButtonSpec ) .FirstOrDefault(); - } /// /// Gets the view for the first visible and enabled button spec of the defined edge. /// /// Edge of buttons caller is interested in searching. /// ViewDrawButton reference; otherwise false. - public virtual ViewDrawButton? GetFirstVisibleViewButton(PaletteRelativeEdgeAlign align) - { - return (from specView in _specLookup.Values - where specView.ViewCenter.Visible && specView.ViewButton.Enabled - where specView.ButtonSpec.Edge == align - select specView.ViewButton + public virtual ViewDrawButton? GetFirstVisibleViewButton(PaletteRelativeEdgeAlign align) => (from specView in _specLookup.Values + where specView.ViewCenter.Visible && specView.ViewButton.Enabled + where specView.ButtonSpec.Edge == align + select specView.ViewButton ) .FirstOrDefault(); - } /// /// Gets the view for the next visible and enabled button spec of the defined edge. @@ -871,17 +863,14 @@ private int GetTargetDockerIndex(HeaderLocation location) private ViewDockStyle GetDockStyle(ButtonSpec spec) => spec.GetEdge(_redirector) == RelativeEdgeAlign.Near ? ViewDockStyle.Left : ViewDockStyle.Right; private VisualOrientation CalculateOrientation(VisualOrientation viewOrientation, - ButtonOrientation buttonOrientation) - { - return buttonOrientation switch - { - ButtonOrientation.FixedBottom => VisualOrientation.Bottom, - ButtonOrientation.FixedLeft => VisualOrientation.Left, - ButtonOrientation.FixedRight => VisualOrientation.Right, - ButtonOrientation.FixedTop => VisualOrientation.Top, - _ => viewOrientation - }; - } + ButtonOrientation buttonOrientation) => buttonOrientation switch + { + ButtonOrientation.FixedBottom => VisualOrientation.Bottom, + ButtonOrientation.FixedLeft => VisualOrientation.Left, + ButtonOrientation.FixedRight => VisualOrientation.Right, + ButtonOrientation.FixedTop => VisualOrientation.Top, + _ => viewOrientation + }; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecRemapByContentCache.cs b/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecRemapByContentCache.cs index 73d02e149..1c13452d0 100644 --- a/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecRemapByContentCache.cs +++ b/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecRemapByContentCache.cs @@ -40,10 +40,7 @@ public ButtonSpecRemapByContentCache(PaletteBase? target, /// Set the palette content to use for remapping. /// /// Palette for requesting foreground colors. - public void SetPaletteContent(IPaletteContent? paletteContent) - { - _paletteContent = paletteContent; - } + public void SetPaletteContent(IPaletteContent? paletteContent) => _paletteContent = paletteContent; #endregion #region SetPaletteState @@ -51,10 +48,7 @@ public void SetPaletteContent(IPaletteContent? paletteContent) /// Set the palette state of the remapping element. /// /// Palette state. - public void SetPaletteState(PaletteState paletteState) - { - _paletteState = paletteState; - } + public void SetPaletteState(PaletteState paletteState) => _paletteState = paletteState; #endregion #region PaletteContent diff --git a/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecView.cs b/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecView.cs index a1d6c5037..395f4620b 100644 --- a/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecView.cs +++ b/Source/Krypton Components/Krypton.Toolkit/ButtonSpec/ButtonSpecView.cs @@ -46,8 +46,8 @@ public ButtonSpecView([DisallowNull] PaletteRedirect redirector, // Remember references _redirector = redirector; - Manager = manager; - ButtonSpec = buttonSpec; + Manager = manager!; + ButtonSpec = buttonSpec!; _finishDelegate = OnFinishDelegate; // Create delegate for paint notifications @@ -105,7 +105,7 @@ public ButtonSpecView([DisallowNull] PaletteRedirect redirector, /// /// Gets access to the owning manager. /// - public ButtonSpecManagerBase? Manager { get; } + public ButtonSpecManagerBase Manager { get; } /// /// Gets access to the monitored button spec @@ -411,7 +411,7 @@ private void OnClick(object sender, MouseEventArgs e) private void OnKryptonContextMenuClosed(object sender, ToolStripDropDownClosedEventArgs e) { // Unhook from context menu event so it could garbage collected in the future - KryptonContextMenu kcm = (KryptonContextMenu)sender; + var kcm = (KryptonContextMenu)sender; kcm.Closed -= OnKryptonContextMenuClosed; // Remove the fixed button appearance diff --git a/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuCheckBox.cs b/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuCheckBox.cs index ad1663ea9..7cd54b3e0 100644 --- a/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuCheckBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuCheckBox.cs @@ -539,10 +539,7 @@ internal void SetPaletteRedirect(PaletteRedirect? redirector) #endregion #region Private - private void SetCheckBoxStyle(LabelStyle style) - { - _stateCommonRedirect.Style = CommonHelper.ContentStyleFromLabelStyle(style); - } + private void SetCheckBoxStyle(LabelStyle style) => _stateCommonRedirect.Style = CommonHelper.ContentStyleFromLabelStyle(style); #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuCollections.cs b/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuCollections.cs index 54345b53e..cfb598c19 100644 --- a/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuCollections.cs +++ b/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuCollections.cs @@ -45,11 +45,9 @@ public class KryptonContextMenuCollection : TypedRestrictCollection /// Key data to check against shortcut definitions. /// True if shortcut was handled, otherwise false. - public bool ProcessShortcut(Keys keyData) - { + public bool ProcessShortcut(Keys keyData) => // Ask each individual item if it has a shortcut to be processed - return this.Any(item => item.ProcessShortcut(keyData)); - } + this.Any(item => item.ProcessShortcut(keyData)); #endregion #region Internal @@ -217,11 +215,9 @@ public class KryptonContextMenuItemCollection : TypedRestrictCollection /// Key data to check against shortcut definitions. /// True if shortcut was handled, otherwise false. - public bool ProcessShortcut(Keys keyData) - { + public bool ProcessShortcut(Keys keyData) => // Ask each individual item if it has a shortcut to be processed - return this.Any(item => item.ProcessShortcut(keyData)); - } + this.Any(item => item.ProcessShortcut(keyData)); #endregion #region Internal diff --git a/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuComboBox.cs b/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuComboBox.cs index 44ce20994..6225d2a9c 100644 --- a/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuComboBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuComboBox.cs @@ -24,15 +24,9 @@ public class KryptonContextMenuComboBox : KryptonContextMenuItemBase public override KryptonContextMenuItemBase? this[int index] => throw new NotImplementedException(); - public override bool ProcessShortcut(Keys keyData) - { - throw new NotImplementedException(); - } + public override bool ProcessShortcut(Keys keyData) => throw new NotImplementedException(); public override ViewBase GenerateView(IContextMenuProvider provider, object parent, ViewLayoutStack columns, bool standardStyle, - bool imageColumn) - { - throw new NotImplementedException(); - } + bool imageColumn) => throw new NotImplementedException(); } } \ No newline at end of file diff --git a/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuItemBase.cs b/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuItemBase.cs index 49b0a97cb..831d73b53 100644 --- a/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuItemBase.cs +++ b/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuItemBase.cs @@ -85,7 +85,7 @@ public abstract ViewBase GenerateView(IContextMenuProvider provider, [TypeConverter(typeof(StringConverter))] [DefaultValue(null)] [Bindable(true)] - public object? Tag { get; set; } + public object Tag { get; set; } /// /// Gets and sets if the item is visible in the context menu. diff --git a/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuMonthCalendar.cs b/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuMonthCalendar.cs index 4df096c5d..6522a26a0 100644 --- a/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuMonthCalendar.cs +++ b/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuMonthCalendar.cs @@ -320,10 +320,7 @@ public DateTime TodayDate } } - private void ResetTodayDate() - { - TodayDate = DateTime.Now.Date; - } + private void ResetTodayDate() => TodayDate = DateTime.Now.Date; private bool ShouldSerializeTodayDate() => TodayDate != DateTime.Now.Date; @@ -359,10 +356,7 @@ public DateTime[] AnnuallyBoldedDates } } - private void ResetAnnuallyBoldedDates() - { - AnnuallyBoldedDates = null; - } + private void ResetAnnuallyBoldedDates() => AnnuallyBoldedDates = null; private bool ShouldSerializeAnnuallyBoldedDates() => _annualDates.Count > 0; @@ -394,10 +388,7 @@ public DateTime[] MonthlyBoldedDates } } - private void ResetMonthlyBoldedDates() - { - MonthlyBoldedDates = null; - } + private void ResetMonthlyBoldedDates() => MonthlyBoldedDates = null; private bool ShouldSerializeMonthlyBoldedDates() => _monthlyDates.Count > 0; @@ -421,10 +412,7 @@ public DateTime[] BoldedDates } } - private void ResetBoldedDates() - { - BoldedDates = null; - } + private void ResetBoldedDates() => BoldedDates = null; private bool ShouldSerializeBoldedDates() => BoldedDatesList.Count > 0; @@ -460,10 +448,7 @@ public DateTime MinDate } } - private void ResetMinDate() - { - MinDate = DateTimePicker.MinimumDateTime; - } + private void ResetMinDate() => MinDate = DateTimePicker.MinimumDateTime; private bool ShouldSerializeMinDate() => _minDate != DateTimePicker.MinimumDateTime; @@ -499,10 +484,7 @@ public DateTime MaxDate } } - private void ResetMaxDate() - { - MaxDate = DateTimePicker.MaximumDateTime; - } + private void ResetMaxDate() => MaxDate = DateTimePicker.MaximumDateTime; private bool ShouldSerializeMaxDate() => _maxDate != DateTimePicker.MaximumDateTime; @@ -580,10 +562,7 @@ public DateTime SelectionStart } } - private void ResetSelectionStart() - { - SelectionStart = DateTime.Now.Date; - } + private void ResetSelectionStart() => SelectionStart = DateTime.Now.Date; private bool ShouldSerializeSelectionStart() => SelectionStart != DateTime.Now.Date; @@ -633,10 +612,7 @@ public DateTime SelectionEnd } } - private void ResetSelectionEnd() - { - SelectionEnd = DateTime.Now.Date; - } + private void ResetSelectionEnd() => SelectionEnd = DateTime.Now.Date; private bool ShouldSerializeSelectionEnd() => SelectionStart != DateTime.Now.Date; @@ -706,10 +682,7 @@ public string TodayText } } - private void ResetTodayText() - { - TodayText = DEFAULT_TODAY; - } + private void ResetTodayText() => TodayText = DEFAULT_TODAY; /// /// Gets or sets the number of columns and rows of months Displayed. @@ -764,10 +737,7 @@ public Day FirstDayOfWeek } } - private void ResetFirstDayOfWeek() - { - FirstDayOfWeek = Day.Default; - } + private void ResetFirstDayOfWeek() => FirstDayOfWeek = Day.Default; private bool ShouldSerializeFirstDayOfWeek() => FirstDayOfWeek != Day.Default; @@ -885,10 +855,7 @@ public ButtonStyle DayStyle private bool ShouldSerializeDayStyle() => _dayStyle != ButtonStyle.CalendarDay; - private void ResetDayStyle() - { - DayStyle = ButtonStyle.CalendarDay; - } + private void ResetDayStyle() => DayStyle = ButtonStyle.CalendarDay; /// /// Gets and sets the content style for the day of week labels. @@ -914,10 +881,7 @@ public ButtonStyle DayOfWeekStyle private bool ShouldSerializeDayOfWeekStyle() => _dayOfWeekStyle != ButtonStyle.CalendarDay; - private void ResetDayOfWeekStyle() - { - DayOfWeekStyle = ButtonStyle.CalendarDay; - } + private void ResetDayOfWeekStyle() => DayOfWeekStyle = ButtonStyle.CalendarDay; /// /// Gets access to the day appearance when it has focus. diff --git a/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuRadioButton.cs b/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuRadioButton.cs index a4b33b857..2363d50b2 100644 --- a/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuRadioButton.cs +++ b/Source/Krypton Components/Krypton.Toolkit/ContextMenu/KryptonContextMenuRadioButton.cs @@ -459,10 +459,7 @@ internal void SetPaletteRedirect(PaletteRedirect? redirector) #endregion #region Private - private void SetRadioButtonStyle(LabelStyle style) - { - _stateCommonRedirect.Style = CommonHelper.ContentStyleFromLabelStyle(style); - } + private void SetRadioButtonStyle(LabelStyle style) => _stateCommonRedirect.Style = CommonHelper.ContentStyleFromLabelStyle(style); #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controller/ButtonController.cs b/Source/Krypton Components/Krypton.Toolkit/Controller/ButtonController.cs index c87883843..1a33bfe71 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controller/ButtonController.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controller/ButtonController.cs @@ -168,12 +168,9 @@ public void RemoveFixed() /// /// Reset the dragging rect to prevent any dragging starting. /// - public void ClearDragRect() - { - _dragRect = Rectangle.Empty; - } + public void ClearDragRect() => _dragRect = Rectangle.Empty; #endregion - + #region ClickOnDown /// /// Gets and sets if the press down should cause the click. diff --git a/Source/Krypton Components/Krypton.Toolkit/Controller/TrackBarController.cs b/Source/Krypton Components/Krypton.Toolkit/Controller/TrackBarController.cs index ae79ee541..e84dacb41 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controller/TrackBarController.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controller/TrackBarController.cs @@ -144,10 +144,7 @@ public virtual void MouseLeave(Control c, ViewBase? next) /// Left mouse button double click. /// /// Mouse position relative to control. - public virtual void DoubleClick(Point pt) - { - _drawTB.ViewDrawTrackBar.ScrollValue = _drawTB.NearestValueFromPoint(pt); - } + public virtual void DoubleClick(Point pt) => _drawTB.ViewDrawTrackBar.ScrollValue = _drawTB.NearestValueFromPoint(pt); /// /// Should the left mouse down be ignored when present on a visual form border area. diff --git a/Source/Krypton Components/Krypton.Toolkit/Controller/TrackPositionController.cs b/Source/Krypton Components/Krypton.Toolkit/Controller/TrackPositionController.cs index 256fead89..943cd3ca2 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controller/TrackPositionController.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controller/TrackPositionController.cs @@ -135,7 +135,7 @@ public virtual void DoubleClick(Point pt) #region Implementation private void UpdateTargetState() { - PaletteState newState = PaletteState.Normal; + var newState = PaletteState.Normal; if (_mouseOver) { diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonBorderEdge.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonBorderEdge.cs index 0da6a3325..20d625384 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonBorderEdge.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonBorderEdge.cs @@ -201,10 +201,7 @@ public PaletteBorderStyle BorderStyle } } - private void ResetBorderStyle() - { - BorderStyle = PaletteBorderStyle.ControlClient; - } + private void ResetBorderStyle() => BorderStyle = PaletteBorderStyle.ControlClient; private bool ShouldSerializeBorderStyle() => BorderStyle != PaletteBorderStyle.ControlClient; @@ -288,11 +285,9 @@ public override Size GetPreferredSize(Size proposedSize) /// Fix the control to a particular palette state. /// /// Palette state to fix. - public virtual void SetFixedState(PaletteState state) - { + public virtual void SetFixedState(PaletteState state) => // Request fixed state from the view _drawPanel.FixedState = state; - } #endregion #region Protected Overrides diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonBreadCrumb.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonBreadCrumb.cs index 86184a89f..5bc7fcb63 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonBreadCrumb.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonBreadCrumb.cs @@ -165,11 +165,9 @@ protected override void Dispose(bool disposing) /// /// Signals the object that initialization is starting. /// - public virtual void BeginInit() - { + public virtual void BeginInit() => // Remember that fact we are inside a BeginInit/EndInit pair IsInitializing = true; - } /// /// Signals the object that initialization is complete. @@ -341,10 +339,7 @@ public PaletteBackStyle ControlBackStyle private bool ShouldSerializeControlBackStyle() => ControlBackStyle != PaletteBackStyle.PanelAlternate; - private void ResetControlBackStyle() - { - ControlBackStyle = PaletteBackStyle.PanelAlternate; - } + private void ResetControlBackStyle() => ControlBackStyle = PaletteBackStyle.PanelAlternate; /// /// Gets and sets the button style for drawing each bread crumb. @@ -368,10 +363,7 @@ public ButtonStyle CrumbButtonStyle private bool ShouldSerializeCrumbButtonStyle() => CrumbButtonStyle != ButtonStyle.BreadCrumb; - private void ResetCrumbButtonStyle() - { - CrumbButtonStyle = ButtonStyle.BreadCrumb; - } + private void ResetCrumbButtonStyle() => CrumbButtonStyle = ButtonStyle.BreadCrumb; /// /// Gets and sets the border style for the control. @@ -395,10 +387,7 @@ public PaletteBorderStyle ControlBorderStyle private bool ShouldSerializeControlBorderStyle() => ControlBorderStyle != PaletteBorderStyle.ControlClient; - private void ResetControlBorderStyle() - { - ControlBorderStyle = PaletteBorderStyle.ControlClient; - } + private void ResetControlBorderStyle() => ControlBorderStyle = PaletteBorderStyle.ControlClient; /// /// Gets and sets the root bread crumb item. @@ -503,11 +492,9 @@ public KryptonBreadCrumbItem? SelectedItem /// Fix the control to a particular palette state. /// /// Palette state to fix. - public virtual void SetFixedState(PaletteState state) - { + public virtual void SetFixedState(PaletteState state) => // Request fixed state from the view _drawDocker.FixedState = state; - } /// /// Internal design time method. @@ -704,9 +691,9 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e) if (!DesignMode) { IContentValues? sourceContent = null; - LabelStyle toolTipStyle = LabelStyle.ToolTip; + var toolTipStyle = LabelStyle.ToolTip; - bool shadow = true; + var shadow = true; // Find the button spec associated with the tooltip request ButtonSpec? buttonSpec = _buttonManager?.ButtonSpecFromView(e.Target); @@ -763,7 +750,7 @@ private void OnCancelToolTip(object sender, EventArgs e) => private void OnVisualPopupToolTipDisposed(object sender, EventArgs e) { // Unhook events from the specific instance that generated event - VisualPopupToolTip popupToolTip = (VisualPopupToolTip)sender; + var popupToolTip = (VisualPopupToolTip)sender; popupToolTip.Disposed -= OnVisualPopupToolTipDisposed; // Not showing a popup page any more diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonButton.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonButton.cs index feb5062a9..ba553ff7a 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonButton.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonButton.cs @@ -266,10 +266,7 @@ public ButtonStyle ButtonStyle private bool ShouldSerializeButtonStyle() => ButtonStyle != ButtonStyle.Standalone; - private void ResetButtonStyle() - { - ButtonStyle = ButtonStyle.Standalone; - } + private void ResetButtonStyle() => ButtonStyle = ButtonStyle.Standalone; [DefaultValue(false), Description(@"If set to true, the text will pair up with the equivalent KryptonManager's dialog button text result. (Note: You'll lose any previous text)")] @@ -824,7 +821,7 @@ protected override void OnPaint(PaintEventArgs e) _dropDownRectangle = new Rectangle(bounds.Right - DEFAULT_PUSH_BUTTON_WIDTH - 1, BORDER_SIZE, DEFAULT_PUSH_BUTTON_WIDTH, bounds.Height - BORDER_SIZE * 2); - int internalBorder = BORDER_SIZE; + var internalBorder = BORDER_SIZE; var focusRectangle = new Rectangle(internalBorder, internalBorder, bounds.Width - _dropDownRectangle.Width - internalBorder, bounds.Height - (internalBorder * 2)); @@ -1163,7 +1160,7 @@ private void ShowContextMenuStrip() private void KryptonContextMenu_Closed(object sender, ToolStripDropDownClosedEventArgs e) { - KryptonContextMenu? kcm = sender as KryptonContextMenu; + var kcm = sender as KryptonContextMenu; if (kcm != null) { kcm.Closed -= KryptonContextMenu_Closed; @@ -1177,7 +1174,7 @@ private void KryptonContextMenu_Closed(object sender, ToolStripDropDownClosedEve private void ContextMenuStrip_Closing(object sender, ToolStripDropDownClosingEventArgs e) { - ContextMenuStrip? cms = sender as ContextMenuStrip; + var cms = sender as ContextMenuStrip; if (cms != null) { cms.Closing -= ContextMenuStrip_Closing; diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCheckBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCheckBox.cs index 941fd8a3a..2ae648109 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCheckBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCheckBox.cs @@ -735,10 +735,7 @@ protected override void OnClick(EventArgs e) /// Update the view elements based on the requested label style. /// /// New label style. - protected virtual void SetLabelStyle(LabelStyle style) - { - _paletteCommonRedirect.Style = CommonHelper.ContentStyleFromLabelStyle(style); - } + protected virtual void SetLabelStyle(LabelStyle style) => _paletteCommonRedirect.Style = CommonHelper.ContentStyleFromLabelStyle(style); /// /// Processes a mnemonic character. diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCheckSet.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCheckSet.cs index 1934a2c5d..dbd5e7b2f 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCheckSet.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCheckSet.cs @@ -467,7 +467,7 @@ private void OnCheckedChanging(object sender, CancelEventArgs e) if (!_ignoreEvents) { // Cast to the correct type - KryptonCheckButton checkedButton = (KryptonCheckButton)sender; + var checkedButton = (KryptonCheckButton)sender; // Prevent the checked button becoming unchecked unless AllowUncheck is defined e.Cancel = checkedButton.Checked && !AllowUncheck; @@ -480,7 +480,7 @@ private void OnCheckedChanged(object sender, EventArgs e) if (!_ignoreEvents) { // Cast to the correct type - KryptonCheckButton checkedButton = (KryptonCheckButton)sender; + var checkedButton = (KryptonCheckButton)sender; if (checkedButton.Checked) { diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCheckedListBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCheckedListBox.cs index b32b7b071..21ecaa9b0 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCheckedListBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCheckedListBox.cs @@ -816,7 +816,7 @@ private void WmPaint(ref Message m) var ps = new PI.PAINTSTRUCT(); // Do we need to BeginPaint or just take the given HDC? - IntPtr hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; + var hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; // Create bitmap that all drawing occurs onto, then we can blit it later to remove flicker Rectangle realRect = CommonHelper.RealClientRectangle(Handle); @@ -824,7 +824,7 @@ private void WmPaint(ref Message m) // No point drawing when one of the dimensions is zero if (realRect is { Width: > 0, Height: > 0 }) { - IntPtr hBitmap = PI.CreateCompatibleBitmap(hdc, realRect.Width, realRect.Height); + var hBitmap = PI.CreateCompatibleBitmap(hdc, realRect.Width, realRect.Height); // If we managed to get a compatible bitmap if (hBitmap != IntPtr.Zero) @@ -852,7 +852,7 @@ private void WmPaint(ref Message m) } // Replace given DC with the screen DC for base window proc drawing - IntPtr beforeDC = m.WParam; + var beforeDC = m.WParam; m.WParam = _screenDC; DefWndProc(ref m); m.WParam = beforeDC; @@ -1423,10 +1423,7 @@ public ButtonStyle ItemStyle } } - private void ResetItemStyle() - { - ItemStyle = ButtonStyle.ListItem; - } + private void ResetItemStyle() => ItemStyle = ButtonStyle.ListItem; private bool ShouldSerializeItemStyle() => ItemStyle != ButtonStyle.ListItem; @@ -1576,10 +1573,7 @@ public PaletteBackStyle BackStyle } } - private void ResetBackStyle() - { - BackStyle = PaletteBackStyle.InputControlStandalone; - } + private void ResetBackStyle() => BackStyle = PaletteBackStyle.InputControlStandalone; private bool ShouldSerializeBackStyle() => BackStyle != PaletteBackStyle.InputControlStandalone; @@ -1603,10 +1597,7 @@ public PaletteBorderStyle BorderStyle } } - private void ResetBorderStyle() - { - BorderStyle = PaletteBorderStyle.InputControlStandalone; - } + private void ResetBorderStyle() => BorderStyle = PaletteBorderStyle.InputControlStandalone; private bool ShouldSerializeBorderStyle() => BorderStyle != PaletteBorderStyle.InputControlStandalone; @@ -1898,10 +1889,7 @@ public void SetItemCheckState(int index, CheckState value) /// Sets the fixed state of the control. /// /// Should the control be fixed as active. - public void SetFixedState(bool active) - { - _fixedActive = active; - } + public void SetFixedState(bool active) => _fixedActive = active; /// /// Gets a value indicating if the input control is active. @@ -2235,7 +2223,7 @@ private void OnListBoxDrawItem(object sender, DrawItemEventArgs e) UpdateContentFromItemIndex(e.Index); // By default the button is in the normal state - PaletteState buttonState = PaletteState.Normal; + var buttonState = PaletteState.Normal; // Is this item disabled if ((e.State & DrawItemState.Disabled) == DrawItemState.Disabled) @@ -2288,12 +2276,12 @@ private void OnListBoxDrawItem(object sender, DrawItemEventArgs e) _drawCheckBox.CheckState = GetItemCheckState(e.Index); // Grab the raw device context for the graphics instance - IntPtr hdc = e.Graphics.GetHdc(); + var hdc = e.Graphics.GetHdc(); try { // Create bitmap that all drawing occurs onto, then we can blit it later to remove flicker - IntPtr hBitmap = PI.CreateCompatibleBitmap(hdc, e.Bounds.Right, e.Bounds.Bottom); + var hBitmap = PI.CreateCompatibleBitmap(hdc, e.Bounds.Right, e.Bounds.Bottom); // If we managed to get a compatible bitmap if (hBitmap != IntPtr.Zero) diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonColorButton.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonColorButton.cs index fed373188..69539c64c 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonColorButton.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonColorButton.cs @@ -576,10 +576,7 @@ public ButtonStyle ButtonStyle private bool ShouldSerializeButtonStyle() => ButtonStyle != ButtonStyle.Standalone; - private void ResetButtonStyle() - { - ButtonStyle = ButtonStyle.Standalone; - } + private void ResetButtonStyle() => ButtonStyle = ButtonStyle.Standalone; /// /// Gets access to the color button content. @@ -1197,7 +1194,7 @@ private bool ShowDropDown() OnDropDown(cpma); // If we still want to show a context menu - if (cpma is { Cancel: false, KryptonContextMenu: { } }) + if (cpma is { Cancel: false, KryptonContextMenu: not null }) { // Convert the client rect to screen coords Rectangle screenRect = RectangleToScreen(ClientRectangle); @@ -1246,35 +1243,29 @@ private bool ShowDropDown() return showingContextMenu; } - private KryptonContextMenuPositionH GetPositionH() + private KryptonContextMenuPositionH GetPositionH() => DropDownOrientation switch { - return DropDownOrientation switch - { - //VisualOrientation.Bottom => KryptonContextMenuPositionH.Left, - //VisualOrientation.Top => KryptonContextMenuPositionH.Left, - VisualOrientation.Left => KryptonContextMenuPositionH.Before, - VisualOrientation.Right => KryptonContextMenuPositionH.After, - _ => KryptonContextMenuPositionH.Left - }; - } - - private KryptonContextMenuPositionV GetPositionV() + //VisualOrientation.Bottom => KryptonContextMenuPositionH.Left, + //VisualOrientation.Top => KryptonContextMenuPositionH.Left, + VisualOrientation.Left => KryptonContextMenuPositionH.Before, + VisualOrientation.Right => KryptonContextMenuPositionH.After, + _ => KryptonContextMenuPositionH.Left + }; + + private KryptonContextMenuPositionV GetPositionV() => DropDownOrientation switch { - return DropDownOrientation switch - { - //VisualOrientation.Bottom => KryptonContextMenuPositionV.Below, - VisualOrientation.Top => KryptonContextMenuPositionV.Above, - VisualOrientation.Left => KryptonContextMenuPositionV.Top, - VisualOrientation.Right => KryptonContextMenuPositionV.Top, - _ => KryptonContextMenuPositionV.Below - }; - } + //VisualOrientation.Bottom => KryptonContextMenuPositionV.Below, + VisualOrientation.Top => KryptonContextMenuPositionV.Above, + VisualOrientation.Left => KryptonContextMenuPositionV.Top, + VisualOrientation.Right => KryptonContextMenuPositionV.Top, + _ => KryptonContextMenuPositionV.Below + }; private void OnContextMenuClosed(object sender, EventArgs e) => ContextMenuClosed(); private void OnKryptonContextMenuClosed(object sender, EventArgs e) { - KryptonContextMenu kcm = (KryptonContextMenu)sender; + var kcm = (KryptonContextMenu)sender; kcm.Closed -= OnKryptonContextMenuClosed; ContextMenuClosed(); diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonColorDialog.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonColorDialog.cs index 503b04b0d..276981b16 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonColorDialog.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonColorDialog.cs @@ -122,7 +122,7 @@ protected override IntPtr HookProc(IntPtr hWnd, int msg, IntPtr wparam, IntPtr l && _commonDialogHandler.EmbeddingDone ) { - PI.WINDOWPOS pos = (PI.WINDOWPOS)PI.PtrToStructure(lparam, typeof(PI.WINDOWPOS))!; + var pos = (PI.WINDOWPOS)PI.PtrToStructure(lparam, typeof(PI.WINDOWPOS))!; if (!pos.flags.HasFlag(PI.SWP_.NOSIZE) && (pos.hwnd == hWnd) ) diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonComboBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonComboBox.cs index a15730e14..021a679f3 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonComboBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonComboBox.cs @@ -50,7 +50,7 @@ private class InternalPanel : Panel /// public override Size GetPreferredSize(Size proposedSize) { - Size maxSize = Size.Empty; + var maxSize = Size.Empty; // Find the largest size of any child control foreach (Control c in Controls) @@ -314,7 +314,7 @@ protected override void WndProc(ref Message m) var ps = new PI.PAINTSTRUCT(); // Do we need to BeginPaint or just take the given HDC? - IntPtr hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; + var hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; ////////////////////////////////////////////////////// // Following removed to allow the Draw to always happen, to allow centering etc @@ -377,7 +377,7 @@ protected override void WndProc(ref Message m) // Exclude border from being drawn, we need to take off another 2 pixels from all edges PI.IntersectClipRect(hdc, rect.left + 2, rect.top + 2, rect.right - 2, rect.bottom - 2); - string displayText = _kryptonComboBox.Text; + var displayText = _kryptonComboBox.Text; if (!string.IsNullOrWhiteSpace(_kryptonComboBox.CueHint.CueHintText) && string.IsNullOrEmpty(displayText) ) @@ -1211,11 +1211,9 @@ public float CornerRoundingRadius /// /// Signals the object that initialization is starting. /// - public virtual void BeginInit() - { + public virtual void BeginInit() => // Remember that fact we are inside a BeginInit/EndInit pair IsInitializing = true; - } /// /// Signals the object that initialization is complete. @@ -1714,10 +1712,7 @@ public InputControlStyle InputControlStyle } } - private void ResetInputControlStyle() - { - InputControlStyle = InputControlStyle.Standalone; - } + private void ResetInputControlStyle() => InputControlStyle = InputControlStyle.Standalone; private bool ShouldSerializeInputControlStyle() => InputControlStyle != InputControlStyle.Standalone; @@ -1741,10 +1736,7 @@ public ButtonStyle ItemStyle } } - private void ResetItemStyle() - { - ItemStyle = ButtonStyle.ListItem; - } + private void ResetItemStyle() => ItemStyle = ButtonStyle.ListItem; private bool ShouldSerializeItemStyle() => ItemStyle != ButtonStyle.ListItem; @@ -1767,10 +1759,7 @@ public ButtonStyle DropButtonStyle } } - private void ResetDropButtonStyle() - { - DropButtonStyle = ButtonStyle.InputControl; - } + private void ResetDropButtonStyle() => DropButtonStyle = ButtonStyle.InputControl; private bool ShouldSerializeDropButtonStyle() => DropButtonStyle != ButtonStyle.InputControl; @@ -1794,10 +1783,7 @@ public PaletteBackStyle DropBackStyle } } - private void ResetDropBackStyle() - { - DropBackStyle = PaletteBackStyle.ControlClient; - } + private void ResetDropBackStyle() => DropBackStyle = PaletteBackStyle.ControlClient; private bool ShouldSerializeDropBackStyle() => DropBackStyle != PaletteBackStyle.ControlClient; @@ -2012,10 +1998,7 @@ public bool FormattingEnabled /// Sets the fixed state of the control. /// /// Should the control be fixed as active. - public void SetFixedState(bool active) - { - _fixedActive = active; - } + public void SetFixedState(bool active) => _fixedActive = active; /// /// Gets a value indicating if the input control is active. @@ -2123,10 +2106,7 @@ public override Rectangle DisplayRectangle /// Override the display padding for the layout fill. /// /// Display padding value. - public void SetLayoutDisplayPadding(Padding padding) - { - _layoutPadding = padding; - } + public void SetLayoutDisplayPadding(Padding padding) => _layoutPadding = padding; /// /// Internal designing mode method. @@ -2677,7 +2657,7 @@ private void AttachEditControl() if (_subclassEdit == null) { // Find the first child - IntPtr childPtr = PI.GetWindow(_comboBox.Handle, PI.GetWindowType.GW_CHILD); + var childPtr = PI.GetWindow(_comboBox.Handle, PI.GetWindowType.GW_CHILD); // If we found a child then it is the edit class if (childPtr != IntPtr.Zero) @@ -2801,7 +2781,7 @@ private void OnComboBoxDrawItem(object sender, DrawItemEventArgs e) UpdateContentFromItemIndex(e.Index); // By default the button is in the normal state - PaletteState buttonState = PaletteState.Normal; + var buttonState = PaletteState.Normal; // Is this item disabled if ((e.State & DrawItemState.Disabled) == DrawItemState.Disabled) @@ -2828,12 +2808,12 @@ private void OnComboBoxDrawItem(object sender, DrawItemEventArgs e) _drawButton.ElementState = buttonState; // Grab the raw device context for the graphics instance - IntPtr hdc = e.Graphics.GetHdc(); + var hdc = e.Graphics.GetHdc(); try { // Create bitmap that all drawing occurs onto, then we can blit it later to remove flicker - IntPtr hBitmap = PI.CreateCompatibleBitmap(hdc, drawBounds.Right, drawBounds.Bottom); + var hBitmap = PI.CreateCompatibleBitmap(hdc, drawBounds.Right, drawBounds.Bottom); // If we managed to get a compatible bitmap if (hBitmap != IntPtr.Zero) @@ -3053,9 +3033,9 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e) if (!DesignMode) { IContentValues? sourceContent = null; - LabelStyle toolTipStyle = LabelStyle.ToolTip; + var toolTipStyle = LabelStyle.ToolTip; - bool shadow = true; + var shadow = true; // Find the button spec associated with the tooltip request ButtonSpec? buttonSpec = _buttonManager.ButtonSpecFromView(e.Target); @@ -3111,7 +3091,7 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e) private void OnVisualPopupToolTipDisposed(object sender, EventArgs e) { // Unhook events from the specific instance that generated event - VisualPopupToolTip popupToolTip = (VisualPopupToolTip)sender; + var popupToolTip = (VisualPopupToolTip)sender; popupToolTip.Disposed -= OnVisualPopupToolTipDisposed; // Not showing a popup page any more diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCommand.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCommand.cs index 732a46317..294b0ebf0 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCommand.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCommand.cs @@ -188,10 +188,7 @@ public string Text } } - private void ResetText() - { - Text = string.Empty; - } + private void ResetText() => Text = string.Empty; private bool ShouldSerializeText() => !string.IsNullOrEmpty(Text); @@ -217,10 +214,7 @@ public string ExtraText } } - private void ResetExtraText() - { - ExtraText = string.Empty; - } + private void ResetExtraText() => ExtraText = string.Empty; private bool ShouldSerializeExtraText() => !string.IsNullOrEmpty(ExtraText); @@ -245,10 +239,7 @@ public string TextLine1 } } - private void ResetTextLine1() - { - TextLine1 = string.Empty; - } + private void ResetTextLine1() => TextLine1 = string.Empty; private bool ShouldSerializeTextLine1() => !string.IsNullOrEmpty(TextLine1); @@ -273,10 +264,7 @@ public string TextLine2 } } - private void ResetTextLine2() - { - TextLine2 = string.Empty; - } + private void ResetTextLine2() => TextLine2 = string.Empty; private bool ShouldSerializeTextLine2() => !string.IsNullOrEmpty(TextLine2); @@ -301,10 +289,7 @@ public Image? ImageSmall } } - private void ResetImageSmall() - { - ImageSmall = null; - } + private void ResetImageSmall() => ImageSmall = null; private bool ShouldSerializeImageSmall() => ImageSmall != null; @@ -329,10 +314,7 @@ public Image? ImageLarge } } - private void ResetImageLarge() - { - ImageLarge = null; - } + private void ResetImageLarge() => ImageLarge = null; private bool ShouldSerializeImageLarge() => ImageLarge != null; diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonContextMenu.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonContextMenu.cs index 8637a90e5..62d9e7b5d 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonContextMenu.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonContextMenu.cs @@ -187,10 +187,7 @@ protected override void Dispose(bool disposing) /// /// - public void ResetTag() - { - Tag = null; - } + public void ResetTag() => Tag = null; /// /// Gets and sets if the context menu is enabled. @@ -218,10 +215,7 @@ public PaletteMode PaletteMode /// /// Resets the PaletteMode property to its default value. /// - public void ResetPaletteMode() - { - PaletteMode = PaletteMode.Global; - } + public void ResetPaletteMode() => PaletteMode = PaletteMode.Global; /// /// Gets and sets the custom palette implementation. @@ -239,10 +233,7 @@ public PaletteBase? Palette /// /// Resets the Palette property to its default value. /// - public void ResetPalette() - { - PaletteMode = PaletteMode.Global; - } + public void ResetPalette() => PaletteMode = PaletteMode.Global; /// /// Gets a reference to the caller that caused the context menu to be shown. @@ -354,7 +345,7 @@ public bool Show(object caller, Caller = caller; // Give event handler a change to cancel the open request - var cea = new CancelEventArgs(); + CancelEventArgs cea = new CancelEventArgs(); OnOpening(cea); if (!cea.Cancel) @@ -470,7 +461,7 @@ protected virtual VisualContextMenu CreateContextMenu(KryptonContextMenu kcm, #region Internal internal ToolStripDropDownCloseReason CloseReason { get; set; } - internal VisualContextMenu? VisualContextMenu { get; private set; } + internal VisualContextMenu VisualContextMenu { get; private set; } #endregion diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCustomPaletteBase.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCustomPaletteBase.cs index 387fc8db2..bf702d5d7 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCustomPaletteBase.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCustomPaletteBase.cs @@ -1167,23 +1167,20 @@ public override int GetContentAdjacentGap(PaletteContentStyle style, PaletteStat /// Palette value should be applicable to this state. /// Requested metric. /// Integer value. - public override int GetMetricInt(PaletteState state, PaletteMetricInt metric) - { - return metric switch - { - PaletteMetricInt.BarButtonEdgeInside or PaletteMetricInt.BarButtonEdgeOutside or PaletteMetricInt.CheckButtonGap or PaletteMetricInt.RibbonTabGap => Navigator.StateCommon.Bar.GetMetricInt(state, metric), - PaletteMetricInt.HeaderButtonEdgeInsetPrimary => HeaderStyles.HeaderPrimary.StateCommon.GetMetricInt(state, metric), - PaletteMetricInt.HeaderButtonEdgeInsetSecondary => HeaderStyles.HeaderSecondary.StateCommon.GetMetricInt(state, metric), - PaletteMetricInt.HeaderButtonEdgeInsetDockInactive => HeaderStyles.HeaderDockInactive.StateCommon.GetMetricInt(state, metric), - PaletteMetricInt.HeaderButtonEdgeInsetDockActive => HeaderStyles.HeaderDockActive.StateCommon.GetMetricInt(state, metric), - PaletteMetricInt.HeaderButtonEdgeInsetForm => HeaderStyles.HeaderForm.StateCommon.GetMetricInt(state, metric), - PaletteMetricInt.HeaderButtonEdgeInsetCustom1 => HeaderStyles.HeaderCustom1.StateCommon.GetMetricInt(state, metric), - PaletteMetricInt.HeaderButtonEdgeInsetCustom2 => HeaderStyles.HeaderCustom2.StateCommon.GetMetricInt(state, metric), - PaletteMetricInt.HeaderButtonEdgeInsetCustom3 => HeaderStyles.HeaderCustom3.StateCommon.GetMetricInt(state, metric), - // Otherwise use base instance for the value instead - _ => _redirector.GetMetricInt(state, metric) - }; - } + public override int GetMetricInt(PaletteState state, PaletteMetricInt metric) => metric switch + { + PaletteMetricInt.BarButtonEdgeInside or PaletteMetricInt.BarButtonEdgeOutside or PaletteMetricInt.CheckButtonGap or PaletteMetricInt.RibbonTabGap => Navigator.StateCommon.Bar.GetMetricInt(state, metric), + PaletteMetricInt.HeaderButtonEdgeInsetPrimary => HeaderStyles.HeaderPrimary.StateCommon.GetMetricInt(state, metric), + PaletteMetricInt.HeaderButtonEdgeInsetSecondary => HeaderStyles.HeaderSecondary.StateCommon.GetMetricInt(state, metric), + PaletteMetricInt.HeaderButtonEdgeInsetDockInactive => HeaderStyles.HeaderDockInactive.StateCommon.GetMetricInt(state, metric), + PaletteMetricInt.HeaderButtonEdgeInsetDockActive => HeaderStyles.HeaderDockActive.StateCommon.GetMetricInt(state, metric), + PaletteMetricInt.HeaderButtonEdgeInsetForm => HeaderStyles.HeaderForm.StateCommon.GetMetricInt(state, metric), + PaletteMetricInt.HeaderButtonEdgeInsetCustom1 => HeaderStyles.HeaderCustom1.StateCommon.GetMetricInt(state, metric), + PaletteMetricInt.HeaderButtonEdgeInsetCustom2 => HeaderStyles.HeaderCustom2.StateCommon.GetMetricInt(state, metric), + PaletteMetricInt.HeaderButtonEdgeInsetCustom3 => HeaderStyles.HeaderCustom3.StateCommon.GetMetricInt(state, metric), + // Otherwise use base instance for the value instead + _ => _redirector.GetMetricInt(state, metric) + }; /// /// Gets a boolean metric value. @@ -3012,7 +3009,7 @@ private void ImportFromXmlDocument(XmlDocument doc) } // Try and grab the root element - XmlElement? root = doc.SelectSingleNode("KryptonPalette") as XmlElement; + var root = doc.SelectSingleNode("KryptonPalette") as XmlElement; // We insist the root is always present if (root == null) @@ -3035,8 +3032,8 @@ private void ImportFromXmlDocument(XmlDocument doc) } // Grab the properties and images elements - XmlElement? props = root.SelectSingleNode(nameof(Properties)) as XmlElement; - XmlElement? images = root.SelectSingleNode(nameof(Images)) as XmlElement; + var props = root.SelectSingleNode(nameof(Properties)) as XmlElement; + var images = root.SelectSingleNode(nameof(Images)) as XmlElement; // There must be both properties and images elements present if (props == null) @@ -3075,7 +3072,7 @@ private object ExportToFile(object parameter) var info = new FileInfo(filename); // Check the target directory actually exists - if (info.Directory != null && !info.Directory.Exists) + if (info.Directory is { Exists: false }) { throw new ArgumentException("Provided directory does not exist."); } @@ -3095,7 +3092,7 @@ private object ExportToStream(object parameter) var parameters = (object[])parameter; // Extract the two provided parameters - Stream stream = (Stream)parameters[0]; + var stream = (Stream)parameters[0]; var ignoreDefaults = (bool)parameters[1]; // Create an XmlDocument containing palette settings @@ -3201,7 +3198,7 @@ private void ImportObjectFromElement(XmlElement? element, // Cast attribute to the correct type // Check if there is an element matching the property - XmlElement? childElement = element?.SelectSingleNode(prop.Name) as XmlElement; + var childElement = element?.SelectSingleNode(prop.Name) as XmlElement; // Can only import if a matching XML element is found if (childElement != null) @@ -3288,7 +3285,7 @@ private void ImportImagesFromElement(XmlElement element, ImageReverseDictionary foreach (XmlNode image in images) { // Cast to the expected type - XmlElement imageElement = (XmlElement)image; + var imageElement = (XmlElement)image; // Check the element is the expected type and has the required data if (imageElement != null && @@ -3302,7 +3299,7 @@ private void ImportImagesFromElement(XmlElement element, ImageReverseDictionary var name = imageElement.GetAttribute(@"Name"); // Grab the CDATA section that contains the base64 value - XmlCDataSection cdata = (XmlCDataSection)imageElement.ChildNodes[0]; + var cdata = (XmlCDataSection)imageElement.ChildNodes[0]; // Convert to back from a string to bytes var bytes = Convert.FromBase64String(cdata.Value); @@ -3412,7 +3409,7 @@ private void ExportObjectToElement(XmlDocument doc, if (defaultAttribs.Length == 1) { // Cast to correct type - DefaultValueAttribute defaultAttrib = (DefaultValueAttribute)defaultAttribs[0]; + var defaultAttrib = (DefaultValueAttribute)defaultAttribs[0]; // Decide if the property value matches the default described by the attribute if (defaultAttrib.Value == null) @@ -3582,7 +3579,7 @@ private void ResetObjectToDefault(object? obj, bool populate) if (defaultAttribs.Length == 1) { // Cast to correct type - DefaultValueAttribute defaultAttrib = (DefaultValueAttribute)defaultAttribs[0]; + var defaultAttrib = (DefaultValueAttribute)defaultAttribs[0]; // Grab the actual property value var childObj = prop.GetValue(obj, null); diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridView.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridView.cs index 5f65363b3..152a0f656 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridView.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridView.cs @@ -478,10 +478,7 @@ public PaletteMode PaletteMode /// /// Resets the PaletteMode property to its default value. /// - public void ResetPaletteMode() - { - PaletteMode = PaletteMode.Global; - } + public void ResetPaletteMode() => PaletteMode = PaletteMode.Global; /// /// Gets and sets the custom palette implementation. @@ -538,10 +535,7 @@ public PaletteBase? Palette /// /// Resets the Palette property to its default value. /// - public void ResetPalette() - { - PaletteMode = PaletteMode.Global; - } + public void ResetPalette() => PaletteMode = PaletteMode.Global; /// /// Gets access to the current renderer. @@ -844,12 +838,9 @@ public void HighlightSearch(string s, List columnsIndex) private bool ShouldSerializeToolTipShadow() => !ToolTipShadow; - private void ResetToolTipShadow() - { - ToolTipShadow = true; - } + private void ResetToolTipShadow() => ToolTipShadow = true; #endregion - + #endregion #region Protected @@ -1254,7 +1245,7 @@ protected override void OnCellPainting(DataGridViewCellPaintingEventArgs e) case { RowIndex: >= 0, ColumnIndex: -1 }: { // By default there is no glyph needed for the row - GridRowGlyph glyph = GridRowGlyph.None; + var glyph = GridRowGlyph.None; // Find the correct glyph that should be drawn if (CurrentCellAddress.Y == e.RowIndex) @@ -2338,7 +2329,7 @@ private void CellAreaMouseLeaveInternal() private void OnVisualPopupToolTipDisposed(object sender, EventArgs e) { // Unhook events from the specific instance that generated event - VisualPopupToolTip popupToolTip = (VisualPopupToolTip)sender; + var popupToolTip = (VisualPopupToolTip)sender; popupToolTip.Disposed -= OnVisualPopupToolTipDisposed; // Not showing a popup page any more @@ -2631,13 +2622,11 @@ private void OnContextMenuStripOpening(object sender, CancelEventArgs e) [EditorBrowsable(EditorBrowsableState.Advanced)] public ToolStripRenderer CreateToolStripRenderer() => Renderer.RenderToolStrip(GetResolvedPalette()); - private void OnKryptonContextMenuDisposed(object sender, EventArgs e) - { + private void OnKryptonContextMenuDisposed(object sender, EventArgs e) => // When the current krypton context menu is disposed, we should remove // it to prevent it being used again, as that would just throw an exception // because it has been disposed. KryptonContextMenu = null; - } private void OnContextMenuClosed(object sender, ToolStripDropDownClosedEventArgs e) => ContextMenuClosed(); diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewButtonCell.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewButtonCell.cs index a508744f3..5053cb82e 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewButtonCell.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewButtonCell.cs @@ -47,7 +47,7 @@ public class KryptonDataGridViewButtonCell : DataGridViewButtonCell /// New object instance. public override object Clone() { - KryptonDataGridViewButtonCell dataGridViewCell = base.Clone() as KryptonDataGridViewButtonCell; + var dataGridViewCell = base.Clone() as KryptonDataGridViewButtonCell; if (dataGridViewCell != null) { dataGridViewCell._styleSet = _styleSet; @@ -104,7 +104,7 @@ protected override Size GetPreferredSize(Graphics graphics, { try { - KryptonDataGridView kDGV = (KryptonDataGridView)DataGridView; + var kDGV = (KryptonDataGridView)DataGridView; // Create the view elements and palette structure CreateViewAndPalettes(kDGV); diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewButtonColumn.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewButtonColumn.cs index 681fdcbc7..4620efd1f 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewButtonColumn.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewButtonColumn.cs @@ -65,7 +65,7 @@ public override string ToString() public override object Clone() { // Create a new instance - KryptonDataGridViewButtonColumn clone = base.Clone() as KryptonDataGridViewButtonColumn; + var clone = base.Clone() as KryptonDataGridViewButtonColumn; clone.Text = Text; return clone; } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewCheckBoxCell.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewCheckBoxCell.cs index 47def0c90..7121bc2dd 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewCheckBoxCell.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewCheckBoxCell.cs @@ -75,7 +75,7 @@ protected override Size GetPreferredSize(Graphics graphics, { try { - KryptonDataGridView kDGV = (KryptonDataGridView)DataGridView; + var kDGV = (KryptonDataGridView)DataGridView; // Is this cell the currently active cell var currentCell = (rowIndex == DataGridView.CurrentCellAddress.Y) && @@ -143,7 +143,7 @@ protected override void Paint(Graphics graphics, // Should we draw the content foreground? if ((paintParts & DataGridViewPaintParts.ContentForeground) == DataGridViewPaintParts.ContentForeground) { - CheckState checkState = CheckState.Unchecked; + var checkState = CheckState.Unchecked; switch (formattedValue) { diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewComboBoxCell.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewComboBoxCell.cs index 0bdd107ea..1b6d2dec8 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewComboBoxCell.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewComboBoxCell.cs @@ -93,7 +93,7 @@ public override string ToString() => /// public override object Clone() { - KryptonDataGridViewComboBoxCell dataGridViewCell = base.Clone() as KryptonDataGridViewComboBoxCell; + var dataGridViewCell = base.Clone() as KryptonDataGridViewComboBoxCell; if (dataGridViewCell != null) { dataGridViewCell.DropDownStyle = DropDownStyle; diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewComboBoxColumn.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewComboBoxColumn.cs index b7b5b38ca..dfce66b15 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewComboBoxColumn.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewComboBoxColumn.cs @@ -54,7 +54,7 @@ public override string ToString() /// public override object Clone() { - KryptonDataGridViewComboBoxColumn cloned = base.Clone() as KryptonDataGridViewComboBoxColumn; + var cloned = base.Clone() as KryptonDataGridViewComboBoxColumn; cloned.Items.AddRange(Items); diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewComboBoxEditingControl.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewComboBoxEditingControl.cs index 5d1895f2b..2835dfbda 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewComboBoxEditingControl.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewComboBoxEditingControl.cs @@ -94,14 +94,11 @@ public virtual void ApplyCellStyleToEditingControl(DataGridViewCellStyle dataGri /// /// Method called by the grid on keystrokes to determine if the editing control is interested in the key or not. /// - public virtual bool EditingControlWantsInputKey(Keys keyData, bool dataGridViewWantsInputKey) + public virtual bool EditingControlWantsInputKey(Keys keyData, bool dataGridViewWantsInputKey) => (keyData & Keys.KeyCode) switch { - return (keyData & Keys.KeyCode) switch - { - Keys.Right or Keys.Left or Keys.Down or Keys.Up or Keys.Home or Keys.Delete => true, - _ => !dataGridViewWantsInputKey - }; - } + Keys.Right or Keys.Left or Keys.Down or Keys.Up or Keys.Home or Keys.Delete => true, + _ => !dataGridViewWantsInputKey + }; /// /// Returns the current value of the editing control. diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewDateTimePickerCell.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewDateTimePickerCell.cs index 68e4b07d7..77207edf2 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewDateTimePickerCell.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewDateTimePickerCell.cs @@ -106,7 +106,7 @@ public KryptonDataGridViewDateTimePickerCell() /// public override object Clone() { - KryptonDataGridViewDateTimePickerCell dateTimeCell = base.Clone() as KryptonDataGridViewDateTimePickerCell; + var dateTimeCell = base.Clone() as KryptonDataGridViewDateTimePickerCell; if (dateTimeCell != null) { dateTimeCell.AutoShift = AutoShift; @@ -514,7 +514,7 @@ public override void InitializeEditingControl(int rowIndex, } else { - DateTime dt = (DateTime)_dtc.ConvertFromInvariantString(initialFormattedValueStr); + var dt = (DateTime)_dtc.ConvertFromInvariantString(initialFormattedValueStr); if (dt != null) { dateTime.Value = dt; @@ -549,7 +549,7 @@ protected override object GetFormattedValue(object value, int rowIndex, } else { - DateTime dt = (DateTime)value; + var dt = (DateTime)value; if (dt != null) { return _dtc.ConvertToInvariantString(dt); diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewDateTimePickerColumn.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewDateTimePickerColumn.cs index 8819ab452..f960d8084 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewDateTimePickerColumn.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewDateTimePickerColumn.cs @@ -60,7 +60,7 @@ public override string ToString() /// public override object Clone() { - KryptonDataGridViewDateTimePickerColumn cloned = base.Clone() as KryptonDataGridViewDateTimePickerColumn; + var cloned = base.Clone() as KryptonDataGridViewDateTimePickerColumn; cloned.CalendarAnnuallyBoldedDates = CalendarAnnuallyBoldedDates; cloned.CalendarMonthlyBoldedDates = CalendarMonthlyBoldedDates; diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewDateTimePickerEditingControl.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewDateTimePickerEditingControl.cs index 828e23181..633e1f5e0 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewDateTimePickerEditingControl.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewDateTimePickerEditingControl.cs @@ -124,14 +124,11 @@ public virtual void ApplyCellStyleToEditingControl(DataGridViewCellStyle dataGri /// /// Method called by the grid on keystrokes to determine if the editing control is interested in the key or not. /// - public virtual bool EditingControlWantsInputKey(Keys keyData, bool dataGridViewWantsInputKey) + public virtual bool EditingControlWantsInputKey(Keys keyData, bool dataGridViewWantsInputKey) => (keyData & Keys.KeyCode) switch { - return (keyData & Keys.KeyCode) switch - { - Keys.Right or Keys.Left or Keys.Down or Keys.Up or Keys.Home or Keys.Delete => true, - _ => !dataGridViewWantsInputKey - }; - } + Keys.Right or Keys.Left or Keys.Down or Keys.Up or Keys.Home or Keys.Delete => true, + _ => !dataGridViewWantsInputKey + }; /// /// Returns the current value of the editing control. diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewDomainUpDownColumn.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewDomainUpDownColumn.cs index 11be5ec0e..bcadf70d5 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewDomainUpDownColumn.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewDomainUpDownColumn.cs @@ -49,7 +49,7 @@ public override string ToString() /// public override object Clone() { - KryptonDataGridViewDomainUpDownColumn cloned = base.Clone() as KryptonDataGridViewDomainUpDownColumn; + var cloned = base.Clone() as KryptonDataGridViewDomainUpDownColumn; // Convert collection of strings to an array var strings = new string[Items.Count]; diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewIconColumn.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewIconColumn.cs index feb56820c..7879e5cc8 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewIconColumn.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewIconColumn.cs @@ -106,7 +106,7 @@ protected KryptonDataGridViewIconColumn(DataGridViewCell cellTemplate) /// public override object Clone() { - KryptonDataGridViewIconColumn cloned = base.Clone() as KryptonDataGridViewIconColumn; + var cloned = base.Clone() as KryptonDataGridViewIconColumn; foreach (IconSpec sp in IconSpecs) { diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewLinkCell.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewLinkCell.cs index bf16b53b8..f0cd22053 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewLinkCell.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewLinkCell.cs @@ -115,7 +115,7 @@ protected override Size GetPreferredSize(Graphics graphics, { try { - KryptonDataGridView kDGV = (KryptonDataGridView)DataGridView; + var kDGV = (KryptonDataGridView)DataGridView; // Ensure the view classes are created and hooked up CreateViewAndPalettes(kDGV); diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewLinkColumn.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewLinkColumn.cs index 985c3a631..dea190f26 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewLinkColumn.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewLinkColumn.cs @@ -62,7 +62,7 @@ public override string ToString() public override object Clone() { // Create a new instance - KryptonDataGridViewLinkColumn clone = base.Clone() as KryptonDataGridViewLinkColumn; + var clone = base.Clone() as KryptonDataGridViewLinkColumn; clone.Text = Text; clone.LabelStyle = LabelStyle; return clone; diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewMaskedTextBoxCell.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewMaskedTextBoxCell.cs index 9f61ec2fe..55fbec14e 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewMaskedTextBoxCell.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewMaskedTextBoxCell.cs @@ -394,7 +394,7 @@ public bool UseSystemPasswordChar /// public override object Clone() { - KryptonDataGridViewMaskedTextBoxCell dataGridViewCell = base.Clone() as KryptonDataGridViewMaskedTextBoxCell; + var dataGridViewCell = base.Clone() as KryptonDataGridViewMaskedTextBoxCell; if (dataGridViewCell != null) { dataGridViewCell.PromptChar = PromptChar; @@ -744,14 +744,11 @@ internal void SetUseSystemPasswordChar(int rowIndex, bool value) } } - internal static HorizontalAlignment TranslateAlignment(DataGridViewContentAlignment align) - { - return ANY_RIGHT.HasFlag(align) - ? HorizontalAlignment.Right - : ANY_CENTER.HasFlag(align) - ? HorizontalAlignment.Center + internal static HorizontalAlignment TranslateAlignment(DataGridViewContentAlignment align) => ANY_RIGHT.HasFlag(align) + ? HorizontalAlignment.Right + : ANY_CENTER.HasFlag(align) + ? HorizontalAlignment.Center : HorizontalAlignment.Left; - } #endregion } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewMaskedTextBoxColumn.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewMaskedTextBoxColumn.cs index 422dbdb3e..a9de9300d 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewMaskedTextBoxColumn.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewMaskedTextBoxColumn.cs @@ -51,7 +51,7 @@ public override string ToString() /// public override object Clone() { - KryptonDataGridViewMaskedTextBoxColumn cloned = base.Clone() as KryptonDataGridViewMaskedTextBoxColumn; + var cloned = base.Clone() as KryptonDataGridViewMaskedTextBoxColumn; return cloned; } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewNumericUpDownCell.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewNumericUpDownCell.cs index 3e9789567..0aa4e8870 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewNumericUpDownCell.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewNumericUpDownCell.cs @@ -237,7 +237,7 @@ public bool ThousandsSeparator /// public override object Clone() { - KryptonDataGridViewNumericUpDownCell dataGridViewCell = base.Clone() as KryptonDataGridViewNumericUpDownCell; + var dataGridViewCell = base.Clone() as KryptonDataGridViewNumericUpDownCell; if (dataGridViewCell != null) { dataGridViewCell.DecimalPlaces = DecimalPlaces; @@ -310,7 +310,7 @@ public override void InitializeEditingControl(int rowIndex, public override bool KeyEntersEditMode(KeyEventArgs e) { NumberFormatInfo numberFormatInfo = CultureInfo.CurrentCulture.NumberFormat; - Keys negativeSignKey = Keys.None; + var negativeSignKey = Keys.None; var negativeSignStr = numberFormatInfo.NegativeSign; if (!string.IsNullOrEmpty(negativeSignStr) && (negativeSignStr.Length == 1)) { @@ -594,15 +594,12 @@ internal void SetThousandsSeparator(int rowIndex, bool value) } } - internal static HorizontalAlignment TranslateAlignment(DataGridViewContentAlignment align) + internal static HorizontalAlignment TranslateAlignment(DataGridViewContentAlignment align) => align switch { - return align switch - { - ANY_RIGHT => HorizontalAlignment.Right, - ANY_CENTER => HorizontalAlignment.Center, - _ => HorizontalAlignment.Left - }; - } + ANY_RIGHT => HorizontalAlignment.Right, + ANY_CENTER => HorizontalAlignment.Center, + _ => HorizontalAlignment.Left + }; #endregion } } \ No newline at end of file diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewNumericUpDownColumn.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewNumericUpDownColumn.cs index d7fae24c7..fb70fe35a 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewNumericUpDownColumn.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewNumericUpDownColumn.cs @@ -51,7 +51,7 @@ public override string ToString() /// public override object Clone() { - KryptonDataGridViewNumericUpDownColumn cloned = base.Clone() as KryptonDataGridViewNumericUpDownColumn; + var cloned = base.Clone() as KryptonDataGridViewNumericUpDownColumn; return cloned; } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewTextBoxCell.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewTextBoxCell.cs index e25d791d1..5c8d6ec8f 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewTextBoxCell.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewTextBoxCell.cs @@ -76,7 +76,7 @@ public override string ToString() => /// public override object Clone() { - KryptonDataGridViewTextBoxCell cloned = base.Clone() as KryptonDataGridViewTextBoxCell; + var cloned = base.Clone() as KryptonDataGridViewTextBoxCell; foreach (IconSpec sp in IconSpecs) { cloned.IconSpecs.Add(sp.Clone() as IconSpec); diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewTextBoxColumn.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewTextBoxColumn.cs index 4734a795d..cc86a28b5 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewTextBoxColumn.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDataGridViewTextBoxColumn.cs @@ -53,7 +53,7 @@ public override string ToString() /// public override object Clone() { - KryptonDataGridViewTextBoxColumn cloned = base.Clone() as KryptonDataGridViewTextBoxColumn; + var cloned = base.Clone() as KryptonDataGridViewTextBoxColumn; cloned.Multiline = Multiline; cloned.MultilineStringEditor = MultilineStringEditor; diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDateTimePicker.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDateTimePicker.cs index f6c0da04b..c00a3bbb4 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDateTimePicker.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDateTimePicker.cs @@ -438,10 +438,7 @@ public string CalendarTodayText /// /// Reset the value of the CalendarTodayText property. /// - public void ResetCalendarTodayText() - { - CalendarTodayText = DEFAULT_TODAY; - } + public void ResetCalendarTodayText() => CalendarTodayText = DEFAULT_TODAY; /// /// First day of the week. @@ -504,10 +501,7 @@ public DateTime CalendarTodayDate } } - private void ResetCalendarTodayDate() - { - CalendarTodayDate = DateTime.Now.Date; - } + private void ResetCalendarTodayDate() => CalendarTodayDate = DateTime.Now.Date; private bool ShouldSerializeCalendarTodayDate() => CalendarTodayDate != DateTime.Now.Date; @@ -536,10 +530,7 @@ public DateTime[] CalendarAnnuallyBoldedDates /// True if property needs to be serialized. public bool ShouldSerializeCalendarAnnuallyBoldedDates() => _annualDates.Count > 0; - private void ResetCalendarAnnuallyBoldedDates() - { - CalendarAnnuallyBoldedDates = null; - } + private void ResetCalendarAnnuallyBoldedDates() => CalendarAnnuallyBoldedDates = null; /// /// Gets or sets the array of DateTime objects that determine which monthly days to bold. @@ -566,10 +557,7 @@ public DateTime[] CalendarMonthlyBoldedDates /// True if property needs to be serialized. public bool ShouldSerializeCalendarMonthlyBoldedDates() => _monthlyDates.Count > 0; - private void ResetCalendarMonthlyBoldedDates() - { - CalendarMonthlyBoldedDates = null; - } + private void ResetCalendarMonthlyBoldedDates() => CalendarMonthlyBoldedDates = null; /// /// Gets or sets the array of DateTime objects that determines which nonrecurring dates are Displayed in bold. @@ -596,10 +584,7 @@ public DateTime[] CalendarBoldedDates /// True if property needs to be serialized. public bool ShouldSerializeCalendarBoldedDates() => _dates.Count > 0; - private void ResetCalendarBoldedDates() - { - CalendarBoldedDates = null; - } + private void ResetCalendarBoldedDates() => CalendarBoldedDates = null; /// /// Gets or sets the alignment of the drop-down calendar on the DateTimePicker control. @@ -909,10 +894,7 @@ public DateTime MaxDate /// True if property needs to be serialized. public bool ShouldSerializeMaxDate() => (_maxDateTime != DateTimePicker.MaximumDateTime) && (_maxDateTime != DateTime.MaxValue); - private void ResetMaxDate() - { - MaxDate = DateTime.MaxValue; - } + private void ResetMaxDate() => MaxDate = DateTime.MaxValue; /// /// Gets or sets the minimum date and time that can be selected in the control. @@ -962,10 +944,7 @@ public DateTime MinDate /// True if property needs to be serialized. public bool ShouldSerializeMinDate() => (_minDateTime != DateTimePicker.MinimumDateTime) && (_minDateTime != DateTime.MinValue); - private void ResetMinDate() - { - MinDate = DateTime.MinValue; - } + private void ResetMinDate() => MinDate = DateTime.MinValue; /// /// Gets or sets a value indicating if the check box is checked and if the ValueNullable is DBNull or a DateTime value. @@ -1063,10 +1042,7 @@ public string CustomNullText [Description(@"Header style for the month calendar.")] public HeaderStyle CalendarHeaderStyle { get; set; } - private void ResetCalendarHeaderStyle() - { - CalendarHeaderStyle = HeaderStyle.Calendar; - } + private void ResetCalendarHeaderStyle() => CalendarHeaderStyle = HeaderStyle.Calendar; private bool ShouldSerializeCalendarHeaderStyle() => CalendarHeaderStyle != HeaderStyle.Calendar; @@ -1077,10 +1053,7 @@ private void ResetCalendarHeaderStyle() [Description(@"Content style for the day entries.")] public ButtonStyle CalendarDayStyle { get; set; } - private void ResetCalendarDayStyle() - { - CalendarDayStyle = ButtonStyle.CalendarDay; - } + private void ResetCalendarDayStyle() => CalendarDayStyle = ButtonStyle.CalendarDay; private bool ShouldSerializeCalendarDayStyle() => CalendarDayStyle != ButtonStyle.CalendarDay; @@ -1091,10 +1064,7 @@ private void ResetCalendarDayStyle() [Description(@"Content style for the day of week labels.")] public ButtonStyle CalendarDayOfWeekStyle { get; set; } - private void ResetCalendarDayOfWeekStyle() - { - CalendarDayOfWeekStyle = ButtonStyle.CalendarDay; - } + private void ResetCalendarDayOfWeekStyle() => CalendarDayOfWeekStyle = ButtonStyle.CalendarDay; private bool ShouldSerializeCalendarDayOfWeekStyle() => CalendarDayOfWeekStyle != ButtonStyle.CalendarDay; @@ -1172,10 +1142,7 @@ public InputControlStyle InputControlStyle } } - private void ResetInputControlStyle() - { - InputControlStyle = InputControlStyle.Standalone; - } + private void ResetInputControlStyle() => InputControlStyle = InputControlStyle.Standalone; private bool ShouldSerializeInputControlStyle() => InputControlStyle != InputControlStyle.Standalone; @@ -1199,10 +1166,7 @@ public ButtonStyle UpDownButtonStyle } } - private void ResetUpDownButtonStyle() - { - UpDownButtonStyle = ButtonStyle.InputControl; - } + private void ResetUpDownButtonStyle() => UpDownButtonStyle = ButtonStyle.InputControl; private bool ShouldSerializeUpDownButtonStyle() => UpDownButtonStyle != ButtonStyle.InputControl; @@ -1226,10 +1190,7 @@ public ButtonStyle DropButtonStyle } } - private void ResetDropButtonStyle() - { - DropButtonStyle = ButtonStyle.InputControl; - } + private void ResetDropButtonStyle() => DropButtonStyle = ButtonStyle.InputControl; private bool ShouldSerializeDropButtonStyle() => DropButtonStyle != ButtonStyle.InputControl; @@ -1364,10 +1325,7 @@ public void SelectLastFragment() /// Sets the fixed state of the control. /// /// Should the control be fixed as active. - public void SetFixedState(bool active) - { - _fixedActive = active; - } + public void SetFixedState(bool active) => _fixedActive = active; /// /// Gets access to the ToolTipManager used for displaying tool tips. @@ -1645,14 +1603,11 @@ protected override bool IsInputChar(char charCode) => /// /// One of the Keys values. /// true if the specified key is a regular input key; otherwise, false. - protected override bool IsInputKey(Keys keyData) + protected override bool IsInputKey(Keys keyData) => (keyData & ~Keys.Shift) switch { - return (keyData & ~Keys.Shift) switch - { - Keys.Left or Keys.Right or Keys.Up or Keys.Down => true, - _ => base.IsInputKey(keyData) - }; - } + Keys.Left or Keys.Right or Keys.Up or Keys.Down => true, + _ => base.IsInputKey(keyData) + }; /// /// Processes a mnemonic character. @@ -1988,10 +1943,7 @@ protected override void OnButtonSpecChanged(object sender, EventArgs e) /// /// A PaintEventArgs that contains the event data. /// - protected override void OnPaint(PaintEventArgs e) - { - base.OnPaint(e); - } + protected override void OnPaint(PaintEventArgs e) => base.OnPaint(e); #endregion @@ -2087,9 +2039,9 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e) if (!DesignMode) { IContentValues? sourceContent = null; - LabelStyle toolTipStyle = LabelStyle.ToolTip; + var toolTipStyle = LabelStyle.ToolTip; - bool shadow = true; + var shadow = true; // Find the button spec associated with the tooltip request ButtonSpec? buttonSpec = _buttonManager.ButtonSpecFromView(e.Target); @@ -2139,11 +2091,9 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e) } } - private void OnCheckBoxClick(object sender, EventArgs e) - { + private void OnCheckBoxClick(object sender, EventArgs e) => // Invert the current checked state Checked = !Checked; - } private void OnDropDownClick(object sender, EventArgs e) { @@ -2204,7 +2154,7 @@ private void OnDropDownClick(object sender, EventArgs e) OnDropDown(dtpda); // If we still want to show a context menu - if (dtpda is { Cancel: false, KryptonContextMenu: { } }) + if (dtpda is { Cancel: false, KryptonContextMenu: not null }) { // If showing a menu then we automatically ensure the control is checked Checked = true; @@ -2276,7 +2226,7 @@ private void OnMonthCalendarDateChanged(object sender, DateRangeEventArgs e) private void OnKryptonContextMenuClosed(object sender, EventArgs e) { // Must unhook from menu so it can be garbage collected - KryptonContextMenu kcm = (KryptonContextMenu)sender; + var kcm = (KryptonContextMenu)sender; kcm.Closed -= OnKryptonContextMenuClosed; // Unhook from month calendar events @@ -2332,7 +2282,7 @@ private void OnCancelToolTip(object sender, EventArgs e) => private void OnVisualPopupToolTipDisposed(object sender, EventArgs e) { // Unhook events from the specific instance that generated event - VisualPopupToolTip popupToolTip = (VisualPopupToolTip)sender; + var popupToolTip = (VisualPopupToolTip)sender; popupToolTip.Disposed -= OnVisualPopupToolTipDisposed; // Not showing a popup page any more diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDomainUpDown.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDomainUpDown.cs index 34b1b022a..5c099982a 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDomainUpDown.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDomainUpDown.cs @@ -339,7 +339,7 @@ protected override void WndProc(ref Message m) var ps = new PI.PAINTSTRUCT(); // Do we need to BeginPaint or just take the given HDC? - IntPtr hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; + var hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; // Paint the entire area in the background color using (Graphics g = Graphics.FromHdc(hdc)) @@ -537,7 +537,7 @@ protected override void WndProc(ref Message m) var ps = new PI.PAINTSTRUCT(); // Do we need to BeginPaint or just take the given HDC? - IntPtr hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; + var hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; // Grab the client area of the control PI.GetClientRect(Handle, out PI.RECT rect); @@ -547,7 +547,7 @@ protected override void WndProc(ref Message m) try { // Create bitmap that all drawing occurs onto, then we can blit it later to remove flicker - IntPtr hBitmap = PI.CreateCompatibleBitmap(hdc, clientRect.Right, clientRect.Bottom); + var hBitmap = PI.CreateCompatibleBitmap(hdc, clientRect.Right, clientRect.Bottom); // If we managed to get a compatible bitmap if (hBitmap != IntPtr.Zero) @@ -1792,10 +1792,7 @@ protected override void WndProc(ref Message m) /// Raises the Paint event. /// A PaintEventArgs that contains the event data. - protected override void OnPaint(PaintEventArgs e) - { - base.OnPaint(e); - } + protected override void OnPaint(PaintEventArgs e) => base.OnPaint(e); #endregion @@ -1953,9 +1950,9 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e) if (!DesignMode) { IContentValues? sourceContent = null; - LabelStyle toolTipStyle = LabelStyle.ToolTip; + var toolTipStyle = LabelStyle.ToolTip; - bool shadow = true; + var shadow = true; // Find the button spec associated with the tooltip request ButtonSpec buttonSpec = _buttonManager.ButtonSpecFromView(e.Target); @@ -2012,7 +2009,7 @@ private void OnCancelToolTip(object sender, EventArgs e) => private void OnVisualPopupToolTipDisposed(object sender, EventArgs e) { // Unhook events from the specific instance that generated event - VisualPopupToolTip popupToolTip = (VisualPopupToolTip)sender; + var popupToolTip = (VisualPopupToolTip)sender; popupToolTip.Disposed -= OnVisualPopupToolTipDisposed; // Not showing a popup page any more diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDropButton.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDropButton.cs index 76cad7eaa..6fcfdfb97 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDropButton.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonDropButton.cs @@ -299,10 +299,7 @@ public ButtonStyle ButtonStyle } } - private void ResetButtonStyle() - { - ButtonStyle = ButtonStyle.Standalone; - } + private void ResetButtonStyle() => ButtonStyle = ButtonStyle.Standalone; private bool ShouldSerializeButtonStyle() => ButtonStyle != ButtonStyle.Standalone; @@ -885,31 +882,25 @@ private bool ShowDropDown() return showingContextMenu; } - private KryptonContextMenuPositionH GetPositionH() + private KryptonContextMenuPositionH GetPositionH() => DropDownOrientation switch { - return DropDownOrientation switch - { - VisualOrientation.Left => KryptonContextMenuPositionH.Before, - VisualOrientation.Right => KryptonContextMenuPositionH.After, - _ => KryptonContextMenuPositionH.Left - }; - } + VisualOrientation.Left => KryptonContextMenuPositionH.Before, + VisualOrientation.Right => KryptonContextMenuPositionH.After, + _ => KryptonContextMenuPositionH.Left + }; - private KryptonContextMenuPositionV GetPositionV() + private KryptonContextMenuPositionV GetPositionV() => DropDownOrientation switch { - return DropDownOrientation switch - { - VisualOrientation.Top => KryptonContextMenuPositionV.Above, - VisualOrientation.Left or VisualOrientation.Right => KryptonContextMenuPositionV.Top, - _ => KryptonContextMenuPositionV.Below - }; - } + VisualOrientation.Top => KryptonContextMenuPositionV.Above, + VisualOrientation.Left or VisualOrientation.Right => KryptonContextMenuPositionV.Top, + _ => KryptonContextMenuPositionV.Below + }; private void OnContextMenuClosed(object sender, EventArgs e) => ContextMenuClosed(); private void OnKryptonContextMenuClosed(object sender, EventArgs e) { - KryptonContextMenu kcm = (KryptonContextMenu)sender; + var kcm = (KryptonContextMenu)sender; kcm.Closed -= OnKryptonContextMenuClosed; ContextMenuClosed(); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonFolderBrowserDialog.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonFolderBrowserDialog.cs index 158e98aca..af09db820 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonFolderBrowserDialog.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonFolderBrowserDialog.cs @@ -21,7 +21,7 @@ namespace Krypton.Toolkit public class KryptonFolderBrowserDialog : ShellDialogWrapper, IDisposable { #if NET60_OR_GREATER - private readonly FolderBrowserDialog _internalOpenFileDialog = new FolderBrowserDialog();// { AutoUpgradeEnabled = true }; + private readonly FolderBrowserDialog _internalOpenFileDialog = new();// { AutoUpgradeEnabled = true }; #else private readonly ShellBrowserDialogTFM _internalOpenFileDialog = new ShellBrowserDialogTFM(); #endif @@ -112,19 +112,13 @@ public override string Title } /// Resets all properties to their default values. - public override void Reset() - { - _internalOpenFileDialog.Reset(); - } + public override void Reset() => _internalOpenFileDialog.Reset(); /// public override string ToString() => _internalOpenFileDialog.ToString(); /// - public void Dispose() - { - _internalOpenFileDialog.Dispose(); - } + public void Dispose() => _internalOpenFileDialog.Dispose(); } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonFontDialog.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonFontDialog.cs index ad42b3792..370173c73 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonFontDialog.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonFontDialog.cs @@ -151,7 +151,7 @@ protected override IntPtr HookProc(IntPtr hWnd, int msg, IntPtr wparam, IntPtr l { kryptonColorButton1.Values.Text = e.Color.Name; Color = e.Color; - IntPtr stringColor = Marshal.StringToHGlobalUni(e.Color.Name); + var stringColor = Marshal.StringToHGlobalUni(e.Color.Name); var curIndex = PI.SendDlgItemMessage(hWnd, CLR_COMBOBOX_ID, PI.WM_.CB_FINDSTRING, IntPtr.Zero, stringColor); if (curIndex.ToInt32() == -1) { diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonForm.cs index 140f3c02d..b21223bb2 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonForm.cs @@ -586,10 +586,7 @@ public void RevokeViewElement([DisallowNull] ViewBase element, ViewDockStyle sty /// Next time a layout occurs the min/max/close buttons need recreating. /// [EditorBrowsable(EditorBrowsableState.Never)] - public void RecreateMinMaxCloseButtons() - { - _recreateButtons = true; - } + public void RecreateMinMaxCloseButtons() => _recreateButtons = true; /// /// Gets access to the ToolTipManager used for displaying tool tips. @@ -844,23 +841,20 @@ public FormPaletteRedirect(PaletteBase? palette, KryptonForm kryptonForm) : base(palette) => _kryptonForm = kryptonForm; - public override PaletteRelativeAlign GetContentShortTextH(PaletteContentStyle style, PaletteState state) + public override PaletteRelativeAlign GetContentShortTextH(PaletteContentStyle style, PaletteState state) => style switch { - return style switch - { - PaletteContentStyle.HeaderForm - or PaletteContentStyle.HeaderPrimary - or PaletteContentStyle.HeaderDockInactive - or PaletteContentStyle.HeaderDockActive - or PaletteContentStyle.HeaderSecondary - or PaletteContentStyle.HeaderCustom1 - or PaletteContentStyle.HeaderCustom2 - or PaletteContentStyle.HeaderCustom3 => _kryptonForm._formTitleAlign != PaletteRelativeAlign.Inherit - ? _kryptonForm._formTitleAlign - : base.GetContentShortTextH(style, state), - _ => base.GetContentShortTextH(style, state) - }; - } + PaletteContentStyle.HeaderForm + or PaletteContentStyle.HeaderPrimary + or PaletteContentStyle.HeaderDockInactive + or PaletteContentStyle.HeaderDockActive + or PaletteContentStyle.HeaderSecondary + or PaletteContentStyle.HeaderCustom1 + or PaletteContentStyle.HeaderCustom2 + or PaletteContentStyle.HeaderCustom3 => _kryptonForm._formTitleAlign != PaletteRelativeAlign.Inherit + ? _kryptonForm._formTitleAlign + : base.GetContentShortTextH(style, state), + _ => base.GetContentShortTextH(style, state) + }; } /// @@ -1235,7 +1229,7 @@ protected override bool WindowChromeLeftMouseDown(Point windowPoint) var ret = base.WindowChromeLeftMouseDown(windowPoint); // Has pressing down made a view active and indicated it also wants to capture mouse? - if (ViewManager is { ActiveView: { }, MouseCaptured: true }) + if (ViewManager is { ActiveView: not null, MouseCaptured: true }) { StartCapture(ViewManager.ActiveView); ret = true; @@ -1595,8 +1589,8 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e) if (!DesignMode) { IContentValues? sourceContent = null; - LabelStyle toolTipStyle = LabelStyle.ToolTip; - bool shadow = true; + var toolTipStyle = LabelStyle.ToolTip; + var shadow = true; // Find the button spec associated with the tooltip request ButtonSpec? buttonSpec = _buttonManager.ButtonSpecFromView(e.Target); @@ -1650,7 +1644,7 @@ private void OnCancelToolTip(object sender, EventArgs e) => private void OnVisualPopupToolTipDisposed(object sender, EventArgs e) { // Unhook events from the specific instance that generated event - VisualPopupToolTip popupToolTip = (VisualPopupToolTip)sender; + var popupToolTip = (VisualPopupToolTip)sender; popupToolTip.Disposed -= OnVisualPopupToolTipDisposed; // Not showing a popup page any more diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonGroupBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonGroupBox.cs index f65158f1f..f183f309e 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonGroupBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonGroupBox.cs @@ -65,7 +65,7 @@ public KryptonGroupBox() StateNormal = new PaletteGroupBox(StateCommon, NeedPaintDelegate); // Create the internal panel used for containing content - Panel = new KryptonGroupBoxPanel(this, StateCommon, StateDisabled, StateNormal, OnGroupPanelPaint) + Panel = new KryptonGroupBoxPanel(this, StateCommon, StateDisabled, StateNormal, OnGroupPanelPaint!) { // Make sure the panel back style always mimics our back style @@ -117,13 +117,13 @@ protected override void Dispose(bool disposing) if (disposing) { // Remove any cached obscurer - if (_obscurer != null) + if (_obscurer != null!) { try { _obscurer.Uncover(); _obscurer.Dispose(); - _obscurer = null; + _obscurer = null!; } catch { } } @@ -247,7 +247,7 @@ public override string Text [Category(@"Appearance")] [Description(@"The internal panel that contains group content.")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] - public KryptonGroupBoxPanel Panel { get; } + public KryptonGroupBoxPanel? Panel { get; } /// /// Gets and the sets the percentage of overlap for the caption and group area. @@ -293,10 +293,7 @@ public PaletteBorderStyle GroupBorderStyle } } - private void ResetGroupBorderStyle() - { - GroupBorderStyle = PaletteBorderStyle.ControlGroupBox; - } + private void ResetGroupBorderStyle() => GroupBorderStyle = PaletteBorderStyle.ControlGroupBox; private bool ShouldSerializeGroupBorderStyle() => GroupBorderStyle != PaletteBorderStyle.ControlGroupBox; @@ -596,7 +593,7 @@ public virtual void SetFixedState(PaletteState state) protected void ForceControlLayout() { // Usually the layout will not occur if currently initializing but - // we need to force the layout processing because overwise the size + // we need to force the layout processing because otherwise the size // of the panel controls will not have been calculated when controls // are added to the panels. That would then cause problems with // anchor controls as they would then resize incorrectly. @@ -663,14 +660,17 @@ protected override void OnLayout(LayoutEventArgs levent) // Only use layout logic if control is fully initialized or if being forced // to allow a relayout or if in design mode. - if (IsInitialized || _forcedLayout || (DesignMode && (Panel != null))) + if ((Panel != null)) { - Rectangle fillRect = _layoutFill.FillRect; + if (IsInitialized || _forcedLayout || DesignMode) + { + Rectangle fillRect = _layoutFill.FillRect; - Panel.SetBounds(fillRect.X, - fillRect.Y, - fillRect.Width, - fillRect.Height); + Panel.SetBounds(fillRect.X, + fillRect.Y, + fillRect.Width, + fillRect.Height); + } } } @@ -760,12 +760,16 @@ protected override void WndProc(ref Message m) // Just in case the WM_WINDOWPOSCHANGED does not occur we can // ensure the obscurer is removed using this async delegate call - BeginInvoke(_removeObscurer); + if (_removeObscurer != null) + { + BeginInvoke(_removeObscurer); + } + break; } case PI.WM_.WINDOWPOSCHANGED: // Uncover from the covered area - _obscurer?.Uncover(); + _obscurer.Uncover(); break; } @@ -774,9 +778,9 @@ protected override void WndProc(ref Message m) #endregion #region Internal - internal Component DesignerComponentFromPoint(Point pt) => + internal Component? DesignerComponentFromPoint(Point pt) => // Ignore call as view builder is already destructed - IsDisposed ? null : ViewManager.ComponentFromPoint(pt); + IsDisposed ? null : ViewManager?.ComponentFromPoint(pt); // Ask the current view for a decision // Simulate the mouse leaving the control so that the tracking @@ -786,7 +790,7 @@ internal Component DesignerComponentFromPoint(Point pt) => #endregion #region Implementation - private void OnRemoveObscurer(object sender, EventArgs e) => _obscurer?.Uncover(); + private void OnRemoveObscurer(object sender, EventArgs e) => _obscurer.Uncover(); private void OnValuesTextChanged(object sender, EventArgs e) => OnTextChanged(EventArgs.Empty); diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonGroupBoxPanel.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonGroupBoxPanel.cs index d16a163a4..c4fcd950a 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonGroupBoxPanel.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonGroupBoxPanel.cs @@ -27,9 +27,9 @@ public class KryptonGroupBoxPanel : KryptonGroupPanel /// Normal appearance state. /// Callback delegate for layout processing. public KryptonGroupBoxPanel(Control alignControl, - PaletteDoubleRedirect? stateCommon, - PaletteDouble? stateDisabled, - PaletteDouble? stateNormal, + [DisallowNull] PaletteDoubleRedirect stateCommon, + [DisallowNull] PaletteDouble stateDisabled, + [DisallowNull] PaletteDouble stateNormal, NeedPaintHandler layoutHandler) : base(alignControl, stateCommon, stateDisabled, stateNormal, layoutHandler) { diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonGroupPanel.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonGroupPanel.cs index 4153e3b2f..439723ad6 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonGroupPanel.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonGroupPanel.cs @@ -26,7 +26,7 @@ public class KryptonGroupPanel : KryptonPanel #region Instance Fields private readonly PaletteBackInheritForced _forcedDisabled; private readonly PaletteBackInheritForced _forcedNormal; - private readonly NeedPaintHandler _layoutHandler; + private readonly NeedPaintHandler? _layoutHandler; #endregion #region Events @@ -89,10 +89,10 @@ public class KryptonGroupPanel : KryptonPanel /// Normal appearance state. /// Callback delegate for layout processing. public KryptonGroupPanel(Control alignControl, - PaletteDoubleRedirect? stateCommon, - PaletteDouble? stateDisabled, - PaletteDouble? stateNormal, - NeedPaintHandler layoutHandler) + [DisallowNull] PaletteDoubleRedirect stateCommon, + [DisallowNull] PaletteDouble stateDisabled, + [DisallowNull] PaletteDouble stateNormal, + NeedPaintHandler? layoutHandler) : base(stateCommon, stateDisabled, stateNormal) { // Remember the delegate used to notify layouts diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonHeader.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonHeader.cs index 8a740bba2..8c9c3a96b 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonHeader.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonHeader.cs @@ -350,10 +350,7 @@ public HeaderStyle HeaderStyle } } - private void ResetHeaderStyle() - { - HeaderStyle = HeaderStyle.Primary; - } + private void ResetHeaderStyle() => HeaderStyle = HeaderStyle.Primary; private bool ShouldSerializeHeaderStyle() => HeaderStyle != HeaderStyle.Primary; @@ -401,11 +398,9 @@ private void ResetHeaderStyle() /// Fix the control to a particular palette state. /// /// Palette state to fix. - public virtual void SetFixedState(PaletteState state) - { + public virtual void SetFixedState(PaletteState state) => // Request fixed state from the view _drawDocker.FixedState = state; - } /// /// Gets access to the ToolTipManager used for displaying tool tips. @@ -547,9 +542,9 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e) if (!DesignMode) { IContentValues sourceContent = null; - LabelStyle toolTipStyle = LabelStyle.ToolTip; + var toolTipStyle = LabelStyle.ToolTip; - bool shadow = true; + var shadow = true; // Find the button spec associated with the tooltip request ButtonSpec buttonSpec = _buttonManager.ButtonSpecFromView(e.Target); @@ -606,7 +601,7 @@ private void OnCancelToolTip(object sender, EventArgs e) => private void OnVisualPopupToolTipDisposed(object sender, EventArgs e) { // Unhook events from the specific instance that generated event - VisualPopupToolTip popupToolTip = (VisualPopupToolTip)sender; + var popupToolTip = (VisualPopupToolTip)sender; popupToolTip.Disposed -= OnVisualPopupToolTipDisposed; // Not showing a popup page any more diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonHeaderGroup.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonHeaderGroup.cs index 8c8db2d6f..b0952287e 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonHeaderGroup.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonHeaderGroup.cs @@ -58,8 +58,8 @@ public HeaderGroupButtonSpecCollection(KryptonHeaderGroup owner) private readonly ViewDrawContent _drawContent2; private readonly ViewLayoutFill _layoutFill; private readonly ButtonSpecManagerDraw _buttonManager; - private VisualPopupToolTip _visualPopupToolTip; - private ScreenObscurer _obscurer; + private VisualPopupToolTip? _visualPopupToolTip; + private ScreenObscurer? _obscurer; private readonly EventHandler? _removeObscurer; private bool _forcedLayout; private bool _visiblePrimary; @@ -117,7 +117,7 @@ public KryptonHeaderGroup() StateNormal = new PaletteHeaderGroup(StateCommon, StateCommon.HeaderPrimary, StateCommon.HeaderSecondary, NeedPaintDelegate); // Create the internal panel used for containing content - Panel = new KryptonGroupPanel(this, StateCommon, StateDisabled, StateNormal, OnGroupPanelPaint) + Panel = new KryptonGroupPanel(this, StateCommon, StateDisabled, StateNormal, OnGroupPanelPaint!) { // Make sure the panel back style always mimics our back style @@ -151,7 +151,7 @@ public KryptonHeaderGroup() PaletteMetricBool.HeaderGroupOverlay) { - // Layout child view ontop of the border space + // Layout child view on top of the border space IgnoreBorderSpace = true, // Prevent adjacent headers from having two borders @@ -218,13 +218,13 @@ protected override void Dispose(bool disposing) if (disposing) { // Remove any cached obscurer - if (_obscurer != null) + if (_obscurer != null!) { try { _obscurer.Uncover(); _obscurer.Dispose(); - _obscurer = null; + _obscurer = null!; } catch { @@ -401,7 +401,7 @@ public bool UseMnemonic [Category(@"Appearance")] [Description(@"The internal panel that contains group content.")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] - public KryptonGroupPanel Panel { get; } + public KryptonGroupPanel? Panel { get; } /// /// Gets or sets a value indicating if collapsed mode is auto toggled by arrow button specs. @@ -681,7 +681,7 @@ public bool HeaderVisibleSecondary [Category(@"Visuals")] [Description(@"Overrides for defining common header group appearance that other states can override.")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] - public PaletteHeaderGroupRedirect? StateCommon { get; } + public PaletteHeaderGroupRedirect StateCommon { get; } private bool ShouldSerializeStateCommon() => !StateCommon.IsDefault; @@ -691,7 +691,7 @@ public bool HeaderVisibleSecondary [Category(@"Visuals")] [Description(@"Overrides for defining disabled header group appearance.")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] - public PaletteHeaderGroup? StateDisabled { get; } + public PaletteHeaderGroup StateDisabled { get; } private bool ShouldSerializeStateDisabled() => !StateDisabled.IsDefault; @@ -701,7 +701,7 @@ public bool HeaderVisibleSecondary [Category(@"Visuals")] [Description(@"Overrides for defining normal header group appearance.")] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] - public PaletteHeaderGroup? StateNormal { get; } + public PaletteHeaderGroup StateNormal { get; } private bool ShouldSerializeStateNormal() => !StateNormal.IsDefault; @@ -817,7 +817,7 @@ public bool DesignerGetHitTest(Point pt) } // Check if any of the button specs want the point - return (_buttonManager != null) && _buttonManager.DesignerGetHitTest(pt); + return _buttonManager.DesignerGetHitTest(pt); } /// @@ -826,9 +826,9 @@ public bool DesignerGetHitTest(Point pt) /// Mouse location. [EditorBrowsable(EditorBrowsableState.Never)] [Browsable(false)] - public Component DesignerComponentFromPoint(Point pt) => + public Component? DesignerComponentFromPoint(Point pt) => // Ignore call as view builder is already destructed - IsDisposed ? null : ViewManager.ComponentFromPoint(pt); + IsDisposed ? null : ViewManager?.ComponentFromPoint(pt); // Ask the current view for a decision /// @@ -925,14 +925,17 @@ protected override void OnLayout(LayoutEventArgs levent) // Only use layout logic if control is fully initialized or if being forced // to allow a relayout or if in design mode. - if (IsInitialized || _forcedLayout || (DesignMode && (Panel != null))) + if (Panel != null) { - Rectangle fillRect = _layoutFill.FillRect; + if (IsInitialized || _forcedLayout || DesignMode ) + { + Rectangle fillRect = _layoutFill.FillRect; - Panel.SetBounds(fillRect.X, - fillRect.Y, - fillRect.Width, - fillRect.Height); + Panel.SetBounds(fillRect.X, + fillRect.Y, + fillRect.Width, + fillRect.Height); + } } } @@ -1123,12 +1126,12 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e) if (!DesignMode) { IContentValues? sourceContent = null; - LabelStyle toolTipStyle = LabelStyle.ToolTip; + var toolTipStyle = LabelStyle.ToolTip; - bool shadow = true; + var shadow = true; // Find the button spec associated with the tooltip request - ButtonSpec buttonSpec = _buttonManager.ButtonSpecFromView(e.Target); + ButtonSpec? buttonSpec = _buttonManager.ButtonSpecFromView(e.Target); // If the tooltip is for a button spec if (buttonSpec != null) @@ -1181,7 +1184,7 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e) private void OnVisualPopupToolTipDisposed(object sender, EventArgs e) { // Unhook events from the specific instance that generated event - VisualPopupToolTip popupToolTip = (VisualPopupToolTip)sender; + var popupToolTip = (VisualPopupToolTip)sender; popupToolTip.Disposed -= OnVisualPopupToolTipDisposed; // Not showing a popup page any more @@ -1200,7 +1203,7 @@ private void OnButtonSpecClicked(object sender, EventArgs e) if (AutoCollapseArrow) { // Cast to correct type - ButtonSpecHeaderGroup buttonSpec = (ButtonSpecHeaderGroup)sender; + var buttonSpec = (ButtonSpecHeaderGroup)sender; // Action depends on the arrow switch (buttonSpec.Type) @@ -1396,7 +1399,7 @@ private static int PaddingEdgeNeeded(int padding, int client) else { // Then we need only the extra space between the client and the - // padding edge, as the rest is overlaped by the children + // padding edge, as the rest is overlapped by the children return padding - client; } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonHelpCommand.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonHelpCommand.cs index ce23977a2..f7ee72305 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonHelpCommand.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonHelpCommand.cs @@ -37,7 +37,6 @@ public class KryptonHelpCommand : KryptonCommand /// Gets or sets the help button. /// The help button. [DefaultValue(null), Description(@"Access to the help button spec.")] - [AllowNull] public ButtonSpecAny? HelpButton { get => _helpButtonSpec ?? new ButtonSpecAny(); @@ -904,10 +903,7 @@ private void UpdateImageStates(PaletteMode mode) #region Overrides - protected override void OnPropertyChanged(PropertyChangedEventArgs e) - { - base.OnPropertyChanged(e); - } + protected override void OnPropertyChanged(PropertyChangedEventArgs e) => base.OnPropertyChanged(e); #endregion } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonLabel.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonLabel.cs index 989c588dd..f2f146fbc 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonLabel.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonLabel.cs @@ -182,10 +182,7 @@ public virtual VisualOrientation Orientation private bool ShouldSerializeOrientation() => _orientation != VisualOrientation.Top; - private void ResetOrientation() - { - _orientation = VisualOrientation.Top; - } + private void ResetOrientation() => _orientation = VisualOrientation.Top; /// /// Gets and sets the label style. @@ -326,11 +323,9 @@ public virtual KryptonCommand? KryptonCommand /// Fix the control to a particular palette state. /// /// Palette state to fix. - public virtual void SetFixedState(PaletteState state) - { + public virtual void SetFixedState(PaletteState state) => // Request fixed state from the view _drawContent.FixedState = state; - } #endregion #region IContentValues diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonLinkLabel.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonLinkLabel.cs index f38ec5847..a3c4910dc 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonLinkLabel.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonLinkLabel.cs @@ -113,10 +113,7 @@ public KryptonLinkBehavior LinkBehavior } } - private void ResetLinkBehavior() - { - LinkBehavior = KryptonLinkBehavior.AlwaysUnderline; - } + private void ResetLinkBehavior() => LinkBehavior = KryptonLinkBehavior.AlwaysUnderline; private bool ShouldSerializeLinkBehavior() => LinkBehavior != KryptonLinkBehavior.AlwaysUnderline; diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonLinkWrapLabel.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonLinkWrapLabel.cs index f0f5cbcc3..077c4b9a6 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonLinkWrapLabel.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonLinkWrapLabel.cs @@ -438,7 +438,7 @@ public void UpdateFont() Font? font; Color textColor; PaletteTextHint hint; - PaletteState ps = PaletteState.Normal; + var ps = PaletteState.Normal; // Get values from correct enabled/disabled state if (Enabled) @@ -539,7 +539,7 @@ protected override void OnPaint(PaintEventArgs e) Font? font; Color textColor; PaletteTextHint hint; - PaletteState ps = PaletteState.Normal; + var ps = PaletteState.Normal; // Get values from correct enabled/disabled state if (Enabled) @@ -852,13 +852,11 @@ private void OnContextMenuStripOpening(object sender, CancelEventArgs e) } } - private void OnKryptonContextMenuDisposed(object sender, EventArgs e) - { + private void OnKryptonContextMenuDisposed(object sender, EventArgs e) => // When the current krypton context menu is disposed, we should remove // it to prevent it being used again, as that would just throw an exception // because it has been disposed. KryptonContextMenu = null; - } private void OnContextMenuClosed(object sender, ToolStripDropDownClosedEventArgs e) => ContextMenuClosed(); diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonListBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonListBox.cs index 4fc3b329d..a47dc1389 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonListBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonListBox.cs @@ -258,7 +258,7 @@ private void WmPaint(ref Message m) var ps = new PI.PAINTSTRUCT(); // Do we need to BeginPaint or just take the given HDC? - IntPtr hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; + var hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; // Create bitmap that all drawing occurs onto, then we can blit it later to remove flicker Rectangle realRect = CommonHelper.RealClientRectangle(Handle); @@ -266,7 +266,7 @@ private void WmPaint(ref Message m) // No point drawing when one of the dimensions is zero if (realRect is { Width: > 0, Height: > 0 }) { - IntPtr hBitmap = PI.CreateCompatibleBitmap(hdc, realRect.Width, realRect.Height); + var hBitmap = PI.CreateCompatibleBitmap(hdc, realRect.Width, realRect.Height); // If we managed to get a compatible bitmap if (hBitmap != IntPtr.Zero) @@ -294,7 +294,7 @@ private void WmPaint(ref Message m) } // Replace given DC with the screen DC for base window proc drawing - IntPtr beforeDC = m.WParam; + var beforeDC = m.WParam; m.WParam = _screenDC; DefWndProc(ref m); m.WParam = beforeDC; @@ -1578,7 +1578,7 @@ private void OnListBoxDrawItem(object sender, DrawItemEventArgs e) UpdateContentFromItemIndex(e.Index); // By default the button is in the normal state - PaletteState buttonState = PaletteState.Normal; + var buttonState = PaletteState.Normal; // Is this item disabled if ((e.State & DrawItemState.Disabled) == DrawItemState.Disabled) @@ -1622,12 +1622,12 @@ private void OnListBoxDrawItem(object sender, DrawItemEventArgs e) _drawButton.ElementState = buttonState; // Grab the raw device context for the graphics instance - IntPtr hdc = e.Graphics.GetHdc(); + var hdc = e.Graphics.GetHdc(); try { // Create bitmap that all drawing occurs onto, then we can blit it later to remove flicker - IntPtr hBitmap = PI.CreateCompatibleBitmap(hdc, e.Bounds.Right, e.Bounds.Bottom); + var hBitmap = PI.CreateCompatibleBitmap(hdc, e.Bounds.Right, e.Bounds.Bottom); // If we managed to get a compatible bitmap if (hBitmap != IntPtr.Zero) diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonListView.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonListView.cs index 47551535c..4c34efab1 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonListView.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonListView.cs @@ -555,7 +555,7 @@ protected override void OnDrawItem(DrawListViewItemEventArgs e) _drawButton.ElementState = buttonState; // Grab the raw device context for the graphics instance - IntPtr hdc = e.Graphics.GetHdc(); + var hdc = e.Graphics.GetHdc(); try { @@ -578,7 +578,7 @@ protected override void OnDrawItem(DrawListViewItemEventArgs e) } // Create bitmap that all drawing occurs onto, then we can blit it later to remove flicker - IntPtr hBitmap = PI.CreateCompatibleBitmap(hdc, bounds.Right, bounds.Bottom); + var hBitmap = PI.CreateCompatibleBitmap(hdc, bounds.Right, bounds.Bottom); // If we managed to get a compatible bitmap if (hBitmap != IntPtr.Zero) @@ -840,10 +840,7 @@ public PaletteBackStyle BackStyle } } - private void ResetBackStyle() - { - BackStyle = PaletteBackStyle.InputControlStandalone; - } + private void ResetBackStyle() => BackStyle = PaletteBackStyle.InputControlStandalone; private bool ShouldSerializeBackStyle() => BackStyle != PaletteBackStyle.InputControlStandalone; @@ -866,10 +863,7 @@ private void ResetBackStyle() } } - private void ResetBorderStyle() - { - BorderStyle = PaletteBorderStyle.InputControlStandalone; - } + private void ResetBorderStyle() => BorderStyle = PaletteBorderStyle.InputControlStandalone; private bool ShouldSerializeBorderStyle() => BorderStyle != PaletteBorderStyle.InputControlStandalone; @@ -1074,10 +1068,7 @@ public PaletteMode PaletteMode /// /// Resets the PaletteMode property to its default value. /// - public void ResetPaletteMode() - { - PaletteMode = PaletteMode.Global; - } + public void ResetPaletteMode() => PaletteMode = PaletteMode.Global; private void OnGlobalPaletteChanged(object sender, EventArgs e) { @@ -1230,13 +1221,11 @@ private void OnContextMenuStripOpening(object sender, CancelEventArgs e) cms.Renderer = Renderer.RenderToolStrip(_palette); } - private void OnKryptonContextMenuDisposed(object sender, EventArgs e) - { + private void OnKryptonContextMenuDisposed(object sender, EventArgs e) => // When the current krypton context menu is disposed, we should remove // it to prevent it being used again, as that would just throw an exception // because it has been disposed. KryptonContextMenu = null; - } private void OnContextMenuClosed(object sender, ToolStripDropDownClosedEventArgs e) => ContextMenuClosed(); diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMaskedTextBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMaskedTextBox.cs index f5c57157e..14a04103a 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMaskedTextBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMaskedTextBox.cs @@ -155,7 +155,7 @@ protected override void WndProc(ref Message m) var ps = new PI.PAINTSTRUCT(); // Do we need to BeginPaint or just take the given HDC? - IntPtr hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; + var hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; // Paint the entire area in the background color using (Graphics g = Graphics.FromHdc(hdc)) @@ -570,10 +570,7 @@ public string? Hint /// /// - public void ResetHint() - { - Hint = string.Empty; - } + public void ResetHint() => Hint = string.Empty; /// /// Overridden. Returns a string that represents the current masked text box. This method overrides ToString. @@ -1132,10 +1129,7 @@ public InputControlStyle InputControlStyle private bool ShouldSerializeInputControlStyle() => InputControlStyle != InputControlStyle.Standalone; - private void ResetInputControlStyle() - { - InputControlStyle = InputControlStyle.Standalone; - } + private void ResetInputControlStyle() => InputControlStyle = InputControlStyle.Standalone; /// /// Gets and sets a value indicating if tooltips should be Displayed for button specs. @@ -1269,10 +1263,7 @@ private void ResetInputControlStyle() /// Sets the fixed state of the control. /// /// Should the control be fixed as active. - public void SetFixedState(bool active) - { - _fixedActive = active; - } + public void SetFixedState(bool active) => _fixedActive = active; /// /// Converts the user input string to an instance of the validating type. @@ -1369,10 +1360,7 @@ public override Rectangle DisplayRectangle /// Override the display padding for the layout fill. /// /// Display padding value. - public void SetLayoutDisplayPadding(Padding padding) - { - _layoutFill.DisplayPadding = padding; - } + public void SetLayoutDisplayPadding(Padding padding) => _layoutFill.DisplayPadding = padding; /// /// Internal design time method. @@ -1880,9 +1868,9 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e) if (!DesignMode) { IContentValues? sourceContent = null; - LabelStyle toolTipStyle = LabelStyle.ToolTip; + var toolTipStyle = LabelStyle.ToolTip; - bool shadow = true; + var shadow = true; // Find the button spec associated with the tooltip request ButtonSpec? buttonSpec = _buttonManager.ButtonSpecFromView(e.Target); @@ -1942,7 +1930,7 @@ private void OnCancelToolTip(object sender, EventArgs e) private void OnVisualPopupToolTipDisposed(object sender, EventArgs e) { // Unhook events from the specific instance that generated event - VisualPopupToolTip popupToolTip = (VisualPopupToolTip)sender; + var popupToolTip = (VisualPopupToolTip)sender; popupToolTip.Disposed -= OnVisualPopupToolTipDisposed; // Not showing a popup page any more diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMonthCalendar.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMonthCalendar.cs index 36d8ca3e2..da1af5477 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMonthCalendar.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonMonthCalendar.cs @@ -1449,14 +1449,11 @@ protected override bool IsInputChar(char charCode) => /// /// One of the Keys values. /// true if the specified key is a regular input key; otherwise, false. - protected override bool IsInputKey(Keys keyData) + protected override bool IsInputKey(Keys keyData) => (keyData & ~Keys.Shift) switch { - return (keyData & ~Keys.Shift) switch - { - Keys.Left or Keys.Right or Keys.Up or Keys.Down => true, - _ => base.IsInputKey(keyData) - }; - } + Keys.Left or Keys.Right or Keys.Up or Keys.Down => true, + _ => base.IsInputKey(keyData) + }; /// /// Raises the KeyDown event. diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonNumericUpDown.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonNumericUpDown.cs index 9ad39ac46..e0806604b 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonNumericUpDown.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonNumericUpDown.cs @@ -66,10 +66,7 @@ public InternalNumericUpDown(KryptonNumericUpDown kryptonNumericUpDown) BorderStyle = BorderStyle.None; } - public void SetChangingText(bool value) - { - ChangingText = value; - } + public void SetChangingText(bool value) => ChangingText = value; #endregion @@ -347,7 +344,7 @@ protected override void WndProc(ref Message m) var ps = new PI.PAINTSTRUCT(); // Do we need to BeginPaint or just take the given HDC? - IntPtr hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; + var hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; // Paint the entire area in the background color using (Graphics g = Graphics.FromHdc(hdc)) @@ -563,7 +560,7 @@ protected override void WndProc(ref Message m) var ps = new PI.PAINTSTRUCT(); // Do we need to BeginPaint or just take the given HDC? - IntPtr hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; + var hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; // Grab the client area of the control PI.GetClientRect(Handle, out PI.RECT rect); @@ -573,7 +570,7 @@ protected override void WndProc(ref Message m) try { // Create bitmap that all drawing occurs onto, then we can blit it later to remove flicker - IntPtr hBitmap = PI.CreateCompatibleBitmap(hdc, clientRect.Right, clientRect.Bottom); + var hBitmap = PI.CreateCompatibleBitmap(hdc, clientRect.Right, clientRect.Bottom); // If we managed to get a compatible bitmap if (hBitmap != IntPtr.Zero) @@ -2080,9 +2077,9 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e) if (!DesignMode) { IContentValues? sourceContent = null; - LabelStyle toolTipStyle = LabelStyle.ToolTip; + var toolTipStyle = LabelStyle.ToolTip; - bool shadow = true; + var shadow = true; // Find the button spec associated with the tooltip request ButtonSpec? buttonSpec = _buttonManager.ButtonSpecFromView(e.Target); @@ -2139,7 +2136,7 @@ private void OnCancelToolTip(object sender, EventArgs e) => private void OnVisualPopupToolTipDisposed(object sender, EventArgs e) { // Unhook events from the specific instance that generated event - VisualPopupToolTip popupToolTip = (VisualPopupToolTip)sender; + var popupToolTip = (VisualPopupToolTip)sender; popupToolTip.Disposed -= OnVisualPopupToolTipDisposed; // Not showing a popup page any more diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonOpenFileDialog.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonOpenFileDialog.cs index 25781cb0b..9d1bcc244 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonOpenFileDialog.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonOpenFileDialog.cs @@ -182,10 +182,7 @@ public override event CancelEventHandler? FileOk } /// Resets all properties to their default values. - public override void Reset() - { - _internalOpenFileDialog.Reset(); - } + public override void Reset() => _internalOpenFileDialog.Reset(); /// public override string ToString() => _internalOpenFileDialog.ToString(); @@ -206,10 +203,7 @@ public override void Reset() public string[] SafeFileNames => _internalOpenFileDialog.SafeFileNames; /// - public void Dispose() - { - _internalOpenFileDialog.Dispose(); - } + public void Dispose() => _internalOpenFileDialog.Dispose(); } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonPanel.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonPanel.cs index 0c1e970a1..7c160024d 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonPanel.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonPanel.cs @@ -95,10 +95,7 @@ public PaletteBackStyle PanelBackStyle private bool ShouldSerializePanelBackStyle() => PanelBackStyle != PaletteBackStyle.PanelClient; - private void ResetPanelBackStyle() - { - PanelBackStyle = PaletteBackStyle.PanelClient; - } + private void ResetPanelBackStyle() => PanelBackStyle = PaletteBackStyle.PanelClient; /// /// Gets access to the common panel appearance that other states can override. @@ -134,11 +131,9 @@ private void ResetPanelBackStyle() /// Fix the control to a particular palette state. /// /// Palette state to fix. - public virtual void SetFixedState(PaletteState state) - { + public virtual void SetFixedState(PaletteState state) => // Request fixed state from the view ViewDrawPanel.FixedState = state; - } #endregion #region Protected diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonPrintDialog.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonPrintDialog.cs index 5e58ae100..f43106f94 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonPrintDialog.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonPrintDialog.cs @@ -287,7 +287,7 @@ public PrinterSettings PrinterSettings private PD GetFlags() { - PD flags = PD.ALLPAGES; + var flags = PD.ALLPAGES; // Only set this flag when using PRINTDLG and PrintDlg, // and not when using PrintDlgEx and PRINTDLGEX. diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonRadioButton.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonRadioButton.cs index 7ae987555..ad309bafc 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonRadioButton.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonRadioButton.cs @@ -294,10 +294,7 @@ public LabelStyle LabelStyle } } - private void ResetLabelStyle() - { - LabelStyle = LabelStyle.NormalPanel; - } + private void ResetLabelStyle() => LabelStyle = LabelStyle.NormalPanel; private bool ShouldSerializeLabelStyle() => LabelStyle != LabelStyle.NormalPanel; @@ -555,10 +552,7 @@ protected override void OnClick(EventArgs e) /// Update the view elements based on the requested label style. /// /// New label style. - protected virtual void SetLabelStyle(LabelStyle style) - { - _paletteCommonRedirect.Style = CommonHelper.ContentStyleFromLabelStyle(style); - } + protected virtual void SetLabelStyle(LabelStyle style) => _paletteCommonRedirect.Style = CommonHelper.ContentStyleFromLabelStyle(style); /// /// Processes a mnemonic character. diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonRichTextBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonRichTextBox.cs index c3bb9d2a4..cfab27c24 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonRichTextBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonRichTextBox.cs @@ -121,7 +121,7 @@ public int Print(int charFrom, int charTo, Graphics gr, Rectangle bounds) rectPage.left = 0; rectPage.right = (int)(gr.ClipBounds.Right * AN_INCH); - IntPtr hdc = gr.GetHdc(); + var hdc = gr.GetHdc(); PI.FORMATRANGE fmtRange; fmtRange.chrg.cpMax = charTo; @@ -134,11 +134,11 @@ public int Print(int charFrom, int charTo, Graphics gr, Rectangle bounds) var wparam = new IntPtr(1); //Get the pointer to the FORMATRANGE structure in memory - IntPtr lparam = Marshal.AllocCoTaskMem(Marshal.SizeOf(fmtRange)); + var lparam = Marshal.AllocCoTaskMem(Marshal.SizeOf(fmtRange)); Marshal.StructureToPtr(fmtRange, lparam, false); //Send the rendered data for printing - IntPtr res = (IntPtr)PI.SendMessage(Handle, PI.EM_FORMATRANGE, wparam, lparam); + var res = (IntPtr)PI.SendMessage(Handle, PI.EM_FORMATRANGE, wparam, lparam); //Free the block of memory allocated Marshal.FreeCoTaskMem(lparam); @@ -222,7 +222,7 @@ protected override void WndProc(ref Message m) { var ps = new PI.PAINTSTRUCT(); // Do we need to BeginPaint or just take the given HDC? - IntPtr hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; + var hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; using (Graphics g = Graphics.FromHdc(hdc)) { // Grab the client area of the control @@ -1315,10 +1315,7 @@ public InputControlStyle InputControlStyle private bool ShouldSerializeInputControlStyle() => InputControlStyle != InputControlStyle.Standalone; - private void ResetInputControlStyle() - { - InputControlStyle = InputControlStyle.Standalone; - } + private void ResetInputControlStyle() => InputControlStyle = InputControlStyle.Standalone; /// /// Gets and sets a value indicating if tooltips should be Displayed for button specs. @@ -1603,10 +1600,7 @@ private void ResetInputControlStyle() /// Sets the fixed state of the control. /// /// Should the control be fixed as active. - public void SetFixedState(bool active) - { - _fixedActive = active; - } + public void SetFixedState(bool active) => _fixedActive = active; /// /// Gets access to the ToolTipManager used for displaying tool tips. @@ -1707,10 +1701,7 @@ public override Rectangle DisplayRectangle /// Override the display padding for the layout fill. /// /// Display padding value. - public void SetLayoutDisplayPadding(Padding padding) - { - _layoutFill.DisplayPadding = padding; - } + public void SetLayoutDisplayPadding(Padding padding) => _layoutFill.DisplayPadding = padding; /// /// Internal design time method. @@ -2226,9 +2217,9 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e) if (!DesignMode) { IContentValues? sourceContent = null; - LabelStyle toolTipStyle = LabelStyle.ToolTip; + var toolTipStyle = LabelStyle.ToolTip; - bool shadow = true; + var shadow = true; // Find the button spec associated with the tooltip request ButtonSpec? buttonSpec = _buttonManager.ButtonSpecFromView(e.Target); @@ -2285,7 +2276,7 @@ private void OnCancelToolTip(object sender, EventArgs e) => private void OnVisualPopupToolTipDisposed(object sender, EventArgs e) { // Unhook events from the specific instance that generated event - VisualPopupToolTip popupToolTip = (VisualPopupToolTip)sender; + var popupToolTip = (VisualPopupToolTip)sender; popupToolTip.Disposed -= OnVisualPopupToolTipDisposed; // Not showing a popup page any more diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonSaveFileDialog.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonSaveFileDialog.cs index fc5242fb5..4cb49b1a2 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonSaveFileDialog.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonSaveFileDialog.cs @@ -200,10 +200,7 @@ public override event CancelEventHandler? FileOk } /// Resets all properties to their default values. - public override void Reset() - { - _internalSaveFileDialog.Reset(); - } + public override void Reset() => _internalSaveFileDialog.Reset(); /// public override string ToString() => _internalSaveFileDialog.ToString(); @@ -212,10 +209,7 @@ public override void Reset() public override FileDialogCustomPlacesCollection CustomPlaces => _internalSaveFileDialog.CustomPlaces; /// - public void Dispose() - { - _internalSaveFileDialog.Dispose(); - } + public void Dispose() => _internalSaveFileDialog.Dispose(); } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonScrollBar.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonScrollBar.cs index bfdb3194c..633240e40 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonScrollBar.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonScrollBar.cs @@ -920,8 +920,8 @@ protected override bool ProcessDialogKey(Keys keyData) { // key handling is here - keys recognized by the control // Up&Down or Left&Right, PageUp, PageDown, Home, End - Keys keyUp = Keys.Up; - Keys keyDown = Keys.Down; + var keyUp = Keys.Up; + var keyDown = Keys.Down; if (_orientation == ScrollBarOrientation.Horizontal) { @@ -1292,7 +1292,7 @@ private void ChangeThumbPosition(int position) private void ProgressThumb(bool enableTimer) { var scrollOldValue = _value; - ScrollEventType type = ScrollEventType.First; + var type = ScrollEventType.First; int thumbSize, thumbPos; if (_orientation == ScrollBarOrientation.Vertical) @@ -1568,60 +1568,42 @@ private void ScrollHereClick(object sender, EventArgs e) /// /// The sender. /// The event arguments. - private void TopClick(object sender, EventArgs e) - { - Value = _minimum; - } + private void TopClick(object sender, EventArgs e) => Value = _minimum; /// /// Context menu handler. /// /// The sender. /// The event arguments. - private void BottomClick(object sender, EventArgs e) - { - Value = _maximum; - } + private void BottomClick(object sender, EventArgs e) => Value = _maximum; /// /// Context menu handler. /// /// The sender. /// The event arguments. - private void LargeUpClick(object sender, EventArgs e) - { - Value = GetValue(false, true); - } + private void LargeUpClick(object sender, EventArgs e) => Value = GetValue(false, true); /// /// Context menu handler. /// /// The sender. /// The event arguments. - private void LargeDownClick(object sender, EventArgs e) - { - Value = GetValue(false, false); - } + private void LargeDownClick(object sender, EventArgs e) => Value = GetValue(false, false); /// /// Context menu handler. /// /// The sender. /// The event arguments. - private void SmallUpClick(object sender, EventArgs e) - { - Value = GetValue(true, true); - } + private void SmallUpClick(object sender, EventArgs e) => Value = GetValue(true, true); /// /// Context menu handler. /// /// The sender. /// The event arguments. - private void SmallDownClick(object sender, EventArgs e) - { - Value = GetValue(true, false); - } + private void SmallDownClick(object sender, EventArgs e) => Value = GetValue(true, false); #endregion diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonSeparator.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonSeparator.cs index ad9f27e7f..4f02b324b 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonSeparator.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonSeparator.cs @@ -263,10 +263,7 @@ public PaletteBackStyle ContainerBackStyle private bool ShouldSerializeContainerBackStyle() => ContainerBackStyle != PaletteBackStyle.PanelClient; - private void ResetContainerBackStyle() - { - ContainerBackStyle = PaletteBackStyle.PanelClient; - } + private void ResetContainerBackStyle() => ContainerBackStyle = PaletteBackStyle.PanelClient; /// /// Gets and sets the separator style. @@ -291,10 +288,7 @@ public SeparatorStyle SeparatorStyle private bool ShouldSerializeSeparatorStyle() => SeparatorStyle != SeparatorStyle.HighProfile; - private void ResetSeparatorStyle() - { - SeparatorStyle = SeparatorStyle.HighProfile; - } + private void ResetSeparatorStyle() => SeparatorStyle = SeparatorStyle.HighProfile; /// /// Gets access to the common separator appearance that other states can override. diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonSplitContainer.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonSplitContainer.cs index 64b5bc429..8533450d5 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonSplitContainer.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonSplitContainer.cs @@ -215,10 +215,7 @@ public PaletteBackStyle ContainerBackStyle private bool ShouldSerializeContainerBackStyle() => ContainerBackStyle != PaletteBackStyle.PanelClient; - private void ResetContainerBackStyle() - { - ContainerBackStyle = PaletteBackStyle.PanelClient; - } + private void ResetContainerBackStyle() => ContainerBackStyle = PaletteBackStyle.PanelClient; /// /// Gets and sets the separator style. @@ -243,10 +240,7 @@ public SeparatorStyle SeparatorStyle private bool ShouldSerializeSeparatorStyle() => SeparatorStyle != SeparatorStyle.LowProfile; - private void ResetSeparatorStyle() - { - SeparatorStyle = SeparatorStyle.LowProfile; - } + private void ResetSeparatorStyle() => SeparatorStyle = SeparatorStyle.LowProfile; /// /// Gets access to the common split container appearance that other states can override. @@ -1169,7 +1163,7 @@ protected override void OnPaint(PaintEventArgs e) /// A LayoutEventArgs that contains the event data. protected override void OnLayout(LayoutEventArgs levent) { - Rectangle separatorRect = Rectangle.Empty; + var separatorRect = Rectangle.Empty; // Only use layout logic if control is fully initialized or if being forced // to allow a relayout or if in design mode. diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTableLayoutPanel.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTableLayoutPanel.cs index d17322bfc..8fbbd8a5a 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTableLayoutPanel.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTableLayoutPanel.cs @@ -158,10 +158,7 @@ public PaletteMode PaletteMode /// /// Resets the PaletteMode property to its default value. /// - public void ResetPaletteMode() - { - PaletteMode = PaletteMode.Global; - } + public void ResetPaletteMode() => PaletteMode = PaletteMode.Global; /// /// Gets and sets the custom palette implementation. @@ -197,10 +194,7 @@ public PaletteBackStyle PanelBackStyle private bool ShouldSerializePanelBackStyle() => PanelBackStyle != PaletteBackStyle.PanelClient; - private void ResetPanelBackStyle() - { - PanelBackStyle = PaletteBackStyle.PanelClient; - } + private void ResetPanelBackStyle() => PanelBackStyle = PaletteBackStyle.PanelClient; /// /// Gets access to the common panel appearance that other states can override. diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTaskDialog.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTaskDialog.cs index 033787376..f05c5b963 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTaskDialog.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTaskDialog.cs @@ -457,10 +457,7 @@ public string TextExtra } } - private void ResetTag() - { - Tag = null; - } + private void ResetTag() => Tag = null; private bool ShouldSerializeTag() => Tag != null; diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTaskDialogCommand.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTaskDialogCommand.cs index f78d86f71..d14b815d5 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTaskDialogCommand.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTaskDialogCommand.cs @@ -142,10 +142,7 @@ public string Text } } - private void ResetText() - { - Text = string.Empty; - } + private void ResetText() => Text = string.Empty; private bool ShouldSerializeText() => !string.IsNullOrEmpty(Text); @@ -171,10 +168,7 @@ public string ExtraText } } - private void ResetExtraText() - { - ExtraText = string.Empty; - } + private void ResetExtraText() => ExtraText = string.Empty; private bool ShouldSerializeExtraText() => !string.IsNullOrEmpty(ExtraText); @@ -199,10 +193,7 @@ public Image? Image } } - private void ResetImage() - { - Image = null; - } + private void ResetImage() => Image = null; private bool ShouldSerializeImage() => Image != null; diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTextBox.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTextBox.cs index 4a5dd6f9c..c960172a6 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTextBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTextBox.cs @@ -136,7 +136,7 @@ protected override void WndProc(ref Message m) var ps = new PI.PAINTSTRUCT(); // Do we need to BeginPaint or just take the given HDC? - IntPtr hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; + var hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; // Paint the entire area in the background color using Graphics g = Graphics.FromHdc(hdc); @@ -287,19 +287,13 @@ protected override void WndProc(ref Message m) /// Raises the TrackMouseEnter event. /// /// An EventArgs containing the event data. - protected virtual void OnTrackMouseEnter(EventArgs e) - { - TrackMouseEnter?.Invoke(this, e); - } + protected virtual void OnTrackMouseEnter(EventArgs e) => TrackMouseEnter?.Invoke(this, e); /// /// Raises the TrackMouseLeave event. /// /// An EventArgs containing the event data. - protected virtual void OnTrackMouseLeave(EventArgs e) - { - TrackMouseLeave?.Invoke(this, e); - } + protected virtual void OnTrackMouseLeave(EventArgs e) => TrackMouseLeave?.Invoke(this, e); #endregion } @@ -1467,75 +1461,51 @@ protected void SetMultilineStringEditor(bool value) /// Raises the AcceptsTabChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnAcceptsTabChanged(EventArgs e) - { - AcceptsTabChanged?.Invoke(this, e); - } + protected virtual void OnAcceptsTabChanged(EventArgs e) => AcceptsTabChanged?.Invoke(this, e); /// /// Raises the TextAlignChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnTextAlignChanged(EventArgs e) - { - TextAlignChanged?.Invoke(this, e); - } + protected virtual void OnTextAlignChanged(EventArgs e) => TextAlignChanged?.Invoke(this, e); /// /// Raises the HideSelectionChanged event. /// /// An EventArgs that contains the event data. - protected virtual void OnHideSelectionChanged(EventArgs e) - { - HideSelectionChanged?.Invoke(this, e); - } + protected virtual void OnHideSelectionChanged(EventArgs e) => HideSelectionChanged?.Invoke(this, e); /// /// Raises the ModifiedChanged event. /// /// An EventArgs that contains the event data. - protected virtual void OnModifiedChanged(EventArgs e) - { - ModifiedChanged?.Invoke(this, e); - } + protected virtual void OnModifiedChanged(EventArgs e) => ModifiedChanged?.Invoke(this, e); /// /// Raises the MultilineChanged event. /// /// An EventArgs that contains the event data. - protected virtual void OnMultilineChanged(EventArgs e) - { - MultilineChanged?.Invoke(this, e); - } + protected virtual void OnMultilineChanged(EventArgs e) => MultilineChanged?.Invoke(this, e); /// /// Raises the ReadOnlyChanged event. /// /// An EventArgs that contains the event data. - protected virtual void OnReadOnlyChanged(EventArgs e) - { - ReadOnlyChanged?.Invoke(this, e); - } + protected virtual void OnReadOnlyChanged(EventArgs e) => ReadOnlyChanged?.Invoke(this, e); /// /// Raises the TrackMouseEnter event. /// /// An EventArgs containing the event data. [Description(@"Raises the TrackMouseEnter event.")] - protected virtual void OnTrackMouseEnter(EventArgs e) - { - TrackMouseEnter?.Invoke(this, e); - } + protected virtual void OnTrackMouseEnter(EventArgs e) => TrackMouseEnter?.Invoke(this, e); /// /// Raises the TrackMouseLeave event. /// /// An EventArgs containing the event data. [Description(@"Raises the TrackMouseLeave event.")] - protected virtual void OnTrackMouseLeave(EventArgs e) - { - TrackMouseLeave?.Invoke(this, e); - } + protected virtual void OnTrackMouseLeave(EventArgs e) => TrackMouseLeave?.Invoke(this, e); // ReSharper restore VirtualMemberNeverOverridden.Global #endregion @@ -1602,37 +1572,25 @@ protected override void OnGotFocus(EventArgs e) /// Raises the BackColorChanged event. /// /// An EventArgs that contains the event data. - protected override void OnBackColorChanged(EventArgs e) - { - BackColorChanged?.Invoke(this, e); - } + protected override void OnBackColorChanged(EventArgs e) => BackColorChanged?.Invoke(this, e); /// /// Raises the BackgroundImageChanged event. /// /// An EventArgs that contains the event data. - protected override void OnBackgroundImageChanged(EventArgs e) - { - BackgroundImageChanged?.Invoke(this, e); - } + protected override void OnBackgroundImageChanged(EventArgs e) => BackgroundImageChanged?.Invoke(this, e); /// /// Raises the BackgroundImageLayoutChanged event. /// /// An EventArgs that contains the event data. - protected override void OnBackgroundImageLayoutChanged(EventArgs e) - { - BackgroundImageLayoutChanged?.Invoke(this, e); - } + protected override void OnBackgroundImageLayoutChanged(EventArgs e) => BackgroundImageLayoutChanged?.Invoke(this, e); /// /// Raises the ForeColorChanged event. /// /// An EventArgs that contains the event data. - protected override void OnForeColorChanged(EventArgs e) - { - ForeColorChanged?.Invoke(this, e); - } + protected override void OnForeColorChanged(EventArgs e) => ForeColorChanged?.Invoke(this, e); /// /// Raises the Resize event. @@ -1955,9 +1913,9 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e) if (!DesignMode) { IContentValues? sourceContent = null; - LabelStyle toolTipStyle = LabelStyle.ToolTip; + var toolTipStyle = LabelStyle.ToolTip; - bool shadow = true; + var shadow = true; // Find the button spec associated with the tooltip request ButtonSpec? buttonSpec = _buttonManager?.ButtonSpecFromView(e.Target); @@ -2014,15 +1972,12 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e) } // Remove any currently showing tooltip - private void OnCancelToolTip(object sender, EventArgs e) - { - _visualPopupToolTip?.Dispose(); - } + private void OnCancelToolTip(object sender, EventArgs e) => _visualPopupToolTip?.Dispose(); private void OnVisualPopupToolTipDisposed(object sender, EventArgs e) { // Unhook events from the specific instance that generated event - VisualPopupToolTip popupToolTip = (VisualPopupToolTip)sender; + var popupToolTip = (VisualPopupToolTip)sender; popupToolTip.Disposed -= OnVisualPopupToolTipDisposed; // Not showing a popup page any more @@ -2076,7 +2031,7 @@ private void SetIsInAlphaNumericMode(KryptonTextBox owner) private void ToggleEllipsisButtonVisibility(bool visible) { // Setup button - ButtonSpecAny bsaEllipsisButton = new ButtonSpecAny(); + var bsaEllipsisButton = new ButtonSpecAny(); bsaEllipsisButton.Text = @"&..."; diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTrackBar.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTrackBar.cs index f1ef39172..2fdb00443 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTrackBar.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTrackBar.cs @@ -186,10 +186,7 @@ public PaletteBackStyle BackStyle private bool ShouldSerializeBackStyle() => BackStyle != PaletteBackStyle.PanelClient; - private void ResetBackStyle() - { - BackStyle = PaletteBackStyle.PanelClient; - } + private void ResetBackStyle() => BackStyle = PaletteBackStyle.PanelClient; /// /// Gets access to the track bar appearance when it has focus. @@ -557,14 +554,11 @@ protected override void SetBoundsCore(int x, int y, /// /// One of the Keys values. /// true if the specified key is a regular input key; otherwise, false. - protected override bool IsInputKey(Keys keyData) + protected override bool IsInputKey(Keys keyData) => (keyData & ~Keys.Shift) switch { - return (keyData & ~Keys.Shift) switch - { - Keys.Left or Keys.Right or Keys.Up or Keys.Down or Keys.Home or Keys.End or Keys.PageDown or Keys.PageUp => true, - _ => base.IsInputKey(keyData) - }; - } + Keys.Left or Keys.Right or Keys.Up or Keys.Down or Keys.Home or Keys.End or Keys.PageDown or Keys.PageUp => true, + _ => base.IsInputKey(keyData) + }; /// /// Raises the MouseWheel event. diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTreeView.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTreeView.cs index d2f2406d9..eb04185f6 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTreeView.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTreeView.cs @@ -229,7 +229,7 @@ private void WmPaint(ref Message m) var ps = new PI.PAINTSTRUCT(); // Do we need to BeginPaint or just take the given HDC? - IntPtr hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; + var hdc = m.WParam == IntPtr.Zero ? PI.BeginPaint(Handle, ref ps) : m.WParam; // Create bitmap that all drawing occurs onto, then we can blit it later to remove flicker Rectangle realRect = CommonHelper.RealClientRectangle(Handle); @@ -237,7 +237,7 @@ private void WmPaint(ref Message m) // No point drawing when one of the dimensions is zero if (realRect is { Width: > 0, Height: > 0 }) { - IntPtr hBitmap = PI.CreateCompatibleBitmap(hdc, realRect.Width, realRect.Height); + var hBitmap = PI.CreateCompatibleBitmap(hdc, realRect.Width, realRect.Height); // If we managed to get a compatible bitmap if (hBitmap != IntPtr.Zero) @@ -273,7 +273,7 @@ private void WmPaint(ref Message m) } // Replace given DC with the screen DC for base window proc drawing - IntPtr beforeDC = m.WParam; + var beforeDC = m.WParam; m.WParam = _screenDC; DefWndProc(ref m); m.WParam = beforeDC; @@ -566,7 +566,7 @@ public KryptonTreeView() // Create the check box image drawer and place inside element so it is always centered _drawCheckBox = new ViewDrawCheckBox(_redirectImages); - ViewLayoutCenter layoutCheckBox = new ViewLayoutCenter + var layoutCheckBox = new ViewLayoutCenter { _drawCheckBox }; @@ -1895,7 +1895,7 @@ private void UpdateItemHeight() UpdateContentFromNode(null); // Ask the view element to layout in given space, needs this before a render call - using ViewLayoutContext context = new ViewLayoutContext(this, Renderer); + using var context = new ViewLayoutContext(this, Renderer); // For calculating the item height we always assume normal state _drawButton.ElementState = PaletteState.Normal; @@ -2021,7 +2021,7 @@ private void OnTreeViewDrawNode(object sender, DrawTreeNodeEventArgs e) _layoutImageStack.Visible = false; } - KryptonTreeNode kryptonNode = e.Node as KryptonTreeNode; + var kryptonNode = e.Node as KryptonTreeNode; // Work out if we need to draw a state image Image drawStateImage = null; @@ -2110,7 +2110,7 @@ private void OnTreeViewDrawNode(object sender, DrawTreeNodeEventArgs e) _drawButton.ElementState = buttonState; // Grab the raw device context for the graphics instance - IntPtr hdc = e.Graphics.GetHdc(); + var hdc = e.Graphics.GetHdc(); try { @@ -2124,7 +2124,7 @@ private void OnTreeViewDrawNode(object sender, DrawTreeNodeEventArgs e) bounds.Width -= nodeIndent; // Create bitmap that all drawing occurs onto, then we can blit it later to remove flicker - IntPtr hBitmap = PI.CreateCompatibleBitmap(hdc, bounds.Right, bounds.Bottom); + var hBitmap = PI.CreateCompatibleBitmap(hdc, bounds.Right, bounds.Bottom); // If we managed to get a compatible bitmap if (hBitmap != IntPtr.Zero) diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonWebBrowser.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonWebBrowser.cs index 731b34821..fd7a3e097 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonWebBrowser.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonWebBrowser.cs @@ -185,13 +185,11 @@ protected override void WndProc(ref Message m) } - private void OnKryptonContextMenuDisposed(object sender, EventArgs e) - { + private void OnKryptonContextMenuDisposed(object sender, EventArgs e) => // When the current krypton context menu is disposed, we should remove // it to prevent it being used again, as that would just throw an exception // because it has been disposed. KryptonContextMenu = null; - } #endregion MenuStrip Overrides @@ -228,11 +226,9 @@ private void SetPalette(PaletteBase? palette) /// Called when there is a change in base renderer or base palette. /// The sender. /// The instance containing the event data. - private void OnBaseChanged(object sender, EventArgs e) - { + private void OnBaseChanged(object sender, EventArgs e) => // Change in base renderer or base palette require we fetch the latest renderer _renderer = _palette.GetRenderer(); - } /// diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonWrapLabel.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonWrapLabel.cs index 69ea2df35..c5962ec2f 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonWrapLabel.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonWrapLabel.cs @@ -440,7 +440,7 @@ public void UpdateFont() Font? font; Color textColor; PaletteTextHint hint; - PaletteState ps = PaletteState.Normal; + var ps = PaletteState.Normal; // Get values from correct enabled/disabled state if (Enabled) @@ -541,7 +541,7 @@ protected override void OnPaint(PaintEventArgs e) Font? font; Color textColor; PaletteTextHint hint; - PaletteState ps = PaletteState.Normal; + var ps = PaletteState.Normal; // Get values from correct enabled/disabled state if (Enabled) @@ -854,13 +854,11 @@ private void OnContextMenuStripOpening(object sender, CancelEventArgs e) } } - private void OnKryptonContextMenuDisposed(object sender, EventArgs e) - { + private void OnKryptonContextMenuDisposed(object sender, EventArgs e) => // When the current krypton context menu is disposed, we should remove // it to prevent it being used again, as that would just throw an exception // because it has been disposed. KryptonContextMenu = null; - } private void OnContextMenuClosed(object sender, ToolStripDropDownClosedEventArgs e) => ContextMenuClosed(); diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/CommonDialogHandler.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/CommonDialogHandler.cs index 00ff7d0e9..ead624fd8 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/CommonDialogHandler.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/CommonDialogHandler.cs @@ -533,9 +533,6 @@ internal bool SetNewPosAndClientSize(Point loc, Size size) return true; } - public void SetResizable(bool isResizable) - { - _isResizable = isResizable; - } + public void SetResizable(bool isResizable) => _isResizable = isResizable; } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/KryptonMessageBoxForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/KryptonMessageBoxForm.cs index 9bad35f24..b68ac4bbf 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/KryptonMessageBoxForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/KryptonMessageBoxForm.cs @@ -911,7 +911,7 @@ protected override void WndProc(ref Message m) if (IgnoreAltF4) { // Extract the keys being pressed - Keys keys = (Keys)(int)m.WParam.ToInt64(); + var keys = (Keys)(int)m.WParam.ToInt64(); // If the user standard combination ALT + F4 if ((keys == Keys.F4) && ((ModifierKeys & Keys.Alt) == Keys.Alt)) diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/KryptonMultilineStringEditorForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/KryptonMultilineStringEditorForm.cs index b5d4eb221..f20329813 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/KryptonMultilineStringEditorForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/KryptonMultilineStringEditorForm.cs @@ -180,7 +180,7 @@ private void kbtnOk_Click(object sender, EventArgs e) { if (_useRichTextBox) { - foreach (string line in krtbContents.Lines) + foreach (var line in krtbContents.Lines) { // TODO: This is not right.. It will only have the last line it ! Contents = new string[] @@ -191,7 +191,7 @@ private void kbtnOk_Click(object sender, EventArgs e) } else { - foreach (string line in ktxtStringCollection.Lines) + foreach (var line in ktxtStringCollection.Lines) { // TODO: This is not right.. It will only have the last line it ! Contents = new string[] diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualBlur.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualBlur.cs index f284d926a..3baa6e15d 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualBlur.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualBlur.cs @@ -134,10 +134,10 @@ internal void UpdateShadowLayer() } // Get device contexts - IntPtr screenDc = PI.GetDC(IntPtr.Zero); - IntPtr memDc = PI.CreateCompatibleDC(screenDc); - IntPtr hBitmap = IntPtr.Zero; - IntPtr hOldBitmap = IntPtr.Zero; + var screenDc = PI.GetDC(IntPtr.Zero); + var memDc = PI.CreateCompatibleDC(screenDc); + var hBitmap = IntPtr.Zero; + var hOldBitmap = IntPtr.Zero; try { diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualContainerControlBase.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualContainerControlBase.cs index 5f1c2d78d..9f6786138 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualContainerControlBase.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualContainerControlBase.cs @@ -307,10 +307,7 @@ public PaletteMode PaletteMode /// /// Resets the PaletteMode property to its default value. /// - public void ResetPaletteMode() - { - PaletteMode = PaletteMode.Global; - } + public void ResetPaletteMode() => PaletteMode = PaletteMode.Global; /// /// Gets and sets the custom palette implementation. @@ -367,10 +364,7 @@ public PaletteBase? Palette /// /// Resets the Palette property to its default value. /// - public void ResetPalette() - { - PaletteMode = PaletteMode.Global; - } + public void ResetPalette() => PaletteMode = PaletteMode.Global; /// /// Gets access to the current renderer. @@ -533,10 +527,7 @@ protected void InvokeLayout() /// /// Mark the layout as being dirty and needing to be performed. /// - protected void MarkLayoutDirty() - { - _layoutDirty = true; - } + protected void MarkLayoutDirty() => _layoutDirty = true; /// /// Gets a value indicating if transparent paint is needed @@ -1111,11 +1102,9 @@ private void SetPalette(PaletteBase? palette) } } - private void OnBaseChanged(object sender, EventArgs e) - { + private void OnBaseChanged(object sender, EventArgs e) => // Change in base renderer or base palette require we fetch the latest renderer Renderer = _palette.GetRenderer(); - } private void PaintTransparentBackground(PaintEventArgs e) { @@ -1189,13 +1178,11 @@ private void OnContextMenuStripOpening(object sender, CancelEventArgs e) cms.Renderer = CreateToolStripRenderer(); } - private void OnKryptonContextMenuDisposed(object sender, EventArgs e) - { + private void OnKryptonContextMenuDisposed(object sender, EventArgs e) => // When the current krypton context menu is disposed, we should remove // it to prevent it being used again, as that would just throw an exception // because it has been disposed. KryptonContextMenu = null; - } private void OnContextMenuClosed(object sender, ToolStripDropDownClosedEventArgs e) => ContextMenuClosed(); diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualContextMenu.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualContextMenu.cs index f7996c555..66d6f1a02 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualContextMenu.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualContextMenu.cs @@ -196,7 +196,7 @@ public void Show(Rectangle screenRect, } // Find the horizontal position relative to screen rectangle - Point screenPt = Point.Empty; + var screenPt = Point.Empty; screenPt.X = horz switch { KryptonContextMenuPositionH.After => screenRect.Right, @@ -500,11 +500,9 @@ private void SetPalette(PaletteBase palette) } } - private void OnBaseChanged(object sender, EventArgs e) - { + private void OnBaseChanged(object sender, EventArgs e) => // Change in base renderer or base palette require we fetch the latest renderer Renderer = _palette.GetRenderer(); - } private void OnProviderClosing(object sender, CancelEventArgs e) => _contextMenu?.OnClosing(e); @@ -513,7 +511,7 @@ private void OnBaseChanged(object sender, EventArgs e) private void OnProviderClose(object sender, EventArgs e) { // Unhook from event source - ContextMenuProvider provider = (ContextMenuProvider)sender; + var provider = (ContextMenuProvider)sender; _provider.Dispose -= OnProviderClose; // Kill this poup window diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualControlBase.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualControlBase.cs index c694148fc..2d4b2c187 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualControlBase.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualControlBase.cs @@ -37,7 +37,7 @@ public abstract class VisualControlBase : Control, private readonly SimpleCall _refreshCall; private readonly SimpleCall _layoutCall; private KryptonContextMenu? _kryptonContextMenu; - protected VisualPopupToolTip visualBasePopupToolTip; + protected VisualPopupToolTip? visualBasePopupToolTip; private readonly ToolTipManager _toolTipManager; #endregion @@ -100,7 +100,7 @@ protected VisualControlBase() // Setup the need paint delegate NeedPaintDelegate = OnNeedPaint; - NeedPaintPaletteDelegate = OnPaletteNeedPaint; + NeedPaintPaletteDelegate = OnPaletteNeedPaint!; // Must layout before first draw attempt _layoutDirty = true; @@ -314,10 +314,7 @@ public PaletteMode PaletteMode /// /// Resets the PaletteMode property to its default value. /// - public void ResetPaletteMode() - { - PaletteMode = PaletteMode.Global; - } + public void ResetPaletteMode() => PaletteMode = PaletteMode.Global; /// /// Gets and sets the custom palette implementation. @@ -374,10 +371,7 @@ public PaletteBase? Palette /// /// Resets the Palette property to its default value. /// - public void ResetPalette() - { - PaletteMode = PaletteMode.Global; - } + public void ResetPalette() => PaletteMode = PaletteMode.Global; /// /// Gets access to the current renderer. @@ -385,7 +379,7 @@ public void ResetPalette() [Browsable(false)] [EditorBrowsable(EditorBrowsableState.Advanced)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public IRenderer? Renderer + public IRenderer Renderer { [DebuggerStepThrough] get; @@ -587,10 +581,7 @@ protected void InvokeLayout() => /// /// Mark the layout as being dirty and needing to be performed. /// - protected void MarkLayoutDirty() - { - _layoutDirty = true; - } + protected void MarkLayoutDirty() => _layoutDirty = true; /// /// Gets a value indicating if transparent paint is needed @@ -1200,16 +1191,14 @@ private void SetPalette(PaletteBase? palette) } } - private void OnBaseChanged(object sender, EventArgs e) - { + private void OnBaseChanged(object sender, EventArgs e) => // Change in base renderer or base palette require we fetch the latest renderer Renderer = _palette.GetRenderer(); - } private void PaintTransparentBackground(PaintEventArgs e) { // Get the parent control for transparent drawing purposes - Control parent = TransparentParent; + Control? parent = TransparentParent; // Do we have a parent control and we need to paint background? if ((parent != null) && NeedTransparentPaint) @@ -1278,13 +1267,11 @@ private void OnContextMenuStripOpening(object sender, CancelEventArgs e) cms.Renderer = CreateToolStripRenderer(); } - private void OnKryptonContextMenuDisposed(object sender, EventArgs e) - { + private void OnKryptonContextMenuDisposed(object sender, EventArgs e) => // When the current krypton context menu is disposed, we should remove // it to prevent it being used again, as that would just throw an exception // because it has been disposed. KryptonContextMenu = null; - } private void OnContextMenuClosed(object sender, ToolStripDropDownClosedEventArgs e) => ContextMenuClosed(); @@ -1330,7 +1317,7 @@ private void OnCancelToolTip(object sender, EventArgs e) => private void OnVisualPopupToolTipDisposed(object sender, EventArgs e) { // Unhook events from the specific instance that generated event - VisualPopupToolTip popupToolTip = (VisualPopupToolTip)sender; + var popupToolTip = (VisualPopupToolTip)sender; popupToolTip.Disposed -= OnVisualPopupToolTipDisposed; // Not showing a popup page any more @@ -1345,6 +1332,5 @@ protected override void OnHandleCreated(EventArgs e) } #endregion - } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualForm.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualForm.cs index 92e99559c..de6ebfb0f 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualForm.cs @@ -812,7 +812,7 @@ protected void InvalidateNonClient(Rectangle invalidRect, } using Graphics g = Graphics.FromHwnd(Handle); - IntPtr hRgn = invalidRegion.GetHrgn(g); + var hRgn = invalidRegion.GetHrgn(g); PI.RedrawWindow(Handle, IntPtr.Zero, hRgn, PI.RDW_FRAME | PI.RDW_UPDATENOW | PI.RDW_INVALIDATE); @@ -994,18 +994,12 @@ protected override void OnPaint(PaintEventArgs e) /// /// Suspend processing of non-client painting. /// - protected virtual void SuspendPaint() - { - _ignoreCount++; - } + protected virtual void SuspendPaint() => _ignoreCount++; /// /// Resume processing of non-client painting. /// - protected virtual void ResumePaint() - { - _ignoreCount--; - } + protected virtual void ResumePaint() => _ignoreCount--; /// /// Create the redirector instance. @@ -1247,7 +1241,7 @@ protected virtual void OnWM_GETMINMAXINFO(ref Message m) // Adjust the maximized size and position to fit the work area of the correct monitor const int MONITOR_DEFAULT_TO_NEAREST = 0x00000002; - IntPtr monitor = PI.MonitorFromWindow(m.HWnd, MONITOR_DEFAULT_TO_NEAREST); + var monitor = PI.MonitorFromWindow(m.HWnd, MONITOR_DEFAULT_TO_NEAREST); if (monitor != IntPtr.Zero) { @@ -1365,7 +1359,7 @@ protected virtual bool OnWM_NCHITTEST(ref Message m) protected virtual bool OnCompWM_NCHITTEST(ref Message m) { // Let the desktop window manager process it first - PI.Dwm.DwmDefWindowProc(m.HWnd, m.Msg, m.WParam, m.LParam, out IntPtr result); + PI.Dwm.DwmDefWindowProc(m.HWnd, m.Msg, m.WParam, m.LParam, out var result); m.Result = result; // If no result returned then let the base window routine process it @@ -1659,7 +1653,7 @@ protected virtual void OnNonClientPaint(IntPtr hWnd) if (windowBounds is { Width: > 0, Height: > 0 }) { // Get the device context for this window - IntPtr hDC = PI.GetWindowDC(Handle); + var hDC = PI.GetWindowDC(Handle); // If we managed to get a device context if (hDC != IntPtr.Zero) @@ -1685,7 +1679,7 @@ protected virtual void OnNonClientPaint(IntPtr hWnd) } // Create one the correct size and cache for future drawing - IntPtr hBitmap = PI.CreateCompatibleBitmap(hDC, windowBounds.Width, windowBounds.Height); + var hBitmap = PI.CreateCompatibleBitmap(hDC, windowBounds.Width, windowBounds.Height); // If we managed to get a compatible bitmap if (hBitmap != IntPtr.Zero) @@ -1950,25 +1944,19 @@ private void SetPalette(PaletteBase? palette) } } - private void OnBaseChanged(object sender, EventArgs e) - { + private void OnBaseChanged(object sender, EventArgs e) => // Change in base renderer or base palette require we fetch the latest renderer - Renderer = _palette.GetRenderer(); - // PaletteImageScaler.ScalePalette(FactorDpiX, FactorDpiY, _palette); - } + Renderer = _palette.GetRenderer();// PaletteImageScaler.ScalePalette(FactorDpiX, FactorDpiY, _palette); #if !NET462 - private void OnDpiChanged(object sender, DpiChangedEventArgs e) - { - UpdateDpiFactors(); - } + private void OnDpiChanged(object sender, DpiChangedEventArgs e) => UpdateDpiFactors(); #endif #endregion private void UpdateDpiFactors() { // Do not use the control dpi, as these values are being used to target the screen - IntPtr screenDc = PI.GetDC(IntPtr.Zero); + var screenDc = PI.GetDC(IntPtr.Zero); if (screenDc != IntPtr.Zero) { FactorDpiX = PI.GetDeviceCaps(screenDc, PI.DeviceCap.LOGPIXELSX) / 96f; diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualPanel.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualPanel.cs index 94636f230..a47d9dda3 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualPanel.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualPanel.cs @@ -345,10 +345,7 @@ public PaletteMode PaletteMode /// /// Resets the PaletteMode property to its default value. /// - public void ResetPaletteMode() - { - PaletteMode = PaletteMode.Global; - } + public void ResetPaletteMode() => PaletteMode = PaletteMode.Global; /// /// Gets and sets the custom palette implementation. @@ -405,10 +402,7 @@ public PaletteBase? Palette /// /// Resets the Palette property to its default value. /// - public void ResetPalette() - { - PaletteMode = PaletteMode.Global; - } + public void ResetPalette() => PaletteMode = PaletteMode.Global; /// /// Gets access to the current renderer. @@ -1176,13 +1170,11 @@ private void OnContextMenuStripOpening(object sender, CancelEventArgs e) } } - private void OnKryptonContextMenuDisposed(object sender, EventArgs e) - { + private void OnKryptonContextMenuDisposed(object sender, EventArgs e) => // When the current krypton context menu is disposed, we should remove // it to prevent it being used again, as that would just throw an exception // because it has been disposed. KryptonContextMenu = null; - } private void OnContextMenuClosed(object sender, ToolStripDropDownClosedEventArgs e) => ContextMenuClosed(); diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualPopup.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualPopup.cs index 73aca20ff..b6c2f017a 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualPopup.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualPopup.cs @@ -217,7 +217,7 @@ public virtual bool DoesCurrentMouseDownEndAllTracking(Message m, Point pt) X = screenPt.X, Y = screenPt.Y }; - IntPtr hWnd = PI.WindowFromPoint(screenPIPt); + var hWnd = PI.WindowFromPoint(screenPIPt); // Assuming we got back a valid window handle if (hWnd != IntPtr.Zero) diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualPopupManager.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualPopupManager.cs index d5c52b232..063598f3b 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualPopupManager.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualPopupManager.cs @@ -23,7 +23,7 @@ private class PopupStack : Stack {} #region Static Fields [ThreadStatic] - private static VisualPopupManager _singleton; + private static VisualPopupManager? _singleton; #endregion #region Instance Fields @@ -31,7 +31,6 @@ private class PopupStack : Stack {} private IntPtr _activeWindow; private bool _filtering; private int _suspended; - private ContextMenuStrip _cms; private EventHandler? _cmsFinishDelegate; #endregion @@ -93,7 +92,7 @@ public VisualPopup? CurrentPopup #region TrackingByType /// - /// Gets the popup that matches the proveded type. + /// Gets the popup that matches the provided type. /// /// Type to find. /// Matching instance; otherwise null. @@ -133,7 +132,7 @@ public VisualPopup? CurrentPopup public void StartTracking([DisallowNull] VisualPopup popup) { Debug.Assert(popup != null); - Debug.Assert(!popup.IsDisposed); + Debug.Assert(!popup!.IsDisposed); Debug.Assert(popup.IsHandleCreated); Debug.Assert(_suspended == 0); @@ -307,14 +306,13 @@ public void ShowContextMenuStrip([DisallowNull] ContextMenuStrip cms, // Suspend processing of messages until context strip removed _suspended++; - // Need to filter to prevent non-client mouse move from occuring + // Need to filter to prevent non-client mouse move from occurring FilterMessages(true); // We are showing a context menu strip IsShowingCMS = true; // Remember the strip reference for use in message processing - _cms = cms; cms.Show(screenPt); } @@ -355,7 +353,7 @@ public bool PreFilterMessage(ref Message m) else { // Get the active window - IntPtr activeWindow = PI.GetActiveWindow(); + var activeWindow = PI.GetActiveWindow(); // Is there a change in active window? if (activeWindow != _activeWindow) @@ -429,6 +427,7 @@ public bool PreFilterMessage(ref Message m) return ProcessKeyboard(ref m); } break; + case PI.WM_.CHAR: case PI.WM_.KEYUP: case PI.WM_.DEADCHAR: @@ -440,8 +439,8 @@ public bool PreFilterMessage(ref Message m) { return ProcessKeyboard(ref m); } - break; + case PI.WM_.MOUSEMOVE: case PI.WM_.NCMOUSEMOVE: return ProcessMouseMove(ref m); @@ -514,10 +513,8 @@ private bool ProcessClientMouseDown(ref Message m) var popups = _stack.ToArray(); // Search from end towards the front, the last entry is the most recent 'Push' - for (var i = 0; i < popups.Length; i++) + foreach (VisualPopup popup in popups) { - // Ignore disposed popups - VisualPopup popup = popups[i]; if (!popup.IsDisposed) { // If the mouse down is inside the popup instance @@ -549,10 +546,8 @@ private bool ProcessClientMouseDown(ref Message m) if (!processed) { // Search from end towards the front, the last entry is the most recent 'Push' - for (var i = 0; i < popups.Length; i++) + foreach (VisualPopup popup in popups) { - // Ignore disposed popups - VisualPopup popup = popups[i]; if (!popup.IsDisposed) { processed = popup.DoesMouseDownGetEaten(m, screenPt); @@ -593,10 +588,8 @@ private bool ProcessNonClientMouseDown(ref Message m) { // Search from end towards the front, the last entry is the most recent 'Push' var popups = _stack.ToArray(); - for (var i = 0; i < popups.Length; i++) + foreach (VisualPopup popup in popups) { - // Ignore disposed popups - VisualPopup popup = popups[i]; if (!popup.IsDisposed) { processed = popup.DoesMouseDownGetEaten(m, screenPt); @@ -668,7 +661,7 @@ private bool ProcessMouseMoveWithCMS(ref Message m) }; // Get the window handle of the window under this screen point - IntPtr hWnd = PI.WindowFromPoint(screenPIPt); + var hWnd = PI.WindowFromPoint(screenPIPt); // Is the window handle that of the currently tracking popup if (CurrentPopup.Handle == hWnd) @@ -678,19 +671,9 @@ private bool ProcessMouseMoveWithCMS(ref Message m) // Search all the stacked popups for any that match the window handle var popups = _stack.ToArray(); - for (var i = 0; i !popup.IsDisposed).Any(popup => popup.Handle == hWnd); // Mouse move is not over a popup, so allow it - return false; } private Point ScreenPtToClientPt(Point pt) => ScreenPtToClientPt(pt, CurrentPopup.Handle); @@ -761,7 +744,7 @@ private void FilterMessages(bool filter) private void OnCMSClosed(object sender, ToolStripDropDownClosedEventArgs e) { // Unhook event from object - ContextMenuStrip cms = sender as ContextMenuStrip; + var cms = sender as ContextMenuStrip; cms.Closed -= OnCMSClosed; // Revoke the suspended state @@ -775,7 +758,6 @@ private void OnCMSClosed(object sender, ToolStripDropDownClosedEventArgs e) } // No longer showing a context menu strip - _cms = null; IsShowingCMS = false; // Do we fire a delegate to notify end of the strip? diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualShadowBase.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualShadowBase.cs index 8e4067d9f..aad2adf3c 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualShadowBase.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualShadowBase.cs @@ -158,10 +158,10 @@ internal void UpdateShadowLayer() } // Get device contexts - IntPtr screenDc = PI.GetDC(IntPtr.Zero); - IntPtr memDc = PI.CreateCompatibleDC(screenDc); - IntPtr hBitmap = IntPtr.Zero; - IntPtr hOldBitmap = IntPtr.Zero; + var screenDc = PI.GetDC(IntPtr.Zero); + var memDc = PI.CreateCompatibleDC(screenDc); + var hBitmap = IntPtr.Zero; + var hOldBitmap = IntPtr.Zero; try { diff --git a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualTaskDialog.cs b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualTaskDialog.cs index 0293a4c58..4bf6c85ce 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualTaskDialog.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Controls Visuals/VisualTaskDialog.cs @@ -48,7 +48,7 @@ protected override void WndProc(ref Message m) if (IgnoreAltF4) { // Extract the keys being pressed - Keys keys = (Keys)(int)m.WParam.ToInt64(); + var keys = (Keys)(int)m.WParam.ToInt64(); // If the user standard combination ALT + F4 if ((keys == Keys.F4) && ((ModifierKeys & Keys.Alt) == Keys.Alt)) @@ -298,7 +298,7 @@ private void UpdateRadioButtons() _panelMainRadio.Controls.Clear(); _panelMainRadio.Visible = true; - Size maxButtonSize = Size.Empty; + var maxButtonSize = Size.Empty; foreach (KryptonTaskDialogCommand command in _radioButtons) { // Create and add a new radio button instance @@ -354,7 +354,7 @@ private void UpdateCommandButtons() _panelMainCommands.Controls.Clear(); _panelMainCommands.Visible = true; - Size maxButtonSize = Size.Empty; + var maxButtonSize = Size.Empty; foreach (KryptonTaskDialogCommand command in _commandButtons) { // Create and add a new button instance @@ -635,7 +635,7 @@ private Size UpdateMainTextSizing() _messageText.UpdateFont(); _messageContent.UpdateFont(); _messageContentMultiline.Font = _messageContent.Font; - Size messageMainSize = g.MeasureString(_mainInstruction, _messageText.Font, 400).ToSize(); + var messageMainSize = g.MeasureString(_mainInstruction, _messageText.Font, 400).ToSize(); messageContentSize = g.MeasureString(_content, _messageContent.Font, 400).ToSize(); // Get the display size and make sure that the content size is not greater than 0.6 of display size @@ -712,7 +712,7 @@ private Size UpdateSpacerSizing() private Size UpdateButtonsSizing() { var numButtons = 0; - Size maxButtonSize = Size.Empty; + var maxButtonSize = Size.Empty; // Find the size of the largest button we need if ((_commonButtons & TaskDialogButtons.Close) == TaskDialogButtons.Close) @@ -809,7 +809,7 @@ private Size UpdateButtonsSizing() right -= maxButtonSize.Width + BUTTON_GAP; } - Size checkboxSize = Size.Empty; + var checkboxSize = Size.Empty; if (!string.IsNullOrEmpty(_checkboxText)) { checkboxSize = _checkBox.GetPreferredSize(Size.Empty); @@ -853,8 +853,8 @@ private Size UpdateFooterSizing() using Graphics g = CreateGraphics(); // Find size of the labels when it has a maximum length of 400 _footerLabel.UpdateFont(); - Size footerTextSize = g.MeasureString(_footerText, _footerLabel.Font, 200).ToSize(); - Size footerHyperlinkSize = g.MeasureString(_footerHyperlink, _footerLabel.Font, 200).ToSize(); + var footerTextSize = g.MeasureString(_footerText, _footerLabel.Font, 200).ToSize(); + var footerHyperlinkSize = g.MeasureString(_footerHyperlink, _footerLabel.Font, 200).ToSize(); // Always add on an extra 5 pixels as sometimes the measure size does not draw the last // character it contains, this ensures there is always definitely enough space for it all @@ -864,7 +864,7 @@ private Size UpdateFooterSizing() _linkLabelFooter.Size = footerHyperlinkSize; // Find required size of the footer panel - Size requiredSize = Size.Empty; + var requiredSize = Size.Empty; if (!string.IsNullOrEmpty(_footerText)) { @@ -926,7 +926,7 @@ private Size UpdateFooterSizing() private void OnRadioButtonCheckedChanged(object sender, EventArgs e) { - KryptonRadioButton button = (KryptonRadioButton)sender; + var button = (KryptonRadioButton)sender; _defaultRadioButton = (KryptonTaskDialogCommand)button.Tag; if (_taskDialog != null) { @@ -939,11 +939,11 @@ private void OnCommandClicked(object sender, EventArgs e) Close(); // Update the result code from the command button - KryptonButton button = (KryptonButton)sender; + var button = (KryptonButton)sender; DialogResult = button.DialogResult; // Invoke any event handlers from the command button - KryptonTaskDialogCommand command = (KryptonTaskDialogCommand)button.Tag; + var command = (KryptonTaskDialogCommand)button.Tag; command.PerformExecute(); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Converters/ButtonSpecFormFixedConverter.cs b/Source/Krypton Components/Krypton.Toolkit/Converters/ButtonSpecFormFixedConverter.cs index 83a42a419..e8deee38d 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Converters/ButtonSpecFormFixedConverter.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Converters/ButtonSpecFormFixedConverter.cs @@ -45,7 +45,7 @@ public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destina if (destinationType == typeof(string)) { // Cast to correct type - ButtonSpecFormFixed? buttonSpec = value as ButtonSpecFormFixed; + var buttonSpec = value as ButtonSpecFormFixed; // Ask the button spec for the correct string return buttonSpec?.ToString() ?? string.Empty; diff --git a/Source/Krypton Components/Krypton.Toolkit/Converters/PaletteDrawBordersConverter.cs b/Source/Krypton Components/Krypton.Toolkit/Converters/PaletteDrawBordersConverter.cs index 86693a9aa..6b1562eca 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Converters/PaletteDrawBordersConverter.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Converters/PaletteDrawBordersConverter.cs @@ -123,7 +123,7 @@ public override object ConvertFrom(ITypeDescriptorContext context, { // Default to returning an empty value - PaletteDrawBorders ret = PaletteDrawBorders.None; + var ret = PaletteDrawBorders.None; // If inherit is in the string, we use only that value if (conv.Contains(@"Inherit")) diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Action Lists/KryptonButtonActionList.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Action Lists/KryptonButtonActionList.cs index cd359529a..aa5d05d86 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Action Lists/KryptonButtonActionList.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Action Lists/KryptonButtonActionList.cs @@ -251,7 +251,7 @@ public bool UseAsUACElevatedButton public override DesignerActionItemCollection GetSortedActionItems() { // Create a new collection for holding the single item we want to create - DesignerActionItemCollection? actions = new DesignerActionItemCollection(); + var actions = new DesignerActionItemCollection(); // This can be null when deleting a control instance at design time if (_button != null) diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Action Lists/KryptonHeaderGroupActionList.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Action Lists/KryptonHeaderGroupActionList.cs index 9719d890d..39848a045 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Action Lists/KryptonHeaderGroupActionList.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Action Lists/KryptonHeaderGroupActionList.cs @@ -209,7 +209,7 @@ public override DesignerActionItemCollection GetSortedActionItems() private void OnVisibleClick(object sender, EventArgs e) { // Cast to the correct type - DesignerVerb verb = sender as DesignerVerb; + var verb = sender as DesignerVerb; // Find out if this is the first or second header verb var header1 = verb == _visible1; diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonBreadCrumbDesigner.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonBreadCrumbDesigner.cs index f394d2291..112f14645 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonBreadCrumbDesigner.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonBreadCrumbDesigner.cs @@ -201,7 +201,7 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) if ((_breadCrumb != null) && (e.Component == _breadCrumb)) { // Need access to host in order to delete a component - IDesignerHost? host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all the button spec instances for (var i = _breadCrumb.ButtonSpecs.Count - 1; i >= 0; i--) diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonBreadCrumbItemDesigner.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonBreadCrumbItemDesigner.cs index a36e4f338..6e05251c2 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonBreadCrumbItemDesigner.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonBreadCrumbItemDesigner.cs @@ -90,12 +90,12 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) if ((_crumbItem != null) && (e.Component == _crumbItem)) { // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all items from the child item collection for (var j = _crumbItem.Items.Count - 1; j >= 0; j--) { - Component item = _crumbItem.Items[j] as Component; + var item = _crumbItem.Items[j] as Component; _crumbItem.Items.Remove(item); host.DestroyComponent(item); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonComboBoxDesigner.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonComboBoxDesigner.cs index bbb94c532..6724c9f1a 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonComboBoxDesigner.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonComboBoxDesigner.cs @@ -181,7 +181,7 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) if ((_comboBox != null) && (e.Component == _comboBox)) { // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all the button spec instances for (var i = _comboBox.ButtonSpecs.Count - 1; i >= 0; i--) diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonContextMenuDesigner.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonContextMenuDesigner.cs index f3c80b40c..656c1e41d 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonContextMenuDesigner.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonContextMenuDesigner.cs @@ -108,12 +108,12 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) if ((_contextMenu != null) && (e.Component == _contextMenu)) { // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all items from the context menu for (var j = _contextMenu.Items.Count - 1; j >= 0; j--) { - Component item = _contextMenu.Items[j] as Component; + var item = _contextMenu.Items[j] as Component; _contextMenu.Items.Remove(item); host.DestroyComponent(item); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonContextMenuItemDesigner.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonContextMenuItemDesigner.cs index 9db10c009..32da0b30f 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonContextMenuItemDesigner.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonContextMenuItemDesigner.cs @@ -90,12 +90,12 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) if ((_contextMenuItem != null) && (e.Component == _contextMenuItem)) { // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all items from the child item collection for (var j = _contextMenuItem.Items.Count - 1; j >= 0; j--) { - Component item = _contextMenuItem.Items[j] as Component; + var item = _contextMenuItem.Items[j] as Component; _contextMenuItem.Items.Remove(item); host.DestroyComponent(item); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonContextMenuItemsDesigner.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonContextMenuItemsDesigner.cs index 1b337eb1a..8c5d8ec16 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonContextMenuItemsDesigner.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonContextMenuItemsDesigner.cs @@ -90,12 +90,12 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) if ((_contextMenuItems != null) && (e.Component == _contextMenuItems)) { // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all items from the item collection for (var j = _contextMenuItems.Items.Count - 1; j >= 0; j--) { - Component item = _contextMenuItems.Items[j] as Component; + var item = _contextMenuItems.Items[j] as Component; _contextMenuItems.Items.Remove(item); host.DestroyComponent(item); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonDateTimePickerColumnDesigner.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonDateTimePickerColumnDesigner.cs index 46b5914b7..667cee8bb 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonDateTimePickerColumnDesigner.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonDateTimePickerColumnDesigner.cs @@ -47,7 +47,7 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) if ((_dateTimePicker != null) && (e.Component == _dateTimePicker)) { // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); } } #endregion diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonGroupDesigner.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonGroupDesigner.cs index 22a01a15e..8dc2de679 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonGroupDesigner.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonGroupDesigner.cs @@ -81,7 +81,7 @@ public override DesignerActionListCollection ActionLists get { // Create a collection of action lists - DesignerActionListCollection? actionLists = new DesignerActionListCollection + var actionLists = new DesignerActionListCollection { // Add the group specific list new KryptonGroupActionList(this) diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonGroupPanelDesigner.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonGroupPanelDesigner.cs index 35487fa99..7a34ee656 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonGroupPanelDesigner.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonGroupPanelDesigner.cs @@ -146,7 +146,7 @@ protected override void PreFilterProperties(IDictionary properties) foreach (DictionaryEntry entry in properties) { // Get the property descriptor for the entry - PropertyDescriptor descriptor = (PropertyDescriptor)entry.Value; + var descriptor = (PropertyDescriptor)entry.Value; // Is this the 'Name' we are searching for? if (descriptor.Name.Equals((@"Name")) && descriptor.DesignTimeOnly) diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonMonthCalendarDesigner.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonMonthCalendarDesigner.cs index d5dbb4c02..ec9d66160 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonMonthCalendarDesigner.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonMonthCalendarDesigner.cs @@ -193,7 +193,7 @@ private void OnCalendarMouseUp(object sender, MouseEventArgs e) _monthCalendar.PerformLayout(); // Select the component - ArrayList? selectionList = new ArrayList + var selectionList = new ArrayList { component }; @@ -223,7 +223,7 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) if (e.Component == _monthCalendar) { // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all the button spec instances for (var i = _monthCalendar.ButtonSpecs.Count - 1; i >= 0; i--) diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonNumericUpDownDesigner.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonNumericUpDownDesigner.cs index 746fb3708..af48140a8 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonNumericUpDownDesigner.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonNumericUpDownDesigner.cs @@ -154,7 +154,7 @@ private void OnNumericUpDownMouseUp(object sender, MouseEventArgs e) _numericUpDown.PerformLayout(); // Select the component - ArrayList? selectionList = new ArrayList + var selectionList = new ArrayList { component }; @@ -184,7 +184,7 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) if ((_numericUpDown != null) && (e.Component == _numericUpDown)) { // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all the button spec instances for (var i = _numericUpDown.ButtonSpecs.Count - 1; i >= 0; i--) diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonSplitContainerDesigner.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonSplitContainerDesigner.cs index 6c1e01202..83180d287 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonSplitContainerDesigner.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonSplitContainerDesigner.cs @@ -126,8 +126,9 @@ public override DesignerActionListCollection ActionLists get { // Create a collection of action lists - var actionLists = new DesignerActionListCollection + DesignerActionListCollection actionLists = new DesignerActionListCollection { + // Add the orientation list new KryptonSplitContainerActionList(this) }; @@ -142,11 +143,9 @@ public override DesignerActionListCollection ActionLists /// Raises the DragEnter event. /// /// A DragEventArgs that contains the event data. - protected override void OnDragEnter(DragEventArgs de) - { + protected override void OnDragEnter(DragEventArgs de) => // Prevent user dragging a toolbox control onto the control de.Effect = DragDropEffects.None; - } #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonSplitterPanelDesigner.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonSplitterPanelDesigner.cs index 5fd23dc8b..5acce497b 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonSplitterPanelDesigner.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonSplitterPanelDesigner.cs @@ -39,7 +39,7 @@ public override void Initialize([DisallowNull] IComponent component) _selectionService = (ISelectionService)GetService(typeof(ISelectionService)); // Hook into changes in selected component - IComponentChangeService service = (IComponentChangeService)GetService(typeof(IComponentChangeService)); + var service = (IComponentChangeService)GetService(typeof(IComponentChangeService)); if (service != null) { service.ComponentChanged += OnComponentChanged; @@ -102,7 +102,7 @@ protected override void Dispose(bool disposing) if (disposing) { // Get access to the component change service - IComponentChangeService service = (IComponentChangeService)GetService(typeof(IComponentChangeService)); + var service = (IComponentChangeService)GetService(typeof(IComponentChangeService)); // Must unhook our event from the service so we can be garbage collected if (service != null) @@ -152,7 +152,7 @@ protected override void PreFilterProperties(IDictionary properties) foreach (DictionaryEntry entry in properties) { // Get the property descriptor for the entry - PropertyDescriptor descriptor = (PropertyDescriptor)entry.Value; + var descriptor = (PropertyDescriptor)entry.Value; // Is this the 'Name' we are searching for? if (descriptor.Name.Equals((@"Name")) && descriptor.DesignTimeOnly) diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonTextBoxDesigner.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonTextBoxDesigner.cs index 1317df22c..5160de779 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonTextBoxDesigner.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/KryptonTextBoxDesigner.cs @@ -190,7 +190,7 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) if ((_textBox != null) && (e.Component == _textBox)) { // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all the button spec instances for (var i = _textBox.ButtonSpecs.Count - 1; i >= 0; i--) diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/ScrollBarControlDesigner.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/ScrollBarControlDesigner.cs index 8b2f9ba7e..e997c45d6 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/ScrollBarControlDesigner.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Designers/ScrollBarControlDesigner.cs @@ -32,7 +32,7 @@ public override SelectionRules SelectionRules if (propDescriptor != null) { // get the current orientation - ScrollBarOrientation orientation = + var orientation = (ScrollBarOrientation)propDescriptor.GetValue(Component); // if vertical orientation diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Editors/KryptonBreadCrumbItemsEditor.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Editors/KryptonBreadCrumbItemsEditor.cs index adc65ea37..075a26edb 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Editors/KryptonBreadCrumbItemsEditor.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Editors/KryptonBreadCrumbItemsEditor.cs @@ -145,11 +145,9 @@ public MenuTreeNode(KryptonBreadCrumbItem item) #endregion #region Implementation - private void OnPropertyChanged(object sender, PropertyChangedEventArgs e) - { + private void OnPropertyChanged(object sender, PropertyChangedEventArgs e) => // Update with correct string for new state Text = Item.ToString(); - } #endregion } @@ -585,7 +583,7 @@ private bool ContainsNode(TreeNode node, TreeNode find) private void buttonMoveUp_Click(object sender, EventArgs e) { // If we have a selected node - MenuTreeNode? node = treeView1.SelectedNode as MenuTreeNode; + var node = treeView1.SelectedNode as MenuTreeNode; if (node != null) { // Find the previous node using the currently selected node @@ -595,7 +593,7 @@ private void buttonMoveUp_Click(object sender, EventArgs e) var contained = ContainsNode(previousNode, node); // Remove cell from parent collection - MenuTreeNode parentNode = (MenuTreeNode)node.Parent; + var parentNode = (MenuTreeNode)node.Parent; TreeNodeCollection parentCollection = node.Parent == null ? treeView1.Nodes : node.Parent.Nodes; parentNode?.Item.Items.Remove(node.Item); parentCollection.Remove(node); @@ -603,7 +601,7 @@ private void buttonMoveUp_Click(object sender, EventArgs e) if (contained) { // Add cell to the parent of target node - MenuTreeNode? previousParent = previousNode.Parent as MenuTreeNode; + var previousParent = previousNode.Parent as MenuTreeNode; parentCollection = previousNode.Parent == null ? treeView1.Nodes : previousNode.Parent.Nodes; var pageIndex = parentCollection.IndexOf(previousNode); @@ -642,7 +640,7 @@ private void buttonMoveUp_Click(object sender, EventArgs e) private void buttonMoveDown_Click(object sender, EventArgs e) { // If we have a selected node - MenuTreeNode? node = treeView1.SelectedNode as MenuTreeNode; + var node = treeView1.SelectedNode as MenuTreeNode; if (node != null) { // Find the next node using the currently selected node @@ -652,7 +650,7 @@ private void buttonMoveDown_Click(object sender, EventArgs e) var contained = ContainsNode(nextNode, node); // Remove cell from parent collection - MenuTreeNode? parentNode = node.Parent as MenuTreeNode; + var parentNode = node.Parent as MenuTreeNode; TreeNodeCollection parentCollection = node.Parent == null ? treeView1.Nodes : node.Parent.Nodes; parentNode?.Item.Items.Remove(node.Item); parentCollection.Remove(node); @@ -660,7 +658,7 @@ private void buttonMoveDown_Click(object sender, EventArgs e) if (contained) { // Add cell to the parent sequence of target cell - MenuTreeNode previousParent = (MenuTreeNode)nextNode.Parent; + var previousParent = (MenuTreeNode)nextNode.Parent; parentCollection = nextNode.Parent == null ? treeView1.Nodes : nextNode.Parent.Nodes; var pageIndex = parentCollection.IndexOf(nextNode); previousParent?.Item.Items.Insert(pageIndex + 1, node.Item); @@ -684,7 +682,7 @@ private void buttonMoveDown_Click(object sender, EventArgs e) private void buttonAddSibling_Click(object sender, EventArgs e) { - KryptonBreadCrumbItem? item = CreateInstance(typeof(KryptonBreadCrumbItem)) as KryptonBreadCrumbItem; + var item = CreateInstance(typeof(KryptonBreadCrumbItem)) as KryptonBreadCrumbItem; TreeNode newNode = new MenuTreeNode(item); TreeNode selectedNode = treeView1.SelectedNode; @@ -703,7 +701,7 @@ private void buttonAddSibling_Click(object sender, EventArgs e) } else { - MenuTreeNode parentMenu = (MenuTreeNode)parentNode; + var parentMenu = (MenuTreeNode)parentNode; parentMenu.Item.Items.Insert(parentNode.Nodes.IndexOf(selectedNode) + 1, item); parentNode.Nodes.Insert(parentNode.Nodes.IndexOf(selectedNode) + 1, newNode); } @@ -722,7 +720,7 @@ private void buttonAddSibling_Click(object sender, EventArgs e) private void buttonAddChild_Click(object sender, EventArgs e) { - KryptonBreadCrumbItem item = (KryptonBreadCrumbItem)CreateInstance(typeof(KryptonBreadCrumbItem)); + var item = (KryptonBreadCrumbItem)CreateInstance(typeof(KryptonBreadCrumbItem)); TreeNode newNode = new MenuTreeNode(item); TreeNode selectedNode = treeView1.SelectedNode; @@ -733,7 +731,7 @@ private void buttonAddChild_Click(object sender, EventArgs e) } else { - MenuTreeNode selectedMenu = (MenuTreeNode)selectedNode; + var selectedMenu = (MenuTreeNode)selectedNode; selectedMenu.Item.Items.Add(item); selectedNode.Nodes.Add(newNode); } @@ -756,7 +754,7 @@ private void buttonDelete_Click(object sender, EventArgs e) // We should have a selected node! if (node != null) { - MenuTreeNode treeNode = node as MenuTreeNode; + var treeNode = node as MenuTreeNode; // If at root level then remove from root, otherwise from the parent collection if (node.Parent == null) @@ -766,7 +764,7 @@ private void buttonDelete_Click(object sender, EventArgs e) else { TreeNode parentNode = node.Parent; - MenuTreeNode treeParentNode = parentNode as MenuTreeNode; + var treeParentNode = parentNode as MenuTreeNode; treeParentNode.Item.Items.Remove(treeNode.Item); node.Parent.Nodes.Remove(node); } @@ -786,7 +784,7 @@ private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) private void UpdateButtons() { - MenuTreeNode node = treeView1.SelectedNode as MenuTreeNode; + var node = treeView1.SelectedNode as MenuTreeNode; buttonMoveUp.Enabled = (node != null) && (PreviousNode(node) != null); buttonMoveDown.Enabled = (node != null) && (NextNode(node) != null); buttonDelete.Enabled = node != null; @@ -868,7 +866,7 @@ private void SynchronizeCollections(DictItemBase before, } } - IComponentChangeService changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService)); + var changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService)); if (changeService != null) { // Mark components as changed when not added or removed diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Editors/KryptonCheckButtonCollectionEditor.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Editors/KryptonCheckButtonCollectionEditor.cs index 8dd940c6e..e3d4420e3 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Editors/KryptonCheckButtonCollectionEditor.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Editors/KryptonCheckButtonCollectionEditor.cs @@ -34,12 +34,12 @@ public override object EditValue(ITypeDescriptorContext? context, IServiceProvid if ((context?.Instance != null) && (provider != null)) { // Must use the editor service for showing dialogs - IWindowsFormsEditorService? editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); + var editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (editorService != null) { // Cast the value to the correct type - KryptonCheckSet checkSet = (KryptonCheckSet)context.Instance; + var checkSet = (KryptonCheckSet)context.Instance; // Create the dialog used to edit the set of KryptonCheckButtons var dialog = new KryptonCheckButtonCollectionForm(checkSet); diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Editors/KryptonContextMenuCollectionEditor.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Editors/KryptonContextMenuCollectionEditor.cs index 76c368d74..2f2085a79 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Editors/KryptonContextMenuCollectionEditor.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Editors/KryptonContextMenuCollectionEditor.cs @@ -38,9 +38,7 @@ public KryptonContextMenuCollectionEditor() /// Gets the data types that this collection editor can contain. /// /// An array of data types that this collection can contain. - protected override Type[] CreateNewItemTypes() - { - return new[] { typeof(KryptonContextMenuItems), + protected override Type[] CreateNewItemTypes() => new[] { typeof(KryptonContextMenuItems), typeof(KryptonContextMenuSeparator), typeof(KryptonContextMenuHeading), typeof(KryptonContextMenuLinkLabel), @@ -51,7 +49,6 @@ protected override Type[] CreateNewItemTypes() typeof(KryptonContextMenuMonthCalendar), typeof(KryptonContextMenuImageSelect) }; - } #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Editors/KryptonContextMenuItemCollectionEditor.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Editors/KryptonContextMenuItemCollectionEditor.cs index 620fcb130..b365e13a0 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Editors/KryptonContextMenuItemCollectionEditor.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Editors/KryptonContextMenuItemCollectionEditor.cs @@ -29,11 +29,8 @@ public KryptonContextMenuItemCollectionEditor() /// Gets the data types that this collection editor can contain. /// /// An array of data types that this collection can contain. - protected override Type[] CreateNewItemTypes() - { - return new[] { typeof(KryptonContextMenuItem), + protected override Type[] CreateNewItemTypes() => new[] { typeof(KryptonContextMenuItem), typeof(KryptonContextMenuSeparator), typeof(KryptonContextMenuHeading) }; - } } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Editors/PaletteDrawBordersEditor.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Editors/PaletteDrawBordersEditor.cs index 110f66355..ce59da219 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Editors/PaletteDrawBordersEditor.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Editors/PaletteDrawBordersEditor.cs @@ -40,7 +40,7 @@ public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext contex if ((context != null) && (provider != null) && (value != null)) { // Grab the service needed to show the drop down - IWindowsFormsEditorService? service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); + var service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (service != null) { diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Other/KryptonSplitContainerBehavior.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Other/KryptonSplitContainerBehavior.cs index 8e6f13c57..657d14253 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Other/KryptonSplitContainerBehavior.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Other/KryptonSplitContainerBehavior.cs @@ -119,7 +119,7 @@ public override bool OnMouseLeave(Glyph g) private static Point PointToSplitContainer(Glyph g, Point pt) { // Cast the correct type - KryptonSplitContainerGlyph splitGlyph = (KryptonSplitContainerGlyph)g; + var splitGlyph = (KryptonSplitContainerGlyph)g; // Gets the bounds of the glyph in adorner coordinates Rectangle bounds = splitGlyph.Bounds; diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Other/OverrideComboBoxStyleDropDownStyle.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Other/OverrideComboBoxStyleDropDownStyle.cs index f6738c949..df8b5932d 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Other/OverrideComboBoxStyleDropDownStyle.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Other/OverrideComboBoxStyleDropDownStyle.cs @@ -29,7 +29,7 @@ public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext contex public override object? EditValue(ITypeDescriptorContext? context, IServiceProvider? provider, object? value) { - IWindowsFormsEditorService? svc = (IWindowsFormsEditorService)provider?.GetService(typeof(IWindowsFormsEditorService)); + var svc = (IWindowsFormsEditorService)provider?.GetService(typeof(IWindowsFormsEditorService)); if (svc != null) { var ctrl = new UserControl(); diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/Other/PaletteDrawBordersSelector.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/Other/PaletteDrawBordersSelector.cs index d85215f3b..66cf28741 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/Other/PaletteDrawBordersSelector.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/Other/PaletteDrawBordersSelector.cs @@ -30,7 +30,7 @@ public PaletteDrawBorders Value { get { - PaletteDrawBorders ret = PaletteDrawBorders.None; + var ret = PaletteDrawBorders.None; if (checkBoxInherit.Checked) { diff --git a/Source/Krypton Components/Krypton.Toolkit/Designers/UX/KryptonCheckButtonCollectionForm.cs b/Source/Krypton Components/Krypton.Toolkit/Designers/UX/KryptonCheckButtonCollectionForm.cs index 076d2790d..98d93c71f 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Designers/UX/KryptonCheckButtonCollectionForm.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Designers/UX/KryptonCheckButtonCollectionForm.cs @@ -110,7 +110,7 @@ private void buttonOK_Click(object sender, EventArgs e) for(var i=0; i // Update with correct string for new state Text = Item.ToString(); - } #endregion } @@ -655,11 +653,9 @@ protected override void OnEditValueChanged() #endregion #region Implementation - private void KryptonContextMenuEditorForm_Load(object sender, EventArgs e) - { + private void KryptonContextMenuEditorForm_Load(object sender, EventArgs e) => // Set allowed categories into the property grid filter _propertyGrid1.BrowsableAttributes = new AttributeCollection(new KryptonPersistAttribute()); - } private void buttonOK_Click(object sender, EventArgs e) { @@ -693,7 +689,7 @@ private void buttonMoveUp_Click(object sender, EventArgs e) // We should have a selected node! if (node != null) { - MenuTreeNode treeNode = node as MenuTreeNode; + var treeNode = node as MenuTreeNode; // If at the root level then move up in the root items collection if (node.Parent == null) @@ -706,7 +702,7 @@ private void buttonMoveUp_Click(object sender, EventArgs e) { var index = node.Parent.Nodes.IndexOf(node); TreeNode parentNode = node.Parent; - MenuTreeNode treeParentNode = parentNode as MenuTreeNode; + var treeParentNode = parentNode as MenuTreeNode; switch (treeParentNode?.Item) { @@ -739,7 +735,7 @@ private void buttonMoveDown_Click(object sender, EventArgs e) // We should have a selected node! if (node != null) { - MenuTreeNode treeNode = node as MenuTreeNode; + var treeNode = node as MenuTreeNode; // If at the root level then move down in the root items collection if (node.Parent == null) @@ -752,7 +748,7 @@ private void buttonMoveDown_Click(object sender, EventArgs e) { var index = node.Parent.Nodes.IndexOf(node); TreeNode parentNode = node.Parent; - MenuTreeNode treeParentNode = parentNode as MenuTreeNode; + var treeParentNode = parentNode as MenuTreeNode; switch (treeParentNode?.Item) { @@ -809,7 +805,7 @@ private void buttonDelete_Click(object sender, EventArgs e) // We should have a selected node! if (node != null) { - MenuTreeNode treeNode = node as MenuTreeNode; + var treeNode = node as MenuTreeNode; // If at root level then remove from root, otherwise from the parent collection if (node.Parent == null) @@ -819,7 +815,7 @@ private void buttonDelete_Click(object sender, EventArgs e) else { TreeNode parentNode = node.Parent; - MenuTreeNode treeParentNode = parentNode as MenuTreeNode; + var treeParentNode = parentNode as MenuTreeNode; switch (treeParentNode?.Item) { @@ -904,8 +900,8 @@ private void AddNewItem(KryptonContextMenuItemBase item) // If adding a menu item to an items if (item is KryptonContextMenuItem) { - MenuTreeNode treeSelectedNode = selectedNode as MenuTreeNode; - KryptonContextMenuItems items = treeSelectedNode?.Item as KryptonContextMenuItems; + var treeSelectedNode = selectedNode as MenuTreeNode; + var items = treeSelectedNode?.Item as KryptonContextMenuItems; items.Items.Add(item); selectedNode.Nodes.Add(newNode); } @@ -919,7 +915,7 @@ private void AddNewItem(KryptonContextMenuItemBase item) { var index = selectedNode.Parent.Nodes.IndexOf(selectedNode); TreeNode parentNode = selectedNode.Parent; - MenuTreeNode treeParentNode = parentNode as MenuTreeNode; + var treeParentNode = parentNode as MenuTreeNode; switch (treeParentNode?.Item) { @@ -931,9 +927,9 @@ private void AddNewItem(KryptonContextMenuItemBase item) } else { - MenuTreeNode treeSelectedNode = selectedNode as MenuTreeNode; + var treeSelectedNode = selectedNode as MenuTreeNode; Debug.Assert(treeSelectedNode?.Item is KryptonContextMenuItem); - KryptonContextMenuItem items = treeSelectedNode?.Item as KryptonContextMenuItem; + var items = treeSelectedNode?.Item as KryptonContextMenuItem; items.Items.Add(item); selectedNode.Nodes.Add(newNode); } @@ -946,9 +942,9 @@ private void AddNewItem(KryptonContextMenuItemBase item) } else { - MenuTreeNode treeSelectedNode = selectedNode as MenuTreeNode; + var treeSelectedNode = selectedNode as MenuTreeNode; Debug.Assert(treeSelectedNode?.Item is KryptonContextMenuItems); - KryptonContextMenuItems items = treeSelectedNode?.Item as KryptonContextMenuItems; + var items = treeSelectedNode?.Item as KryptonContextMenuItems; items.Items.Add(item); selectedNode.Nodes.Add(newNode); } @@ -1112,7 +1108,7 @@ private void SynchronizeCollections(DictItemBase before, context.Container?.Remove(item); } - IComponentChangeService? changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService)); + var changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService)); if (changeService != null) { // Mark components as changed when not added or removed diff --git a/Source/Krypton Components/Krypton.Toolkit/General/BlurManager.cs b/Source/Krypton Components/Krypton.Toolkit/General/BlurManager.cs index bf0b89fb5..357b9606e 100644 --- a/Source/Krypton Components/Krypton.Toolkit/General/BlurManager.cs +++ b/Source/Krypton Components/Krypton.Toolkit/General/BlurManager.cs @@ -93,13 +93,13 @@ public bool IsOverlapped() return false; } - IntPtr hWnd = _parentForm.Handle; + var hWnd = _parentForm.Handle; // The set is used to make calling GetWindow in a loop stable by checking if we have already // visited the window returned by GetWindow. This avoids the possibility of an infinite loop. var visited = new HashSet { hWnd }; try { - Form? activeForm = Form.ActiveForm; + var activeForm = Form.ActiveForm; if (activeForm != null) { visited.Add(activeForm.Handle); diff --git a/Source/Krypton Components/Krypton.Toolkit/General/CommonHelper.cs b/Source/Krypton Components/Krypton.Toolkit/General/CommonHelper.cs index 7a92ef82c..bfbe5d37e 100644 --- a/Source/Krypton Components/Krypton.Toolkit/General/CommonHelper.cs +++ b/Source/Krypton Components/Krypton.Toolkit/General/CommonHelper.cs @@ -101,12 +101,12 @@ public static int NextId /// /// Gets a string that is guaranteed to be unique. /// - public static string? UniqueString + public static string UniqueString { get { // Generate a GUID that is guaranteed to be unique - Guid guid = Guid.NewGuid(); + var guid = Guid.NewGuid(); // Return as a hex formatted string. return guid.ToString(@"N"); } @@ -148,8 +148,8 @@ public static bool CheckContextMenuForShortcut(ContextMenuStrip? cms, } // Get any menu item from context strip that matches the shortcut key combination - Hashtable shortcuts = (Hashtable)_cachedShortcutPI!.GetValue(cms, null); - ToolStripMenuItem? menuItem = (ToolStripMenuItem)shortcuts[keyData]; + var shortcuts = (Hashtable)_cachedShortcutPI!.GetValue(cms, null); + var menuItem = (ToolStripMenuItem)shortcuts[keyData]; // If we found a match... if (menuItem != null) @@ -360,10 +360,7 @@ public static Padding OrientatePadding(VisualOrientation orientation, /// /// Rectangle to modify. [DebuggerStepThrough] - public static void SwapRectangleSizes(ref Rectangle rect) - { - (rect.Width, rect.Height) = (rect.Height, rect.Width); - } + public static void SwapRectangleSizes(ref Rectangle rect) => (rect.Width, rect.Height) = (rect.Height, rect.Width); /// /// Gets the form level right to left setting. @@ -377,7 +374,7 @@ public static bool GetRightToLeftLayout(Control control) // We need a valid control to find a top level form // Search for a top level form associated with the control - Form? topForm = control?.FindForm(); + Form? topForm = control.FindForm(); // If can find an owning form if (topForm != null) @@ -558,7 +555,7 @@ public static PaletteDrawBorders OrientateDrawBorders(PaletteDrawBorders borders return borders; } - PaletteDrawBorders ret = PaletteDrawBorders.None; + var ret = PaletteDrawBorders.None; // Apply orientation change to each side in turn switch (orientation) @@ -662,7 +659,7 @@ public static PaletteDrawBorders ReverseOrientateDrawBorders(PaletteDrawBorders return borders; } - PaletteDrawBorders ret = PaletteDrawBorders.None; + var ret = PaletteDrawBorders.None; // Apply orientation change to each side in turn switch (orientation) @@ -1050,7 +1047,7 @@ public static Color MergeColors(Color color1, float percent1, public static int ColorDepth() { // Get access to the desktop DC - IntPtr desktopDC = PI.GetDC(IntPtr.Zero); + var desktopDC = PI.GetDC(IntPtr.Zero); // Find raw values that define the color depth var planes = PI.GetDeviceCaps(desktopDC, PI.DeviceCap.PLANES); @@ -1124,14 +1121,14 @@ public static void AddControlToParent([DisallowNull] Control parent, [DisallowNu Debug.Assert(c != null); // If the control is already inside a control collection, then remove it - if (c.Parent != null) + if (c!.Parent != null) { RemoveControlFromParent(c); } // Then must use the internal method for adding a new instance // If the control collection is one of our internal collections... - if (parent.Controls is KryptonControlCollection cc) + if (parent!.Controls is KryptonControlCollection cc) { cc.AddInternal(c); } @@ -1151,7 +1148,7 @@ public static void RemoveControlFromParent([DisallowNull] Control c) Debug.Assert(c != null); // If the control is inside a parent collection - if (c.Parent != null) + if (c!.Parent != null) { // Then must use the internal method for adding a new instance // If the control collection is one of our internal collections... @@ -1466,7 +1463,7 @@ public static bool DesignMode(Component? c) /// /// Size to convert. /// Culture invariant string representation. - public static string? SizeToString(Size s) => _sc.ConvertToInvariantString(s); + public static string SizeToString(Size s) => _sc.ConvertToInvariantString(s); /// /// Convert a culture invariant string value to a Size. @@ -1494,21 +1491,21 @@ public static bool DesignMode(Component? c) /// /// Boolean to convert. /// Culture invariant string representation. - public static string? BoolToString(bool b) => _bc.ConvertToInvariantString(b); + public static string BoolToString(bool b) => _bc.ConvertToInvariantString(b); /// /// Convert a culture invariant string value to a Boolean. /// /// String to convert. /// Boolean value. - public static bool StringToBool(string? s) => (bool)_bc.ConvertFromInvariantString(s); + public static bool StringToBool(string s) => (bool)_bc.ConvertFromInvariantString(s); /// /// Convert a Color to a culture invariant string value. /// /// Color to convert. /// Culture invariant string representation. - public static string? ColorToString(Color c) => _cc.ConvertToInvariantString(c); + public static string ColorToString(Color c) => _cc.ConvertToInvariantString(c); /// /// Convert a culture invariant string value to a Color. diff --git a/Source/Krypton Components/Krypton.Toolkit/General/PlatformInvoke.cs b/Source/Krypton Components/Krypton.Toolkit/General/PlatformInvoke.cs index c26c92954..348e70ae3 100644 --- a/Source/Krypton Components/Krypton.Toolkit/General/PlatformInvoke.cs +++ b/Source/Krypton Components/Krypton.Toolkit/General/PlatformInvoke.cs @@ -63,15 +63,13 @@ internal static class Libraries internal sealed class SafeModuleHandle : SafeHandleZeroOrMinusOneIsInvalid { // A default constructor is required for P/Invoke to instantiate the class + // ReSharper disable once ConvertToPrimaryConstructor public SafeModuleHandle() : base(true) { } - protected override bool ReleaseHandle() - { - return PI.FreeLibrary(handle); - } + protected override bool ReleaseHandle() => PI.FreeLibrary(handle); } internal partial class PI diff --git a/Source/Krypton Components/Krypton.Toolkit/General/Scroll Bars/HScrollSkin.cs b/Source/Krypton Components/Krypton.Toolkit/General/Scroll Bars/HScrollSkin.cs index 1c8daed19..b0a23d70e 100644 --- a/Source/Krypton Components/Krypton.Toolkit/General/Scroll Bars/HScrollSkin.cs +++ b/Source/Krypton Components/Krypton.Toolkit/General/Scroll Bars/HScrollSkin.cs @@ -188,7 +188,7 @@ public void scrollSkin_ControlAdded(object sender, ControlEventArgs e) _win = e.Control; if (_win.GetType() == typeof(DataGridView) || (_win.GetType() == typeof(KryptonDataGridView))) { - DataGridView dgv = (DataGridView)_win; + var dgv = (DataGridView)_win; dgv.Scroll += dgv_Scroll; foreach (Control control in dgv.Controls) @@ -227,7 +227,7 @@ private void HScrollBar1_miScroll(object sender, ScrollEventArgs e) { if (_win.GetType() == typeof(ListView)) { - ListView listView1 = (ListView)_win; + var listView1 = (ListView)_win; var nIsAt = PI.GetScrollPos(listView1.Handle, PI.SB_.HORZ); var nShouldBeAt = (int)e.NewValue; @@ -242,7 +242,7 @@ private void HScrollBar1_miScroll(object sender, ScrollEventArgs e) { if (_win.GetType() == typeof(DataGridView) || (_win.GetType() == typeof(KryptonDataGridView))) { - DataGridView dgv = (DataGridView)_win; + var dgv = (DataGridView)_win; if (GetDGVScrollbar(ref dgv, out HSB)) { foreach (Control control in dgv.Controls) @@ -317,7 +317,7 @@ private void HScrollBar1_miScroll(object sender, ScrollEventArgs e) private void HorizontalScrollBar_VisibleChanged(object sender, EventArgs e) { - HScrollBar hscroll = (HScrollBar)sender; + var hscroll = (HScrollBar)sender; if (hscroll.Visible) { _HScrollBar1.Visible = true; @@ -330,7 +330,7 @@ private void HorizontalScrollBar_VisibleChanged(object sender, EventArgs e) private void VerticalScrollBar_VisibleChanged(object sender, EventArgs e) { - VScrollBar vscroll = (VScrollBar)sender; + var vscroll = (VScrollBar)sender; if (vscroll.Visible) { _VScrollBar1.Visible = true; @@ -347,7 +347,7 @@ private void VerticalScrollBar_VisibleChanged(object sender, EventArgs e) private void dgv_Scroll(object sender, ScrollEventArgs e) { - DataGridView dgv = (DataGridView)sender; + var dgv = (DataGridView)sender; if (GetDGVScrollbar(ref dgv, out HSB)) { if (HSB.Visible == true) diff --git a/Source/Krypton Components/Krypton.Toolkit/General/Scroll Bars/VScrollSkin.cs b/Source/Krypton Components/Krypton.Toolkit/General/Scroll Bars/VScrollSkin.cs index 33890bb87..f717fdb0c 100644 --- a/Source/Krypton Components/Krypton.Toolkit/General/Scroll Bars/VScrollSkin.cs +++ b/Source/Krypton Components/Krypton.Toolkit/General/Scroll Bars/VScrollSkin.cs @@ -187,7 +187,7 @@ private void scrollSkin_ControlAdded(object sender, ControlEventArgs e) _win = e.Control; if (_win.GetType() == typeof(DataGridView) || (_win.GetType() == typeof(KryptonDataGridView))) { - DataGridView dgv = (DataGridView)_win; + var dgv = (DataGridView)_win; dgv.Scroll += dgv_Scroll; foreach (Control control in dgv.Controls) @@ -219,10 +219,10 @@ private void VScrollBar1_miScroll(object sender, ScrollEventArgs e) { if (_win.GetType() == typeof(ListView)) { - ListView listView1 = (ListView)_win; + var listView1 = (ListView)_win; - IntPtr min = IntPtr.Zero; - IntPtr max = IntPtr.Zero; + var min = IntPtr.Zero; + var max = IntPtr.Zero; PI.GetScrollRange(listView1.Handle, PI.SB_.VERT, ref min, ref max); var nMax = max.ToInt32(); @@ -262,7 +262,7 @@ private void VScrollBar1_miScroll(object sender, ScrollEventArgs e) { if (_win.GetType() == typeof(DataGridView) || (_win.GetType() == typeof(KryptonDataGridView))) { - DataGridView dgv = (DataGridView)_win; + var dgv = (DataGridView)_win; if (GetDGVScrollbar(ref dgv, out VSB)) { foreach (Control control in dgv.Controls) @@ -343,7 +343,7 @@ private void HScrollBar1_miScroll(object sender, ScrollEventArgs e) { if (_win.GetType() == typeof(ListView)) { - ListView listView1 = (ListView)_win; + var listView1 = (ListView)_win; var nIsAt = PI.GetScrollPos(listView1.Handle, PI.SB_.HORZ); var nShouldBeAt = (int)e.NewValue; @@ -358,7 +358,7 @@ private void HScrollBar1_miScroll(object sender, ScrollEventArgs e) { if (_win.GetType() == typeof(DataGridView) || (_win.GetType() == typeof(KryptonDataGridView))) { - DataGridView dgv = (DataGridView)_win; + var dgv = (DataGridView)_win; if (GetDGHScrollbar(ref dgv, out HSC)) { foreach (Control control in dgv.Controls) @@ -427,7 +427,7 @@ private void HScrollBar1_miScroll(object sender, ScrollEventArgs e) private void VerticalScrollBar_VisibleChanged(object sender, EventArgs e) { - VScrollBar vscroll = (VScrollBar)sender; + var vscroll = (VScrollBar)sender; if (vscroll.Visible) { _vScrollBar1.Visible = true; @@ -440,7 +440,7 @@ private void VerticalScrollBar_VisibleChanged(object sender, EventArgs e) private void HorizontalScrollBar_VisibleChanged(object sender, EventArgs e) { - HScrollBar hscroll = (HScrollBar)sender; + var hscroll = (HScrollBar)sender; if (hscroll.Visible) { _hScrollBar1.Visible = true; @@ -457,7 +457,7 @@ private void HorizontalScrollBar_VisibleChanged(object sender, EventArgs e) private void dgv_Scroll(object sender, ScrollEventArgs e) { - DataGridView dgv = (DataGridView)_win; + var dgv = (DataGridView)_win; if (GetDGVScrollbar(ref dgv, out VSB)) { if (VSB.Visible == true) diff --git a/Source/Krypton Components/Krypton.Toolkit/General/ShadowManager.cs b/Source/Krypton Components/Krypton.Toolkit/General/ShadowManager.cs index 01f10a923..0fb095cc3 100644 --- a/Source/Krypton Components/Krypton.Toolkit/General/ShadowManager.cs +++ b/Source/Krypton Components/Krypton.Toolkit/General/ShadowManager.cs @@ -287,7 +287,7 @@ void Mi() Point desktopLocation = _parentForm.DesktopLocation; - IntPtr hWinPosInfo = PI.BeginDeferWindowPos(_shadowForms.Length); + var hWinPosInfo = PI.BeginDeferWindowPos(_shadowForms.Length); foreach (VisualShadowBase shadowForm in _shadowForms) { diff --git a/Source/Krypton Components/Krypton.Toolkit/General/TypedRestrictCollection.cs b/Source/Krypton Components/Krypton.Toolkit/General/TypedRestrictCollection.cs index c62a905ff..9b3e7ef31 100644 --- a/Source/Krypton Components/Krypton.Toolkit/General/TypedRestrictCollection.cs +++ b/Source/Krypton Components/Krypton.Toolkit/General/TypedRestrictCollection.cs @@ -30,12 +30,10 @@ public abstract class TypedRestrictCollection : TypedCollection where T : /// /// Instance to test. /// True if allowed; otherwise false. - protected bool IsTypeAllowed(object value) - { + protected bool IsTypeAllowed(object value) => // Check if incoming instance derives from an allowed type - return RestrictTypes.Any(t => t.IsInstanceOfType(value)); - } + RestrictTypes.Any(t => t.IsInstanceOfType(value)); /// /// Append an item to the collection. diff --git a/Source/Krypton Components/Krypton.Toolkit/General/XmlHelper.cs b/Source/Krypton Components/Krypton.Toolkit/General/XmlHelper.cs index e4697d978..169ba468d 100644 --- a/Source/Krypton Components/Krypton.Toolkit/General/XmlHelper.cs +++ b/Source/Krypton Components/Krypton.Toolkit/General/XmlHelper.cs @@ -24,7 +24,7 @@ public static class XmlHelper /// Attribute name. /// Attribute value. /// Default value. - public static void TextToXmlAttribute(XmlWriter xmlWriter, string name, string? value, string defaultValue = @"") + public static void TextToXmlAttribute(XmlWriter xmlWriter, string name, string value, string defaultValue = @"") { if (!string.IsNullOrEmpty(value) && (value != defaultValue)) { @@ -39,7 +39,7 @@ public static void TextToXmlAttribute(XmlWriter xmlWriter, string name, string? /// Attribute name. /// Default value. /// - public static string? XmlAttributeToText(XmlReader xmlReader, string name, string? defaultValue = @"") + public static string XmlAttributeToText(XmlReader xmlReader, string name, string defaultValue = @"") { try { diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteBack/PaletteBack.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteBack/PaletteBack.cs index 4aa4cc578..65306d4a0 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteBack/PaletteBack.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteBack/PaletteBack.cs @@ -66,7 +66,7 @@ public InternalStorage() #endregion #region Instance Fields - private IPaletteBack? _inherit; + private IPaletteBack _inherit; private InternalStorage? _storage; #endregion @@ -85,8 +85,8 @@ public InternalStorage() /// /// Source for inheriting defaulted values. /// Delegate for notifying paint requests. - public PaletteBack(IPaletteBack? inherit, - NeedPaintHandler? needPaint) + public PaletteBack(IPaletteBack inherit, + NeedPaintHandler needPaint) { // Remember inheritance _inherit = inherit; @@ -109,10 +109,7 @@ public PaletteBack(IPaletteBack? inherit, /// /// Sets the inheritance parent. /// - public void SetInherit(IPaletteBack inherit) - { - _inherit = inherit; - } + public void SetInherit(IPaletteBack inherit) => _inherit = inherit; #endregion #region PopulateFromBase diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteBack/PaletteBackColor1.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteBack/PaletteBackColor1.cs index 08cfbb8f5..590e3b364 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteBack/PaletteBackColor1.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteBack/PaletteBackColor1.cs @@ -35,11 +35,9 @@ public PaletteBackColor1(IPaletteBack inherit, /// Populate values from the base palette. /// /// Palette state to use when populating. - public new void PopulateFromBase(PaletteState state) - { + public new void PopulateFromBase(PaletteState state) => // Get the values and set into storage Color1 = GetBackColor1(state); - } #endregion #region Draw diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteBack/PaletteBackInheritRedirect.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteBack/PaletteBackInheritRedirect.cs index 05b2ea2c9..15318fc3a 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteBack/PaletteBackInheritRedirect.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteBack/PaletteBackInheritRedirect.cs @@ -59,10 +59,7 @@ public PaletteBackInheritRedirect(PaletteRedirect? redirect, /// Update the redirector with new reference. /// /// Target redirector. - public void SetRedirector(PaletteRedirect? redirect) - { - _redirect = redirect; - } + public void SetRedirector(PaletteRedirect? redirect) => _redirect = redirect; #endregion #region Style diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteBorder/PaletteBorder.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteBorder/PaletteBorder.cs index fb9094fe1..97179743e 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteBorder/PaletteBorder.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteBorder/PaletteBorder.cs @@ -120,10 +120,7 @@ public PaletteBorder([DisallowNull] IPaletteBorder inherit, /// /// Sets the inheritance parent. /// - public void SetInherit(IPaletteBorder inherit) - { - _inherit = inherit; - } + public void SetInherit(IPaletteBorder inherit) => _inherit = inherit; #endregion #region PopulateFromBase diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteBorder/PaletteBorderInheritRedirect.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteBorder/PaletteBorderInheritRedirect.cs index aac1a5df5..67a7cfb49 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteBorder/PaletteBorderInheritRedirect.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteBorder/PaletteBorderInheritRedirect.cs @@ -67,10 +67,7 @@ public PaletteBorderInheritRedirect(PaletteRedirect? redirect, /// Update the redirector with new reference. /// /// Target redirector. - public void SetRedirector(PaletteRedirect? redirect) - { - _redirect = redirect; - } + public void SetRedirector(PaletteRedirect? redirect) => _redirect = redirect; #endregion #region Style diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteContent/PaletteContent.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteContent/PaletteContent.cs index 4e6d7a733..6aeedff82 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteContent/PaletteContent.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteContent/PaletteContent.cs @@ -114,10 +114,7 @@ public PaletteContent([DisallowNull] IPaletteContent inherit, /// /// Sets the inheritance parent. /// - public void SetInherit(IPaletteContent inherit) - { - _inherit = inherit; - } + public void SetInherit(IPaletteContent inherit) => _inherit = inherit; #endregion #region PopulateFromBase @@ -707,10 +704,7 @@ public virtual Padding Padding /// /// Reset the Padding to the default value. /// - public void ResetPadding() - { - Padding = CommonHelper.InheritPadding; - } + public void ResetPadding() => Padding = CommonHelper.InheritPadding; /// /// Gets the actual padding between the border and content drawing. diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteContent/PaletteContentInheritRedirect.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteContent/PaletteContentInheritRedirect.cs index 35c4adfe8..f1f5b8789 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteContent/PaletteContentInheritRedirect.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteContent/PaletteContentInheritRedirect.cs @@ -68,10 +68,7 @@ public PaletteContentInheritRedirect(PaletteRedirect? redirect, /// Update the redirector with new reference. /// /// Target redirector. - public void SetRedirector(PaletteRedirect? redirect) - { - _redirect = redirect; - } + public void SetRedirector(PaletteRedirect? redirect) => _redirect = redirect; #endregion #region Style diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteDragDrop/PaletteDragDrop.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteDragDrop/PaletteDragDrop.cs index 3b85f05e1..b09f92634 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteDragDrop/PaletteDragDrop.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteDragDrop/PaletteDragDrop.cs @@ -77,10 +77,7 @@ public PaletteDragDrop(PaletteBase? inherit, /// /// Sets the inheritance parent. /// - public void SetInherit(PaletteBase? inherit) - { - _inherit = inherit; - } + public void SetInherit(PaletteBase? inherit) => _inherit = inherit; #endregion #region PopulateFromBase @@ -126,21 +123,15 @@ public PaletteDragFeedback Feedback /// /// Resets the Feedback property to its default value. /// - public void ResetFeedback() - { - Feedback = PaletteDragFeedback.Inherit; - } + public void ResetFeedback() => Feedback = PaletteDragFeedback.Inherit; /// /// Gets the feedback drawing method used. /// /// Color value. - public PaletteDragFeedback GetDragDropFeedback() - { - return Feedback != PaletteDragFeedback.Inherit - ? Feedback + public PaletteDragFeedback GetDragDropFeedback() => Feedback != PaletteDragFeedback.Inherit + ? Feedback : _inherit?.GetDragDropFeedback() ?? PaletteDragFeedback.Rounded; - } #endregion @@ -176,12 +167,9 @@ public Color SolidBack /// Gets the background color for a solid drag drop area. /// /// Color value. - public Color GetDragDropSolidBack() - { - return SolidBack != Color.Empty - ? SolidBack + public Color GetDragDropSolidBack() => SolidBack != Color.Empty + ? SolidBack : _inherit?.GetDragDropSolidBack() ?? SystemColors.ActiveCaption; - } #endregion @@ -217,12 +205,9 @@ public Color SolidBorder /// Gets the border color for a solid drag drop area. /// /// Color value. - public Color GetDragDropSolidBorder() - { - return SolidBorder != Color.Empty - ? SolidBorder + public Color GetDragDropSolidBorder() => SolidBorder != Color.Empty + ? SolidBorder : _inherit?.GetDragDropSolidBorder() ?? SystemColors.Control; - } #endregion @@ -258,12 +243,9 @@ public float SolidOpacity /// Gets the opacity of the solid area. /// /// Opacity ranging from 0 to 1. - public virtual float GetDragDropSolidOpacity() - { - return SolidOpacity >= 0.0f - ? SolidOpacity + public virtual float GetDragDropSolidOpacity() => SolidOpacity >= 0.0f + ? SolidOpacity : _inherit?.GetDragDropSolidOpacity() ?? 0.37f; - } #endregion @@ -300,12 +282,9 @@ public Color DropDockBack /// Gets the background color for the docking indicators area. /// /// Color value. - public Color GetDragDropDockBack() - { - return DropDockBack != Color.Empty - ? DropDockBack + public Color GetDragDropDockBack() => DropDockBack != Color.Empty + ? DropDockBack : _inherit?.GetDragDropDockBack() ?? Color.FromArgb(228, 228, 228); - } #endregion @@ -341,12 +320,9 @@ public Color DropDockBorder /// Gets the border color for the docking indicators area. /// /// Color value. - public Color GetDragDropDockBorder() - { - return DropDockBorder != Color.Empty - ? DropDockBorder + public Color GetDragDropDockBorder() => DropDockBorder != Color.Empty + ? DropDockBorder : _inherit?.GetDragDropDockBorder() ?? Color.FromArgb(181, 181, 181); - } #endregion @@ -382,12 +358,9 @@ public Color DropDockActive /// Gets the active color for docking indicators. /// /// Color value. - public Color GetDragDropDockActive() - { - return DropDockActive != Color.Empty - ? DropDockActive + public Color GetDragDropDockActive() => DropDockActive != Color.Empty + ? DropDockActive : _inherit?.GetDragDropDockActive() ?? SystemColors.ActiveCaption; - } #endregion @@ -423,12 +396,9 @@ public Color DropDockInactive /// Gets the inactive color for docking indicators. /// /// Color value. - public Color GetDragDropDockInactive() - { - return DropDockInactive != Color.Empty - ? DropDockInactive + public Color GetDragDropDockInactive() => DropDockInactive != Color.Empty + ? DropDockInactive : _inherit?.GetDragDropDockInactive() ?? SystemColors.InactiveCaption; - } #endregion } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteElementColor/PaletteElementColor.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteElementColor/PaletteElementColor.cs index d91f621fd..1869d9239 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteElementColor/PaletteElementColor.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteElementColor/PaletteElementColor.cs @@ -68,10 +68,7 @@ public PaletteElementColor(IPaletteElementColor inheritElementColor, /// /// Sets the inheritance parent. /// - public void SetInherit(IPaletteElementColor inheritElementColor) - { - _inheritElementColor = inheritElementColor; - } + public void SetInherit(IPaletteElementColor inheritElementColor) => _inheritElementColor = inheritElementColor; #endregion #region PopulateFromBase diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteElementColor/PaletteElementColorInheritRedirect.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteElementColor/PaletteElementColorInheritRedirect.cs index abfe14a58..bc23403fb 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteElementColor/PaletteElementColorInheritRedirect.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteElementColor/PaletteElementColorInheritRedirect.cs @@ -43,10 +43,7 @@ public PaletteElementColorInheritRedirect([DisallowNull] PaletteRedirect redirec /// Update the redirector with new reference. /// /// Target redirector. - public void SetRedirector(PaletteRedirect? redirect) - { - _redirect = redirect; - } + public void SetRedirector(PaletteRedirect? redirect) => _redirect = redirect; #endregion #region StyleBack diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteMetric/PaletteMetricRedirect.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteMetric/PaletteMetricRedirect.cs index 9a67332d0..b529d2f71 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteMetric/PaletteMetricRedirect.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteMetric/PaletteMetricRedirect.cs @@ -41,10 +41,7 @@ public PaletteMetricRedirect([DisallowNull] PaletteRedirect? redirect) /// Update the redirector with new reference. /// /// Target redirector. - public virtual void SetRedirector(PaletteRedirect? redirect) - { - _redirect = redirect; - } + public virtual void SetRedirector(PaletteRedirect? redirect) => _redirect = redirect; #endregion #region IsDefault diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteRedirect/PaletteRedirect.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteRedirect/PaletteRedirect.cs index 5eb4d6f6d..4a1516fac 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteRedirect/PaletteRedirect.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Base/PaletteRedirect/PaletteRedirect.cs @@ -1085,10 +1085,7 @@ public virtual PaletteBase? Target #region ColorTable /// - protected override void DefineFonts() - { - throw new NotImplementedException(); - } + protected override void DefineFonts() => throw new NotImplementedException(); /// /// Gets access to the color table instance. diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Base/PaletteBase.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Base/PaletteBase.cs index 257d47541..0186a1fe1 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Base/PaletteBase.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Base/PaletteBase.cs @@ -1284,7 +1284,7 @@ public static Color MergeColors(Color color1, float percent1, public static Color FadedColor(Color baseColor) { // Convert to HSL space - var hsl = new ColorHSL(baseColor) + ColorHSL hsl = new ColorHSL(baseColor) { // Remove saturation and fix luminance @@ -1307,7 +1307,7 @@ protected virtual Padding InputControlPadding if (!_inputControlPadding.HasValue) { // Find size of a input control with and without a border - var tb = new TextBox + TextBox tb = new TextBox { BorderStyle = BorderStyle.None }; @@ -1316,7 +1316,7 @@ protected virtual Padding InputControlPadding Size ss = tb.GetPreferredSize(new Size(int.MaxValue, int.MaxValue)); // Always subtract one from top and bottom edges to account for border placed there later by Krypton - var inputControlPadding = new Padding(0); + Padding inputControlPadding = new Padding(0); var xDiff = Math.Max(0, ss.Width - sn.Width); var yDiff = Math.Max(0, ss.Height - sn.Height - 2); @@ -1378,11 +1378,9 @@ protected virtual void OnUserPreferenceChanged(object sender, UserPreferenceChan /// /// Source of the event. /// An PaletteLayoutEventArgs containing event data. - protected virtual void OnPalettePaint(object sender, PaletteLayoutEventArgs e) - { + protected virtual void OnPalettePaint(object sender, PaletteLayoutEventArgs e) => // https://github.com/Krypton-Suite/Standard-Toolkit/issues/1023#issuecomment-1588810368 PalettePaint?.Invoke(this, e); - } #endregion @@ -1393,10 +1391,7 @@ protected virtual void OnPalettePaint(object sender, PaletteLayoutEventArgs e) /// /// Source of the event. /// An EventArgs containing event data. - protected virtual void OnAllowFormChromeChanged(object sender, EventArgs e) - { - AllowFormChromeChanged?.Invoke(this, e); - } + protected virtual void OnAllowFormChromeChanged(object sender, EventArgs e) => AllowFormChromeChanged?.Invoke(this, e); #endregion @@ -1407,10 +1402,7 @@ protected virtual void OnAllowFormChromeChanged(object sender, EventArgs e) /// /// Source of the event. /// An EventArgs containing event data. - protected virtual void OnBasePaletteChanged(object sender, EventArgs e) - { - BasePaletteChanged?.Invoke(this, e); - } + protected virtual void OnBasePaletteChanged(object sender, EventArgs e) => BasePaletteChanged?.Invoke(this, e); #endregion @@ -1420,10 +1412,7 @@ protected virtual void OnBasePaletteChanged(object sender, EventArgs e) /// /// Source of the event. /// An EventArgs containing event data. - protected virtual void OnBaseRendererChanged(object sender, EventArgs e) - { - BaseRendererChanged?.Invoke(this, e); - } + protected virtual void OnBaseRendererChanged(object sender, EventArgs e) => BaseRendererChanged?.Invoke(this, e); #endregion @@ -1433,10 +1422,7 @@ protected virtual void OnBaseRendererChanged(object sender, EventArgs e) /// /// Source of the event. /// An EventArgs containing event data. - protected virtual void OnButtonSpecChanged(object sender, EventArgs e) - { - ButtonSpecChanged?.Invoke(this, e); - } + protected virtual void OnButtonSpecChanged(object sender, EventArgs e) => ButtonSpecChanged?.Invoke(this, e); #endregion } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Bases/PaletteMicrosoft365Base.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Bases/PaletteMicrosoft365Base.cs index 1c55441cd..c1e575886 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Bases/PaletteMicrosoft365Base.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Bases/PaletteMicrosoft365Base.cs @@ -3092,15 +3092,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Extra Themes/PaletteMicrosoft365BlackDarkMode.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Extra Themes/PaletteMicrosoft365BlackDarkMode.cs index dfd3ea824..6f2c50aca 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Extra Themes/PaletteMicrosoft365BlackDarkMode.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Extra Themes/PaletteMicrosoft365BlackDarkMode.cs @@ -418,137 +418,134 @@ public PaletteMicrosoft365BlackDarkMode() : base(_schemeOfficeColors, _checkBoxL /// /// Image value. /// - public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) + public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) => style switch { - return style switch - { - PaletteButtonSpecStyle.PendantClose => _buttonSpecPendantClose, - PaletteButtonSpecStyle.PendantMin => _buttonSpecPendantMin, - PaletteButtonSpecStyle.PendantRestore => _buttonSpecPendantRestore, - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - PaletteButtonSpecStyle.New => state switch - { - PaletteState.Normal => _integratedToolbarNewNormal, - PaletteState.Disabled => _integratedToolbarNewDisabled, - _ => _integratedToolbarNewDisabled - }, - PaletteButtonSpecStyle.Open => state switch - { - PaletteState.Normal => _integratedToolbarOpenNormal, - PaletteState.Disabled => _integratedToolbarOpenDisabled, - _ => _integratedToolbarOpenDisabled - }, - PaletteButtonSpecStyle.SaveAll => state switch - { - PaletteState.Normal => _integratedToolbarSaveAllNormal, - PaletteState.Disabled => _integratedToolbarSaveAllDisabled, - _ => _integratedToolbarSaveAllDisabled - }, - PaletteButtonSpecStyle.SaveAs => state switch - { - PaletteState.Normal => _integratedToolbarSaveAsNormal, - PaletteState.Disabled => _integratedToolbarSaveAsDisabled, - _ => _integratedToolbarSaveAsDisabled - }, - PaletteButtonSpecStyle.Save => state switch - { - PaletteState.Normal => _integratedToolbarSaveNormal, - PaletteState.Disabled => _integratedToolbarSaveDisabled, - _ => _integratedToolbarSaveDisabled - }, - PaletteButtonSpecStyle.Cut => state switch - { - PaletteState.Normal => _integratedToolbarCutNormal, - PaletteState.Disabled => _integratedToolbarCutDisabled, - _ => _integratedToolbarCutDisabled - }, - PaletteButtonSpecStyle.Copy => state switch - { - PaletteState.Normal => _integratedToolbarCopyNormal, - PaletteState.Disabled => _integratedToolbarCopyDisabled, - _ => _integratedToolbarCopyDisabled - }, - PaletteButtonSpecStyle.Paste => state switch - { - PaletteState.Normal => _integratedToolbarPasteNormal, - PaletteState.Disabled => _integratedToolbarPasteDisabled, - _ => _integratedToolbarPasteDisabled - }, - PaletteButtonSpecStyle.Undo => state switch - { - PaletteState.Normal => _integratedToolbarUndoNormal, - PaletteState.Disabled => _integratedToolbarUndoDisabled, - _ => _integratedToolbarUndoDisabled - }, - PaletteButtonSpecStyle.Redo => state switch - { - PaletteState.Normal => _integratedToolbarRedoNormal, - PaletteState.Disabled => _integratedToolbarRedoDisabled, - _ => _integratedToolbarRedoDisabled - }, - PaletteButtonSpecStyle.PageSetup => state switch - { - PaletteState.Normal => _integratedToolbarPageSetupNormal, - PaletteState.Disabled => _integratedToolbarPageSetupDisabled, - _ => _integratedToolbarPageSetupDisabled - }, - PaletteButtonSpecStyle.PrintPreview => state switch - { - PaletteState.Normal => _integratedToolbarPrintPreviewNormal, - PaletteState.Disabled => _integratedToolbarPrintPreviewDisabled, - _ => _integratedToolbarPrintPreviewDisabled - }, - PaletteButtonSpecStyle.Print => state switch - { - PaletteState.Normal => _integratedToolbarPrintNormal, - PaletteState.Disabled => _integratedToolbarPrintDisabled, - _ => _integratedToolbarPrintDisabled - }, - PaletteButtonSpecStyle.QuickPrint => state switch - { - PaletteState.Normal => _integratedToolbarQuickPrintNormal, - PaletteState.Disabled => _integratedToolbarQuickPrintDisabled, - _ => _integratedToolbarQuickPrintDisabled - }, - PaletteButtonSpecStyle.RibbonMinimize => _buttonSpecRibbonMinimize, - PaletteButtonSpecStyle.RibbonExpand => _buttonSpecRibbonExpand, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteButtonSpecStyle.PendantClose => _buttonSpecPendantClose, + PaletteButtonSpecStyle.PendantMin => _buttonSpecPendantMin, + PaletteButtonSpecStyle.PendantRestore => _buttonSpecPendantRestore, + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + PaletteButtonSpecStyle.New => state switch + { + PaletteState.Normal => _integratedToolbarNewNormal, + PaletteState.Disabled => _integratedToolbarNewDisabled, + _ => _integratedToolbarNewDisabled + }, + PaletteButtonSpecStyle.Open => state switch + { + PaletteState.Normal => _integratedToolbarOpenNormal, + PaletteState.Disabled => _integratedToolbarOpenDisabled, + _ => _integratedToolbarOpenDisabled + }, + PaletteButtonSpecStyle.SaveAll => state switch + { + PaletteState.Normal => _integratedToolbarSaveAllNormal, + PaletteState.Disabled => _integratedToolbarSaveAllDisabled, + _ => _integratedToolbarSaveAllDisabled + }, + PaletteButtonSpecStyle.SaveAs => state switch + { + PaletteState.Normal => _integratedToolbarSaveAsNormal, + PaletteState.Disabled => _integratedToolbarSaveAsDisabled, + _ => _integratedToolbarSaveAsDisabled + }, + PaletteButtonSpecStyle.Save => state switch + { + PaletteState.Normal => _integratedToolbarSaveNormal, + PaletteState.Disabled => _integratedToolbarSaveDisabled, + _ => _integratedToolbarSaveDisabled + }, + PaletteButtonSpecStyle.Cut => state switch + { + PaletteState.Normal => _integratedToolbarCutNormal, + PaletteState.Disabled => _integratedToolbarCutDisabled, + _ => _integratedToolbarCutDisabled + }, + PaletteButtonSpecStyle.Copy => state switch + { + PaletteState.Normal => _integratedToolbarCopyNormal, + PaletteState.Disabled => _integratedToolbarCopyDisabled, + _ => _integratedToolbarCopyDisabled + }, + PaletteButtonSpecStyle.Paste => state switch + { + PaletteState.Normal => _integratedToolbarPasteNormal, + PaletteState.Disabled => _integratedToolbarPasteDisabled, + _ => _integratedToolbarPasteDisabled + }, + PaletteButtonSpecStyle.Undo => state switch + { + PaletteState.Normal => _integratedToolbarUndoNormal, + PaletteState.Disabled => _integratedToolbarUndoDisabled, + _ => _integratedToolbarUndoDisabled + }, + PaletteButtonSpecStyle.Redo => state switch + { + PaletteState.Normal => _integratedToolbarRedoNormal, + PaletteState.Disabled => _integratedToolbarRedoDisabled, + _ => _integratedToolbarRedoDisabled + }, + PaletteButtonSpecStyle.PageSetup => state switch + { + PaletteState.Normal => _integratedToolbarPageSetupNormal, + PaletteState.Disabled => _integratedToolbarPageSetupDisabled, + _ => _integratedToolbarPageSetupDisabled + }, + PaletteButtonSpecStyle.PrintPreview => state switch + { + PaletteState.Normal => _integratedToolbarPrintPreviewNormal, + PaletteState.Disabled => _integratedToolbarPrintPreviewDisabled, + _ => _integratedToolbarPrintPreviewDisabled + }, + PaletteButtonSpecStyle.Print => state switch + { + PaletteState.Normal => _integratedToolbarPrintNormal, + PaletteState.Disabled => _integratedToolbarPrintDisabled, + _ => _integratedToolbarPrintDisabled + }, + PaletteButtonSpecStyle.QuickPrint => state switch + { + PaletteState.Normal => _integratedToolbarQuickPrintNormal, + PaletteState.Disabled => _integratedToolbarQuickPrintDisabled, + _ => _integratedToolbarQuickPrintDisabled + }, + PaletteButtonSpecStyle.RibbonMinimize => _buttonSpecRibbonMinimize, + PaletteButtonSpecStyle.RibbonExpand => _buttonSpecRibbonExpand, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } #endregion @@ -3718,15 +3715,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Extra Themes/PaletteMicrosoft365BlueDarkMode.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Extra Themes/PaletteMicrosoft365BlueDarkMode.cs index 902b2dffd..d25366f3c 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Extra Themes/PaletteMicrosoft365BlueDarkMode.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Extra Themes/PaletteMicrosoft365BlueDarkMode.cs @@ -416,132 +416,129 @@ public PaletteMicrosoft365BlueDarkMode() : base(_schemeOfficeColors, _checkBoxLi /// /// Image value. /// - public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) + public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) => style switch { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - PaletteButtonSpecStyle.New => state switch - { - PaletteState.Normal => _integratedToolbarNewNormal, - PaletteState.Disabled => _integratedToolbarNewDisabled, - _ => _integratedToolbarNewDisabled - }, - PaletteButtonSpecStyle.Open => state switch - { - PaletteState.Normal => _integratedToolbarOpenNormal, - PaletteState.Disabled => _integratedToolbarOpenDisabled, - _ => _integratedToolbarOpenDisabled - }, - PaletteButtonSpecStyle.SaveAll => state switch - { - PaletteState.Normal => _integratedToolbarSaveAllNormal, - PaletteState.Disabled => _integratedToolbarSaveAllDisabled, - _ => _integratedToolbarSaveAllDisabled - }, - PaletteButtonSpecStyle.SaveAs => state switch - { - PaletteState.Normal => _integratedToolbarSaveAsNormal, - PaletteState.Disabled => _integratedToolbarSaveAsDisabled, - _ => _integratedToolbarSaveAsDisabled - }, - PaletteButtonSpecStyle.Save => state switch - { - PaletteState.Normal => _integratedToolbarSaveNormal, - PaletteState.Disabled => _integratedToolbarSaveDisabled, - _ => _integratedToolbarSaveDisabled - }, - PaletteButtonSpecStyle.Cut => state switch - { - PaletteState.Normal => _integratedToolbarCutNormal, - PaletteState.Disabled => _integratedToolbarCutDisabled, - _ => _integratedToolbarCutDisabled - }, - PaletteButtonSpecStyle.Copy => state switch - { - PaletteState.Normal => _integratedToolbarCopyNormal, - PaletteState.Disabled => _integratedToolbarCopyDisabled, - _ => _integratedToolbarCopyDisabled - }, - PaletteButtonSpecStyle.Paste => state switch - { - PaletteState.Normal => _integratedToolbarPasteNormal, - PaletteState.Disabled => _integratedToolbarPasteDisabled, - _ => _integratedToolbarPasteDisabled - }, - PaletteButtonSpecStyle.Undo => state switch - { - PaletteState.Normal => _integratedToolbarUndoNormal, - PaletteState.Disabled => _integratedToolbarUndoDisabled, - _ => _integratedToolbarUndoDisabled - }, - PaletteButtonSpecStyle.Redo => state switch - { - PaletteState.Normal => _integratedToolbarRedoNormal, - PaletteState.Disabled => _integratedToolbarRedoDisabled, - _ => _integratedToolbarRedoDisabled - }, - PaletteButtonSpecStyle.PageSetup => state switch - { - PaletteState.Normal => _integratedToolbarPageSetupNormal, - PaletteState.Disabled => _integratedToolbarPageSetupDisabled, - _ => _integratedToolbarPageSetupDisabled - }, - PaletteButtonSpecStyle.PrintPreview => state switch - { - PaletteState.Normal => _integratedToolbarPrintPreviewNormal, - PaletteState.Disabled => _integratedToolbarPrintPreviewDisabled, - _ => _integratedToolbarPrintPreviewDisabled - }, - PaletteButtonSpecStyle.Print => state switch - { - PaletteState.Normal => _integratedToolbarPrintNormal, - PaletteState.Disabled => _integratedToolbarPrintDisabled, - _ => _integratedToolbarPrintDisabled - }, - PaletteButtonSpecStyle.QuickPrint => state switch - { - PaletteState.Normal => _integratedToolbarQuickPrintNormal, - PaletteState.Disabled => _integratedToolbarQuickPrintDisabled, - _ => _integratedToolbarQuickPrintDisabled - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + PaletteButtonSpecStyle.New => state switch + { + PaletteState.Normal => _integratedToolbarNewNormal, + PaletteState.Disabled => _integratedToolbarNewDisabled, + _ => _integratedToolbarNewDisabled + }, + PaletteButtonSpecStyle.Open => state switch + { + PaletteState.Normal => _integratedToolbarOpenNormal, + PaletteState.Disabled => _integratedToolbarOpenDisabled, + _ => _integratedToolbarOpenDisabled + }, + PaletteButtonSpecStyle.SaveAll => state switch + { + PaletteState.Normal => _integratedToolbarSaveAllNormal, + PaletteState.Disabled => _integratedToolbarSaveAllDisabled, + _ => _integratedToolbarSaveAllDisabled + }, + PaletteButtonSpecStyle.SaveAs => state switch + { + PaletteState.Normal => _integratedToolbarSaveAsNormal, + PaletteState.Disabled => _integratedToolbarSaveAsDisabled, + _ => _integratedToolbarSaveAsDisabled + }, + PaletteButtonSpecStyle.Save => state switch + { + PaletteState.Normal => _integratedToolbarSaveNormal, + PaletteState.Disabled => _integratedToolbarSaveDisabled, + _ => _integratedToolbarSaveDisabled + }, + PaletteButtonSpecStyle.Cut => state switch + { + PaletteState.Normal => _integratedToolbarCutNormal, + PaletteState.Disabled => _integratedToolbarCutDisabled, + _ => _integratedToolbarCutDisabled + }, + PaletteButtonSpecStyle.Copy => state switch + { + PaletteState.Normal => _integratedToolbarCopyNormal, + PaletteState.Disabled => _integratedToolbarCopyDisabled, + _ => _integratedToolbarCopyDisabled + }, + PaletteButtonSpecStyle.Paste => state switch + { + PaletteState.Normal => _integratedToolbarPasteNormal, + PaletteState.Disabled => _integratedToolbarPasteDisabled, + _ => _integratedToolbarPasteDisabled + }, + PaletteButtonSpecStyle.Undo => state switch + { + PaletteState.Normal => _integratedToolbarUndoNormal, + PaletteState.Disabled => _integratedToolbarUndoDisabled, + _ => _integratedToolbarUndoDisabled + }, + PaletteButtonSpecStyle.Redo => state switch + { + PaletteState.Normal => _integratedToolbarRedoNormal, + PaletteState.Disabled => _integratedToolbarRedoDisabled, + _ => _integratedToolbarRedoDisabled + }, + PaletteButtonSpecStyle.PageSetup => state switch + { + PaletteState.Normal => _integratedToolbarPageSetupNormal, + PaletteState.Disabled => _integratedToolbarPageSetupDisabled, + _ => _integratedToolbarPageSetupDisabled + }, + PaletteButtonSpecStyle.PrintPreview => state switch + { + PaletteState.Normal => _integratedToolbarPrintPreviewNormal, + PaletteState.Disabled => _integratedToolbarPrintPreviewDisabled, + _ => _integratedToolbarPrintPreviewDisabled + }, + PaletteButtonSpecStyle.Print => state switch + { + PaletteState.Normal => _integratedToolbarPrintNormal, + PaletteState.Disabled => _integratedToolbarPrintDisabled, + _ => _integratedToolbarPrintDisabled + }, + PaletteButtonSpecStyle.QuickPrint => state switch + { + PaletteState.Normal => _integratedToolbarQuickPrintNormal, + PaletteState.Disabled => _integratedToolbarQuickPrintDisabled, + _ => _integratedToolbarQuickPrintDisabled + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } #endregion @@ -3703,15 +3700,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Extra Themes/PaletteMicrosoft365BlueLightMode.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Extra Themes/PaletteMicrosoft365BlueLightMode.cs index eba668c19..c9db74206 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Extra Themes/PaletteMicrosoft365BlueLightMode.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Extra Themes/PaletteMicrosoft365BlueLightMode.cs @@ -423,132 +423,129 @@ public PaletteMicrosoft365BlueLightMode() : base(_schemeOfficeColors, _checkBoxL /// /// Image value. /// - public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) + public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) => style switch { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - PaletteButtonSpecStyle.New => state switch - { - PaletteState.Normal => _integratedToolbarNewNormal, - PaletteState.Disabled => _integratedToolbarNewDisabled, - _ => _integratedToolbarNewDisabled - }, - PaletteButtonSpecStyle.Open => state switch - { - PaletteState.Normal => _integratedToolbarOpenNormal, - PaletteState.Disabled => _integratedToolbarOpenDisabled, - _ => _integratedToolbarOpenDisabled - }, - PaletteButtonSpecStyle.SaveAll => state switch - { - PaletteState.Normal => _integratedToolbarSaveAllNormal, - PaletteState.Disabled => _integratedToolbarSaveAllDisabled, - _ => _integratedToolbarSaveAllDisabled - }, - PaletteButtonSpecStyle.SaveAs => state switch - { - PaletteState.Normal => _integratedToolbarSaveAsNormal, - PaletteState.Disabled => _integratedToolbarSaveAsDisabled, - _ => _integratedToolbarSaveAsDisabled - }, - PaletteButtonSpecStyle.Save => state switch - { - PaletteState.Normal => _integratedToolbarSaveNormal, - PaletteState.Disabled => _integratedToolbarSaveDisabled, - _ => _integratedToolbarSaveDisabled - }, - PaletteButtonSpecStyle.Cut => state switch - { - PaletteState.Normal => _integratedToolbarCutNormal, - PaletteState.Disabled => _integratedToolbarCutDisabled, - _ => _integratedToolbarCutDisabled - }, - PaletteButtonSpecStyle.Copy => state switch - { - PaletteState.Normal => _integratedToolbarCopyNormal, - PaletteState.Disabled => _integratedToolbarCopyDisabled, - _ => _integratedToolbarCopyDisabled - }, - PaletteButtonSpecStyle.Paste => state switch - { - PaletteState.Normal => _integratedToolbarPasteNormal, - PaletteState.Disabled => _integratedToolbarPasteDisabled, - _ => _integratedToolbarPasteDisabled - }, - PaletteButtonSpecStyle.Undo => state switch - { - PaletteState.Normal => _integratedToolbarUndoNormal, - PaletteState.Disabled => _integratedToolbarUndoDisabled, - _ => _integratedToolbarUndoDisabled - }, - PaletteButtonSpecStyle.Redo => state switch - { - PaletteState.Normal => _integratedToolbarRedoNormal, - PaletteState.Disabled => _integratedToolbarRedoDisabled, - _ => _integratedToolbarRedoDisabled - }, - PaletteButtonSpecStyle.PageSetup => state switch - { - PaletteState.Normal => _integratedToolbarPageSetupNormal, - PaletteState.Disabled => _integratedToolbarPageSetupDisabled, - _ => _integratedToolbarPageSetupDisabled - }, - PaletteButtonSpecStyle.PrintPreview => state switch - { - PaletteState.Normal => _integratedToolbarPrintPreviewNormal, - PaletteState.Disabled => _integratedToolbarPrintPreviewDisabled, - _ => _integratedToolbarPrintPreviewDisabled - }, - PaletteButtonSpecStyle.Print => state switch - { - PaletteState.Normal => _integratedToolbarPrintNormal, - PaletteState.Disabled => _integratedToolbarPrintDisabled, - _ => _integratedToolbarPrintDisabled - }, - PaletteButtonSpecStyle.QuickPrint => state switch - { - PaletteState.Normal => _integratedToolbarQuickPrintNormal, - PaletteState.Disabled => _integratedToolbarQuickPrintDisabled, - _ => _integratedToolbarQuickPrintDisabled - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + PaletteButtonSpecStyle.New => state switch + { + PaletteState.Normal => _integratedToolbarNewNormal, + PaletteState.Disabled => _integratedToolbarNewDisabled, + _ => _integratedToolbarNewDisabled + }, + PaletteButtonSpecStyle.Open => state switch + { + PaletteState.Normal => _integratedToolbarOpenNormal, + PaletteState.Disabled => _integratedToolbarOpenDisabled, + _ => _integratedToolbarOpenDisabled + }, + PaletteButtonSpecStyle.SaveAll => state switch + { + PaletteState.Normal => _integratedToolbarSaveAllNormal, + PaletteState.Disabled => _integratedToolbarSaveAllDisabled, + _ => _integratedToolbarSaveAllDisabled + }, + PaletteButtonSpecStyle.SaveAs => state switch + { + PaletteState.Normal => _integratedToolbarSaveAsNormal, + PaletteState.Disabled => _integratedToolbarSaveAsDisabled, + _ => _integratedToolbarSaveAsDisabled + }, + PaletteButtonSpecStyle.Save => state switch + { + PaletteState.Normal => _integratedToolbarSaveNormal, + PaletteState.Disabled => _integratedToolbarSaveDisabled, + _ => _integratedToolbarSaveDisabled + }, + PaletteButtonSpecStyle.Cut => state switch + { + PaletteState.Normal => _integratedToolbarCutNormal, + PaletteState.Disabled => _integratedToolbarCutDisabled, + _ => _integratedToolbarCutDisabled + }, + PaletteButtonSpecStyle.Copy => state switch + { + PaletteState.Normal => _integratedToolbarCopyNormal, + PaletteState.Disabled => _integratedToolbarCopyDisabled, + _ => _integratedToolbarCopyDisabled + }, + PaletteButtonSpecStyle.Paste => state switch + { + PaletteState.Normal => _integratedToolbarPasteNormal, + PaletteState.Disabled => _integratedToolbarPasteDisabled, + _ => _integratedToolbarPasteDisabled + }, + PaletteButtonSpecStyle.Undo => state switch + { + PaletteState.Normal => _integratedToolbarUndoNormal, + PaletteState.Disabled => _integratedToolbarUndoDisabled, + _ => _integratedToolbarUndoDisabled + }, + PaletteButtonSpecStyle.Redo => state switch + { + PaletteState.Normal => _integratedToolbarRedoNormal, + PaletteState.Disabled => _integratedToolbarRedoDisabled, + _ => _integratedToolbarRedoDisabled + }, + PaletteButtonSpecStyle.PageSetup => state switch + { + PaletteState.Normal => _integratedToolbarPageSetupNormal, + PaletteState.Disabled => _integratedToolbarPageSetupDisabled, + _ => _integratedToolbarPageSetupDisabled + }, + PaletteButtonSpecStyle.PrintPreview => state switch + { + PaletteState.Normal => _integratedToolbarPrintPreviewNormal, + PaletteState.Disabled => _integratedToolbarPrintPreviewDisabled, + _ => _integratedToolbarPrintPreviewDisabled + }, + PaletteButtonSpecStyle.Print => state switch + { + PaletteState.Normal => _integratedToolbarPrintNormal, + PaletteState.Disabled => _integratedToolbarPrintDisabled, + _ => _integratedToolbarPrintDisabled + }, + PaletteButtonSpecStyle.QuickPrint => state switch + { + PaletteState.Normal => _integratedToolbarQuickPrintNormal, + PaletteState.Disabled => _integratedToolbarQuickPrintDisabled, + _ => _integratedToolbarQuickPrintDisabled + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } #endregion @@ -3712,15 +3709,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Extra Themes/PaletteMicrosoft365SilverDarkMode.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Extra Themes/PaletteMicrosoft365SilverDarkMode.cs index b22239436..dcf451c99 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Extra Themes/PaletteMicrosoft365SilverDarkMode.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Extra Themes/PaletteMicrosoft365SilverDarkMode.cs @@ -418,132 +418,129 @@ public PaletteMicrosoft365SilverDarkMode() : base(_schemeOfficeColors, _checkBox /// /// Image value. /// - public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) + public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) => style switch { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - PaletteButtonSpecStyle.New => state switch - { - PaletteState.Normal => _integratedToolbarNewNormal, - PaletteState.Disabled => _integratedToolbarNewDisabled, - _ => _integratedToolbarNewDisabled - }, - PaletteButtonSpecStyle.Open => state switch - { - PaletteState.Normal => _integratedToolbarOpenNormal, - PaletteState.Disabled => _integratedToolbarOpenDisabled, - _ => _integratedToolbarOpenDisabled - }, - PaletteButtonSpecStyle.SaveAll => state switch - { - PaletteState.Normal => _integratedToolbarSaveAllNormal, - PaletteState.Disabled => _integratedToolbarSaveAllDisabled, - _ => _integratedToolbarSaveAllDisabled - }, - PaletteButtonSpecStyle.SaveAs => state switch - { - PaletteState.Normal => _integratedToolbarSaveAsNormal, - PaletteState.Disabled => _integratedToolbarSaveAsDisabled, - _ => _integratedToolbarSaveAsDisabled - }, - PaletteButtonSpecStyle.Save => state switch - { - PaletteState.Normal => _integratedToolbarSaveNormal, - PaletteState.Disabled => _integratedToolbarSaveDisabled, - _ => _integratedToolbarSaveDisabled - }, - PaletteButtonSpecStyle.Cut => state switch - { - PaletteState.Normal => _integratedToolbarCutNormal, - PaletteState.Disabled => _integratedToolbarCutDisabled, - _ => _integratedToolbarCutDisabled - }, - PaletteButtonSpecStyle.Copy => state switch - { - PaletteState.Normal => _integratedToolbarCopyNormal, - PaletteState.Disabled => _integratedToolbarCopyDisabled, - _ => _integratedToolbarCopyDisabled - }, - PaletteButtonSpecStyle.Paste => state switch - { - PaletteState.Normal => _integratedToolbarPasteNormal, - PaletteState.Disabled => _integratedToolbarPasteDisabled, - _ => _integratedToolbarPasteDisabled - }, - PaletteButtonSpecStyle.Undo => state switch - { - PaletteState.Normal => _integratedToolbarUndoNormal, - PaletteState.Disabled => _integratedToolbarUndoDisabled, - _ => _integratedToolbarUndoDisabled - }, - PaletteButtonSpecStyle.Redo => state switch - { - PaletteState.Normal => _integratedToolbarRedoNormal, - PaletteState.Disabled => _integratedToolbarRedoDisabled, - _ => _integratedToolbarRedoDisabled - }, - PaletteButtonSpecStyle.PageSetup => state switch - { - PaletteState.Normal => _integratedToolbarPageSetupNormal, - PaletteState.Disabled => _integratedToolbarPageSetupDisabled, - _ => _integratedToolbarPageSetupDisabled - }, - PaletteButtonSpecStyle.PrintPreview => state switch - { - PaletteState.Normal => _integratedToolbarPrintPreviewNormal, - PaletteState.Disabled => _integratedToolbarPrintPreviewDisabled, - _ => _integratedToolbarPrintPreviewDisabled - }, - PaletteButtonSpecStyle.Print => state switch - { - PaletteState.Normal => _integratedToolbarPrintNormal, - PaletteState.Disabled => _integratedToolbarPrintDisabled, - _ => _integratedToolbarPrintDisabled - }, - PaletteButtonSpecStyle.QuickPrint => state switch - { - PaletteState.Normal => _integratedToolbarQuickPrintNormal, - PaletteState.Disabled => _integratedToolbarQuickPrintDisabled, - _ => _integratedToolbarQuickPrintDisabled - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + PaletteButtonSpecStyle.New => state switch + { + PaletteState.Normal => _integratedToolbarNewNormal, + PaletteState.Disabled => _integratedToolbarNewDisabled, + _ => _integratedToolbarNewDisabled + }, + PaletteButtonSpecStyle.Open => state switch + { + PaletteState.Normal => _integratedToolbarOpenNormal, + PaletteState.Disabled => _integratedToolbarOpenDisabled, + _ => _integratedToolbarOpenDisabled + }, + PaletteButtonSpecStyle.SaveAll => state switch + { + PaletteState.Normal => _integratedToolbarSaveAllNormal, + PaletteState.Disabled => _integratedToolbarSaveAllDisabled, + _ => _integratedToolbarSaveAllDisabled + }, + PaletteButtonSpecStyle.SaveAs => state switch + { + PaletteState.Normal => _integratedToolbarSaveAsNormal, + PaletteState.Disabled => _integratedToolbarSaveAsDisabled, + _ => _integratedToolbarSaveAsDisabled + }, + PaletteButtonSpecStyle.Save => state switch + { + PaletteState.Normal => _integratedToolbarSaveNormal, + PaletteState.Disabled => _integratedToolbarSaveDisabled, + _ => _integratedToolbarSaveDisabled + }, + PaletteButtonSpecStyle.Cut => state switch + { + PaletteState.Normal => _integratedToolbarCutNormal, + PaletteState.Disabled => _integratedToolbarCutDisabled, + _ => _integratedToolbarCutDisabled + }, + PaletteButtonSpecStyle.Copy => state switch + { + PaletteState.Normal => _integratedToolbarCopyNormal, + PaletteState.Disabled => _integratedToolbarCopyDisabled, + _ => _integratedToolbarCopyDisabled + }, + PaletteButtonSpecStyle.Paste => state switch + { + PaletteState.Normal => _integratedToolbarPasteNormal, + PaletteState.Disabled => _integratedToolbarPasteDisabled, + _ => _integratedToolbarPasteDisabled + }, + PaletteButtonSpecStyle.Undo => state switch + { + PaletteState.Normal => _integratedToolbarUndoNormal, + PaletteState.Disabled => _integratedToolbarUndoDisabled, + _ => _integratedToolbarUndoDisabled + }, + PaletteButtonSpecStyle.Redo => state switch + { + PaletteState.Normal => _integratedToolbarRedoNormal, + PaletteState.Disabled => _integratedToolbarRedoDisabled, + _ => _integratedToolbarRedoDisabled + }, + PaletteButtonSpecStyle.PageSetup => state switch + { + PaletteState.Normal => _integratedToolbarPageSetupNormal, + PaletteState.Disabled => _integratedToolbarPageSetupDisabled, + _ => _integratedToolbarPageSetupDisabled + }, + PaletteButtonSpecStyle.PrintPreview => state switch + { + PaletteState.Normal => _integratedToolbarPrintPreviewNormal, + PaletteState.Disabled => _integratedToolbarPrintPreviewDisabled, + _ => _integratedToolbarPrintPreviewDisabled + }, + PaletteButtonSpecStyle.Print => state switch + { + PaletteState.Normal => _integratedToolbarPrintNormal, + PaletteState.Disabled => _integratedToolbarPrintDisabled, + _ => _integratedToolbarPrintDisabled + }, + PaletteButtonSpecStyle.QuickPrint => state switch + { + PaletteState.Normal => _integratedToolbarQuickPrintNormal, + PaletteState.Disabled => _integratedToolbarQuickPrintDisabled, + _ => _integratedToolbarQuickPrintDisabled + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } #endregion @@ -3709,15 +3706,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Extra Themes/PaletteMicrosoft365SilverLightMode.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Extra Themes/PaletteMicrosoft365SilverLightMode.cs index 3069987c0..a8ddfa780 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Extra Themes/PaletteMicrosoft365SilverLightMode.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Extra Themes/PaletteMicrosoft365SilverLightMode.cs @@ -424,132 +424,129 @@ public PaletteMicrosoft365SilverLightMode() : base(_schemeOfficeColors, _checkBo /// /// Image value. /// - public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) + public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) => style switch { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - PaletteButtonSpecStyle.New => state switch - { - PaletteState.Normal => _integratedToolbarNewNormal, - PaletteState.Disabled => _integratedToolbarNewDisabled, - _ => _integratedToolbarNewDisabled - }, - PaletteButtonSpecStyle.Open => state switch - { - PaletteState.Normal => _integratedToolbarOpenNormal, - PaletteState.Disabled => _integratedToolbarOpenDisabled, - _ => _integratedToolbarOpenDisabled - }, - PaletteButtonSpecStyle.SaveAll => state switch - { - PaletteState.Normal => _integratedToolbarSaveAllNormal, - PaletteState.Disabled => _integratedToolbarSaveAllDisabled, - _ => _integratedToolbarSaveAllDisabled - }, - PaletteButtonSpecStyle.SaveAs => state switch - { - PaletteState.Normal => _integratedToolbarSaveAsNormal, - PaletteState.Disabled => _integratedToolbarSaveAsDisabled, - _ => _integratedToolbarSaveAsDisabled - }, - PaletteButtonSpecStyle.Save => state switch - { - PaletteState.Normal => _integratedToolbarSaveNormal, - PaletteState.Disabled => _integratedToolbarSaveDisabled, - _ => _integratedToolbarSaveDisabled - }, - PaletteButtonSpecStyle.Cut => state switch - { - PaletteState.Normal => _integratedToolbarCutNormal, - PaletteState.Disabled => _integratedToolbarCutDisabled, - _ => _integratedToolbarCutDisabled - }, - PaletteButtonSpecStyle.Copy => state switch - { - PaletteState.Normal => _integratedToolbarCopyNormal, - PaletteState.Disabled => _integratedToolbarCopyDisabled, - _ => _integratedToolbarCopyDisabled - }, - PaletteButtonSpecStyle.Paste => state switch - { - PaletteState.Normal => _integratedToolbarPasteNormal, - PaletteState.Disabled => _integratedToolbarPasteDisabled, - _ => _integratedToolbarPasteDisabled - }, - PaletteButtonSpecStyle.Undo => state switch - { - PaletteState.Normal => _integratedToolbarUndoNormal, - PaletteState.Disabled => _integratedToolbarUndoDisabled, - _ => _integratedToolbarUndoDisabled - }, - PaletteButtonSpecStyle.Redo => state switch - { - PaletteState.Normal => _integratedToolbarRedoNormal, - PaletteState.Disabled => _integratedToolbarRedoDisabled, - _ => _integratedToolbarRedoDisabled - }, - PaletteButtonSpecStyle.PageSetup => state switch - { - PaletteState.Normal => _integratedToolbarPageSetupNormal, - PaletteState.Disabled => _integratedToolbarPageSetupDisabled, - _ => _integratedToolbarPageSetupDisabled - }, - PaletteButtonSpecStyle.PrintPreview => state switch - { - PaletteState.Normal => _integratedToolbarPrintPreviewNormal, - PaletteState.Disabled => _integratedToolbarPrintPreviewDisabled, - _ => _integratedToolbarPrintPreviewDisabled - }, - PaletteButtonSpecStyle.Print => state switch - { - PaletteState.Normal => _integratedToolbarPrintNormal, - PaletteState.Disabled => _integratedToolbarPrintDisabled, - _ => _integratedToolbarPrintDisabled - }, - PaletteButtonSpecStyle.QuickPrint => state switch - { - PaletteState.Normal => _integratedToolbarQuickPrintNormal, - PaletteState.Disabled => _integratedToolbarQuickPrintDisabled, - _ => _integratedToolbarQuickPrintDisabled - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + PaletteButtonSpecStyle.New => state switch + { + PaletteState.Normal => _integratedToolbarNewNormal, + PaletteState.Disabled => _integratedToolbarNewDisabled, + _ => _integratedToolbarNewDisabled + }, + PaletteButtonSpecStyle.Open => state switch + { + PaletteState.Normal => _integratedToolbarOpenNormal, + PaletteState.Disabled => _integratedToolbarOpenDisabled, + _ => _integratedToolbarOpenDisabled + }, + PaletteButtonSpecStyle.SaveAll => state switch + { + PaletteState.Normal => _integratedToolbarSaveAllNormal, + PaletteState.Disabled => _integratedToolbarSaveAllDisabled, + _ => _integratedToolbarSaveAllDisabled + }, + PaletteButtonSpecStyle.SaveAs => state switch + { + PaletteState.Normal => _integratedToolbarSaveAsNormal, + PaletteState.Disabled => _integratedToolbarSaveAsDisabled, + _ => _integratedToolbarSaveAsDisabled + }, + PaletteButtonSpecStyle.Save => state switch + { + PaletteState.Normal => _integratedToolbarSaveNormal, + PaletteState.Disabled => _integratedToolbarSaveDisabled, + _ => _integratedToolbarSaveDisabled + }, + PaletteButtonSpecStyle.Cut => state switch + { + PaletteState.Normal => _integratedToolbarCutNormal, + PaletteState.Disabled => _integratedToolbarCutDisabled, + _ => _integratedToolbarCutDisabled + }, + PaletteButtonSpecStyle.Copy => state switch + { + PaletteState.Normal => _integratedToolbarCopyNormal, + PaletteState.Disabled => _integratedToolbarCopyDisabled, + _ => _integratedToolbarCopyDisabled + }, + PaletteButtonSpecStyle.Paste => state switch + { + PaletteState.Normal => _integratedToolbarPasteNormal, + PaletteState.Disabled => _integratedToolbarPasteDisabled, + _ => _integratedToolbarPasteDisabled + }, + PaletteButtonSpecStyle.Undo => state switch + { + PaletteState.Normal => _integratedToolbarUndoNormal, + PaletteState.Disabled => _integratedToolbarUndoDisabled, + _ => _integratedToolbarUndoDisabled + }, + PaletteButtonSpecStyle.Redo => state switch + { + PaletteState.Normal => _integratedToolbarRedoNormal, + PaletteState.Disabled => _integratedToolbarRedoDisabled, + _ => _integratedToolbarRedoDisabled + }, + PaletteButtonSpecStyle.PageSetup => state switch + { + PaletteState.Normal => _integratedToolbarPageSetupNormal, + PaletteState.Disabled => _integratedToolbarPageSetupDisabled, + _ => _integratedToolbarPageSetupDisabled + }, + PaletteButtonSpecStyle.PrintPreview => state switch + { + PaletteState.Normal => _integratedToolbarPrintPreviewNormal, + PaletteState.Disabled => _integratedToolbarPrintPreviewDisabled, + _ => _integratedToolbarPrintPreviewDisabled + }, + PaletteButtonSpecStyle.Print => state switch + { + PaletteState.Normal => _integratedToolbarPrintNormal, + PaletteState.Disabled => _integratedToolbarPrintDisabled, + _ => _integratedToolbarPrintDisabled + }, + PaletteButtonSpecStyle.QuickPrint => state switch + { + PaletteState.Normal => _integratedToolbarQuickPrintNormal, + PaletteState.Disabled => _integratedToolbarQuickPrintDisabled, + _ => _integratedToolbarQuickPrintDisabled + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } #endregion @@ -3715,15 +3712,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Non Official Themes/PaletteMicrosoft365Blue.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Non Official Themes/PaletteMicrosoft365Blue.cs index d8a3f2279..066a08e86 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Non Official Themes/PaletteMicrosoft365Blue.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Non Official Themes/PaletteMicrosoft365Blue.cs @@ -435,132 +435,129 @@ public PaletteMicrosoft365Blue() : base(_schemeOfficeColors, _checkBoxList, _gal /// /// Image value. /// - public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) + public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) => style switch { - return style switch + PaletteButtonSpecStyle.FormClose => state switch { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - PaletteButtonSpecStyle.New => state switch - { - PaletteState.Normal => _integratedToolbarNewNormal, - PaletteState.Disabled => _integratedToolbarNewDisabled, - _ => _integratedToolbarNewDisabled - }, - PaletteButtonSpecStyle.Open => state switch - { - PaletteState.Normal => _integratedToolbarOpenNormal, - PaletteState.Disabled => _integratedToolbarOpenDisabled, - _ => _integratedToolbarOpenDisabled - }, - PaletteButtonSpecStyle.SaveAll => state switch - { - PaletteState.Normal => _integratedToolbarSaveAllNormal, - PaletteState.Disabled => _integratedToolbarSaveAllDisabled, - _ => _integratedToolbarSaveAllDisabled - }, - PaletteButtonSpecStyle.SaveAs => state switch - { - PaletteState.Normal => _integratedToolbarSaveAsNormal, - PaletteState.Disabled => _integratedToolbarSaveAsDisabled, - _ => _integratedToolbarSaveAsDisabled - }, - PaletteButtonSpecStyle.Save => state switch - { - PaletteState.Normal => _integratedToolbarSaveNormal, - PaletteState.Disabled => _integratedToolbarSaveDisabled, - _ => _integratedToolbarSaveDisabled - }, - PaletteButtonSpecStyle.Cut => state switch - { - PaletteState.Normal => _integratedToolbarCutNormal, - PaletteState.Disabled => _integratedToolbarCutDisabled, - _ => _integratedToolbarCutDisabled - }, - PaletteButtonSpecStyle.Copy => state switch - { - PaletteState.Normal => _integratedToolbarCopyNormal, - PaletteState.Disabled => _integratedToolbarCopyDisabled, - _ => _integratedToolbarCopyDisabled - }, - PaletteButtonSpecStyle.Paste => state switch - { - PaletteState.Normal => _integratedToolbarPasteNormal, - PaletteState.Disabled => _integratedToolbarPasteDisabled, - _ => _integratedToolbarPasteDisabled - }, - PaletteButtonSpecStyle.Undo => state switch - { - PaletteState.Normal => _integratedToolbarUndoNormal, - PaletteState.Disabled => _integratedToolbarUndoDisabled, - _ => _integratedToolbarUndoDisabled - }, - PaletteButtonSpecStyle.Redo => state switch - { - PaletteState.Normal => _integratedToolbarRedoNormal, - PaletteState.Disabled => _integratedToolbarRedoDisabled, - _ => _integratedToolbarRedoDisabled - }, - PaletteButtonSpecStyle.PageSetup => state switch - { - PaletteState.Normal => _integratedToolbarPageSetupNormal, - PaletteState.Disabled => _integratedToolbarPageSetupDisabled, - _ => _integratedToolbarPageSetupDisabled - }, - PaletteButtonSpecStyle.PrintPreview => state switch - { - PaletteState.Normal => _integratedToolbarPrintPreviewNormal, - PaletteState.Disabled => _integratedToolbarPrintPreviewDisabled, - _ => _integratedToolbarPrintPreviewDisabled - }, - PaletteButtonSpecStyle.Print => state switch - { - PaletteState.Normal => _integratedToolbarPrintNormal, - PaletteState.Disabled => _integratedToolbarPrintDisabled, - _ => _integratedToolbarPrintDisabled - }, - PaletteButtonSpecStyle.QuickPrint => state switch - { - PaletteState.Normal => _integratedToolbarQuickPrintNormal, - PaletteState.Disabled => _integratedToolbarQuickPrintDisabled, - _ => _integratedToolbarQuickPrintDisabled - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + PaletteButtonSpecStyle.New => state switch + { + PaletteState.Normal => _integratedToolbarNewNormal, + PaletteState.Disabled => _integratedToolbarNewDisabled, + _ => _integratedToolbarNewDisabled + }, + PaletteButtonSpecStyle.Open => state switch + { + PaletteState.Normal => _integratedToolbarOpenNormal, + PaletteState.Disabled => _integratedToolbarOpenDisabled, + _ => _integratedToolbarOpenDisabled + }, + PaletteButtonSpecStyle.SaveAll => state switch + { + PaletteState.Normal => _integratedToolbarSaveAllNormal, + PaletteState.Disabled => _integratedToolbarSaveAllDisabled, + _ => _integratedToolbarSaveAllDisabled + }, + PaletteButtonSpecStyle.SaveAs => state switch + { + PaletteState.Normal => _integratedToolbarSaveAsNormal, + PaletteState.Disabled => _integratedToolbarSaveAsDisabled, + _ => _integratedToolbarSaveAsDisabled + }, + PaletteButtonSpecStyle.Save => state switch + { + PaletteState.Normal => _integratedToolbarSaveNormal, + PaletteState.Disabled => _integratedToolbarSaveDisabled, + _ => _integratedToolbarSaveDisabled + }, + PaletteButtonSpecStyle.Cut => state switch + { + PaletteState.Normal => _integratedToolbarCutNormal, + PaletteState.Disabled => _integratedToolbarCutDisabled, + _ => _integratedToolbarCutDisabled + }, + PaletteButtonSpecStyle.Copy => state switch + { + PaletteState.Normal => _integratedToolbarCopyNormal, + PaletteState.Disabled => _integratedToolbarCopyDisabled, + _ => _integratedToolbarCopyDisabled + }, + PaletteButtonSpecStyle.Paste => state switch + { + PaletteState.Normal => _integratedToolbarPasteNormal, + PaletteState.Disabled => _integratedToolbarPasteDisabled, + _ => _integratedToolbarPasteDisabled + }, + PaletteButtonSpecStyle.Undo => state switch + { + PaletteState.Normal => _integratedToolbarUndoNormal, + PaletteState.Disabled => _integratedToolbarUndoDisabled, + _ => _integratedToolbarUndoDisabled + }, + PaletteButtonSpecStyle.Redo => state switch + { + PaletteState.Normal => _integratedToolbarRedoNormal, + PaletteState.Disabled => _integratedToolbarRedoDisabled, + _ => _integratedToolbarRedoDisabled + }, + PaletteButtonSpecStyle.PageSetup => state switch + { + PaletteState.Normal => _integratedToolbarPageSetupNormal, + PaletteState.Disabled => _integratedToolbarPageSetupDisabled, + _ => _integratedToolbarPageSetupDisabled + }, + PaletteButtonSpecStyle.PrintPreview => state switch + { + PaletteState.Normal => _integratedToolbarPrintPreviewNormal, + PaletteState.Disabled => _integratedToolbarPrintPreviewDisabled, + _ => _integratedToolbarPrintPreviewDisabled + }, + PaletteButtonSpecStyle.Print => state switch + { + PaletteState.Normal => _integratedToolbarPrintNormal, + PaletteState.Disabled => _integratedToolbarPrintDisabled, + _ => _integratedToolbarPrintDisabled + }, + PaletteButtonSpecStyle.QuickPrint => state switch + { + PaletteState.Normal => _integratedToolbarQuickPrintNormal, + PaletteState.Disabled => _integratedToolbarQuickPrintDisabled, + _ => _integratedToolbarQuickPrintDisabled + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } } \ No newline at end of file diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Official Themes/PaletteMicrosoft365Black.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Official Themes/PaletteMicrosoft365Black.cs index 2534a9690..236051adf 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Official Themes/PaletteMicrosoft365Black.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Official Themes/PaletteMicrosoft365Black.cs @@ -449,137 +449,134 @@ public PaletteMicrosoft365Black() : base(_schemeOfficeColors, _checkBoxList, _ga /// /// Image value. /// - public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) + public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) => style switch { - return style switch - { - PaletteButtonSpecStyle.PendantClose => _buttonSpecPendantClose, - PaletteButtonSpecStyle.PendantMin => _buttonSpecPendantMin, - PaletteButtonSpecStyle.PendantRestore => _buttonSpecPendantRestore, - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - PaletteButtonSpecStyle.RibbonMinimize => _buttonSpecRibbonMinimize, - PaletteButtonSpecStyle.RibbonExpand => _buttonSpecRibbonExpand, - PaletteButtonSpecStyle.New => state switch - { - PaletteState.Normal => _integratedToolbarNewNormal, - PaletteState.Disabled => _integratedToolbarNewDisabled, - _ => _integratedToolbarNewDisabled - }, - PaletteButtonSpecStyle.Open => state switch - { - PaletteState.Normal => _integratedToolbarOpenNormal, - PaletteState.Disabled => _integratedToolbarOpenDisabled, - _ => _integratedToolbarOpenDisabled - }, - PaletteButtonSpecStyle.SaveAll => state switch - { - PaletteState.Normal => _integratedToolbarSaveAllNormal, - PaletteState.Disabled => _integratedToolbarSaveAllDisabled, - _ => _integratedToolbarSaveAllDisabled - }, - PaletteButtonSpecStyle.SaveAs => state switch - { - PaletteState.Normal => _integratedToolbarSaveAsNormal, - PaletteState.Disabled => _integratedToolbarSaveAsDisabled, - _ => _integratedToolbarSaveAsDisabled - }, - PaletteButtonSpecStyle.Save => state switch - { - PaletteState.Normal => _integratedToolbarSaveNormal, - PaletteState.Disabled => _integratedToolbarSaveDisabled, - _ => _integratedToolbarSaveDisabled - }, - PaletteButtonSpecStyle.Cut => state switch - { - PaletteState.Normal => _integratedToolbarCutNormal, - PaletteState.Disabled => _integratedToolbarCutDisabled, - _ => _integratedToolbarCutDisabled - }, - PaletteButtonSpecStyle.Copy => state switch - { - PaletteState.Normal => _integratedToolbarCopyNormal, - PaletteState.Disabled => _integratedToolbarCopyDisabled, - _ => _integratedToolbarCopyDisabled - }, - PaletteButtonSpecStyle.Paste => state switch - { - PaletteState.Normal => _integratedToolbarPasteNormal, - PaletteState.Disabled => _integratedToolbarPasteDisabled, - _ => _integratedToolbarPasteDisabled - }, - PaletteButtonSpecStyle.Undo => state switch - { - PaletteState.Normal => _integratedToolbarUndoNormal, - PaletteState.Disabled => _integratedToolbarUndoDisabled, - _ => _integratedToolbarUndoDisabled - }, - PaletteButtonSpecStyle.Redo => state switch - { - PaletteState.Normal => _integratedToolbarRedoNormal, - PaletteState.Disabled => _integratedToolbarRedoDisabled, - _ => _integratedToolbarRedoDisabled - }, - PaletteButtonSpecStyle.PageSetup => state switch - { - PaletteState.Normal => _integratedToolbarPageSetupNormal, - PaletteState.Disabled => _integratedToolbarPageSetupDisabled, - _ => _integratedToolbarPageSetupDisabled - }, - PaletteButtonSpecStyle.PrintPreview => state switch - { - PaletteState.Normal => _integratedToolbarPrintPreviewNormal, - PaletteState.Disabled => _integratedToolbarPrintPreviewDisabled, - _ => _integratedToolbarPrintPreviewDisabled - }, - PaletteButtonSpecStyle.Print => state switch - { - PaletteState.Normal => _integratedToolbarPrintNormal, - PaletteState.Disabled => _integratedToolbarPrintDisabled, - _ => _integratedToolbarPrintDisabled - }, - PaletteButtonSpecStyle.QuickPrint => state switch - { - PaletteState.Normal => _integratedToolbarQuickPrintNormal, - PaletteState.Disabled => _integratedToolbarQuickPrintDisabled, - _ => _integratedToolbarQuickPrintDisabled - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteButtonSpecStyle.PendantClose => _buttonSpecPendantClose, + PaletteButtonSpecStyle.PendantMin => _buttonSpecPendantMin, + PaletteButtonSpecStyle.PendantRestore => _buttonSpecPendantRestore, + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + PaletteButtonSpecStyle.RibbonMinimize => _buttonSpecRibbonMinimize, + PaletteButtonSpecStyle.RibbonExpand => _buttonSpecRibbonExpand, + PaletteButtonSpecStyle.New => state switch + { + PaletteState.Normal => _integratedToolbarNewNormal, + PaletteState.Disabled => _integratedToolbarNewDisabled, + _ => _integratedToolbarNewDisabled + }, + PaletteButtonSpecStyle.Open => state switch + { + PaletteState.Normal => _integratedToolbarOpenNormal, + PaletteState.Disabled => _integratedToolbarOpenDisabled, + _ => _integratedToolbarOpenDisabled + }, + PaletteButtonSpecStyle.SaveAll => state switch + { + PaletteState.Normal => _integratedToolbarSaveAllNormal, + PaletteState.Disabled => _integratedToolbarSaveAllDisabled, + _ => _integratedToolbarSaveAllDisabled + }, + PaletteButtonSpecStyle.SaveAs => state switch + { + PaletteState.Normal => _integratedToolbarSaveAsNormal, + PaletteState.Disabled => _integratedToolbarSaveAsDisabled, + _ => _integratedToolbarSaveAsDisabled + }, + PaletteButtonSpecStyle.Save => state switch + { + PaletteState.Normal => _integratedToolbarSaveNormal, + PaletteState.Disabled => _integratedToolbarSaveDisabled, + _ => _integratedToolbarSaveDisabled + }, + PaletteButtonSpecStyle.Cut => state switch + { + PaletteState.Normal => _integratedToolbarCutNormal, + PaletteState.Disabled => _integratedToolbarCutDisabled, + _ => _integratedToolbarCutDisabled + }, + PaletteButtonSpecStyle.Copy => state switch + { + PaletteState.Normal => _integratedToolbarCopyNormal, + PaletteState.Disabled => _integratedToolbarCopyDisabled, + _ => _integratedToolbarCopyDisabled + }, + PaletteButtonSpecStyle.Paste => state switch + { + PaletteState.Normal => _integratedToolbarPasteNormal, + PaletteState.Disabled => _integratedToolbarPasteDisabled, + _ => _integratedToolbarPasteDisabled + }, + PaletteButtonSpecStyle.Undo => state switch + { + PaletteState.Normal => _integratedToolbarUndoNormal, + PaletteState.Disabled => _integratedToolbarUndoDisabled, + _ => _integratedToolbarUndoDisabled + }, + PaletteButtonSpecStyle.Redo => state switch + { + PaletteState.Normal => _integratedToolbarRedoNormal, + PaletteState.Disabled => _integratedToolbarRedoDisabled, + _ => _integratedToolbarRedoDisabled + }, + PaletteButtonSpecStyle.PageSetup => state switch + { + PaletteState.Normal => _integratedToolbarPageSetupNormal, + PaletteState.Disabled => _integratedToolbarPageSetupDisabled, + _ => _integratedToolbarPageSetupDisabled + }, + PaletteButtonSpecStyle.PrintPreview => state switch + { + PaletteState.Normal => _integratedToolbarPrintPreviewNormal, + PaletteState.Disabled => _integratedToolbarPrintPreviewDisabled, + _ => _integratedToolbarPrintPreviewDisabled + }, + PaletteButtonSpecStyle.Print => state switch + { + PaletteState.Normal => _integratedToolbarPrintNormal, + PaletteState.Disabled => _integratedToolbarPrintDisabled, + _ => _integratedToolbarPrintDisabled + }, + PaletteButtonSpecStyle.QuickPrint => state switch + { + PaletteState.Normal => _integratedToolbarQuickPrintNormal, + PaletteState.Disabled => _integratedToolbarQuickPrintDisabled, + _ => _integratedToolbarQuickPrintDisabled + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } @@ -3663,15 +3660,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Official Themes/PaletteMicrosoft365DarkGray.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Official Themes/PaletteMicrosoft365DarkGray.cs index 5bd1685ea..ffbcbefae 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Official Themes/PaletteMicrosoft365DarkGray.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Official Themes/PaletteMicrosoft365DarkGray.cs @@ -420,132 +420,129 @@ public PaletteMicrosoft365DarkGray() /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - PaletteButtonSpecStyle.New => state switch - { - PaletteState.Normal => _integratedToolbarNewNormal, - PaletteState.Disabled => _integratedToolbarNewDisabled, - _ => _integratedToolbarNewDisabled - }, - PaletteButtonSpecStyle.Open => state switch - { - PaletteState.Normal => _integratedToolbarOpenNormal, - PaletteState.Disabled => _integratedToolbarOpenDisabled, - _ => _integratedToolbarOpenDisabled - }, - PaletteButtonSpecStyle.SaveAll => state switch - { - PaletteState.Normal => _integratedToolbarSaveAllNormal, - PaletteState.Disabled => _integratedToolbarSaveAllDisabled, - _ => _integratedToolbarSaveAllDisabled - }, - PaletteButtonSpecStyle.SaveAs => state switch - { - PaletteState.Normal => _integratedToolbarSaveAsNormal, - PaletteState.Disabled => _integratedToolbarSaveAsDisabled, - _ => _integratedToolbarSaveAsDisabled - }, - PaletteButtonSpecStyle.Save => state switch - { - PaletteState.Normal => _integratedToolbarSaveNormal, - PaletteState.Disabled => _integratedToolbarSaveDisabled, - _ => _integratedToolbarSaveDisabled - }, - PaletteButtonSpecStyle.Cut => state switch - { - PaletteState.Normal => _integratedToolbarCutNormal, - PaletteState.Disabled => _integratedToolbarCutDisabled, - _ => _integratedToolbarCutDisabled - }, - PaletteButtonSpecStyle.Copy => state switch - { - PaletteState.Normal => _integratedToolbarCopyNormal, - PaletteState.Disabled => _integratedToolbarCopyDisabled, - _ => _integratedToolbarCopyDisabled - }, - PaletteButtonSpecStyle.Paste => state switch - { - PaletteState.Normal => _integratedToolbarPasteNormal, - PaletteState.Disabled => _integratedToolbarPasteDisabled, - _ => _integratedToolbarPasteDisabled - }, - PaletteButtonSpecStyle.Undo => state switch - { - PaletteState.Normal => _integratedToolbarUndoNormal, - PaletteState.Disabled => _integratedToolbarUndoDisabled, - _ => _integratedToolbarUndoDisabled - }, - PaletteButtonSpecStyle.Redo => state switch - { - PaletteState.Normal => _integratedToolbarRedoNormal, - PaletteState.Disabled => _integratedToolbarRedoDisabled, - _ => _integratedToolbarRedoDisabled - }, - PaletteButtonSpecStyle.PageSetup => state switch - { - PaletteState.Normal => _integratedToolbarPageSetupNormal, - PaletteState.Disabled => _integratedToolbarPageSetupDisabled, - _ => _integratedToolbarPageSetupDisabled - }, - PaletteButtonSpecStyle.PrintPreview => state switch - { - PaletteState.Normal => _integratedToolbarPrintPreviewNormal, - PaletteState.Disabled => _integratedToolbarPrintPreviewDisabled, - _ => _integratedToolbarPrintPreviewDisabled - }, - PaletteButtonSpecStyle.Print => state switch - { - PaletteState.Normal => _integratedToolbarPrintNormal, - PaletteState.Disabled => _integratedToolbarPrintDisabled, - _ => _integratedToolbarPrintDisabled - }, - PaletteButtonSpecStyle.QuickPrint => state switch - { - PaletteState.Normal => _integratedToolbarQuickPrintNormal, - PaletteState.Disabled => _integratedToolbarQuickPrintDisabled, - _ => _integratedToolbarQuickPrintDisabled - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + PaletteButtonSpecStyle.New => state switch + { + PaletteState.Normal => _integratedToolbarNewNormal, + PaletteState.Disabled => _integratedToolbarNewDisabled, + _ => _integratedToolbarNewDisabled + }, + PaletteButtonSpecStyle.Open => state switch + { + PaletteState.Normal => _integratedToolbarOpenNormal, + PaletteState.Disabled => _integratedToolbarOpenDisabled, + _ => _integratedToolbarOpenDisabled + }, + PaletteButtonSpecStyle.SaveAll => state switch + { + PaletteState.Normal => _integratedToolbarSaveAllNormal, + PaletteState.Disabled => _integratedToolbarSaveAllDisabled, + _ => _integratedToolbarSaveAllDisabled + }, + PaletteButtonSpecStyle.SaveAs => state switch + { + PaletteState.Normal => _integratedToolbarSaveAsNormal, + PaletteState.Disabled => _integratedToolbarSaveAsDisabled, + _ => _integratedToolbarSaveAsDisabled + }, + PaletteButtonSpecStyle.Save => state switch + { + PaletteState.Normal => _integratedToolbarSaveNormal, + PaletteState.Disabled => _integratedToolbarSaveDisabled, + _ => _integratedToolbarSaveDisabled + }, + PaletteButtonSpecStyle.Cut => state switch + { + PaletteState.Normal => _integratedToolbarCutNormal, + PaletteState.Disabled => _integratedToolbarCutDisabled, + _ => _integratedToolbarCutDisabled + }, + PaletteButtonSpecStyle.Copy => state switch + { + PaletteState.Normal => _integratedToolbarCopyNormal, + PaletteState.Disabled => _integratedToolbarCopyDisabled, + _ => _integratedToolbarCopyDisabled + }, + PaletteButtonSpecStyle.Paste => state switch + { + PaletteState.Normal => _integratedToolbarPasteNormal, + PaletteState.Disabled => _integratedToolbarPasteDisabled, + _ => _integratedToolbarPasteDisabled + }, + PaletteButtonSpecStyle.Undo => state switch + { + PaletteState.Normal => _integratedToolbarUndoNormal, + PaletteState.Disabled => _integratedToolbarUndoDisabled, + _ => _integratedToolbarUndoDisabled + }, + PaletteButtonSpecStyle.Redo => state switch + { + PaletteState.Normal => _integratedToolbarRedoNormal, + PaletteState.Disabled => _integratedToolbarRedoDisabled, + _ => _integratedToolbarRedoDisabled + }, + PaletteButtonSpecStyle.PageSetup => state switch + { + PaletteState.Normal => _integratedToolbarPageSetupNormal, + PaletteState.Disabled => _integratedToolbarPageSetupDisabled, + _ => _integratedToolbarPageSetupDisabled + }, + PaletteButtonSpecStyle.PrintPreview => state switch + { + PaletteState.Normal => _integratedToolbarPrintPreviewNormal, + PaletteState.Disabled => _integratedToolbarPrintPreviewDisabled, + _ => _integratedToolbarPrintPreviewDisabled + }, + PaletteButtonSpecStyle.Print => state switch + { + PaletteState.Normal => _integratedToolbarPrintNormal, + PaletteState.Disabled => _integratedToolbarPrintDisabled, + _ => _integratedToolbarPrintDisabled + }, + PaletteButtonSpecStyle.QuickPrint => state switch + { + PaletteState.Normal => _integratedToolbarQuickPrintNormal, + PaletteState.Disabled => _integratedToolbarQuickPrintDisabled, + _ => _integratedToolbarQuickPrintDisabled + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Official Themes/PaletteMicrosoft365LightGray.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Official Themes/PaletteMicrosoft365LightGray.cs index 6150b6c57..e0b613648 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Official Themes/PaletteMicrosoft365LightGray.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Official Themes/PaletteMicrosoft365LightGray.cs @@ -18,9 +18,6 @@ public PaletteMicrosoft365LightGray(Color[] schemeColours, ImageList checkBoxLis { } - public override Image? GetContextMenuSubMenuImage() - { - throw new NotImplementedException(); - } + public override Image? GetContextMenuSubMenuImage() => throw new NotImplementedException(); } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Official Themes/PaletteMicrosoft365Silver.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Official Themes/PaletteMicrosoft365Silver.cs index 88da6d5c4..f879d766d 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Official Themes/PaletteMicrosoft365Silver.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Official Themes/PaletteMicrosoft365Silver.cs @@ -438,132 +438,129 @@ public PaletteMicrosoft365Silver() : base(_schemeOfficeColors, _checkBoxList, _g /// /// Image value. /// - public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) + public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) => style switch { - return style switch + PaletteButtonSpecStyle.FormClose => state switch { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - PaletteButtonSpecStyle.New => state switch - { - PaletteState.Normal => _integratedToolbarNewNormal, - PaletteState.Disabled => _integratedToolbarNewDisabled, - _ => _integratedToolbarNewDisabled - }, - PaletteButtonSpecStyle.Open => state switch - { - PaletteState.Normal => _integratedToolbarOpenNormal, - PaletteState.Disabled => _integratedToolbarOpenDisabled, - _ => _integratedToolbarOpenDisabled - }, - PaletteButtonSpecStyle.SaveAll => state switch - { - PaletteState.Normal => _integratedToolbarSaveAllNormal, - PaletteState.Disabled => _integratedToolbarSaveAllDisabled, - _ => _integratedToolbarSaveAllDisabled - }, - PaletteButtonSpecStyle.SaveAs => state switch - { - PaletteState.Normal => _integratedToolbarSaveAsNormal, - PaletteState.Disabled => _integratedToolbarSaveAsDisabled, - _ => _integratedToolbarSaveAsDisabled - }, - PaletteButtonSpecStyle.Save => state switch - { - PaletteState.Normal => _integratedToolbarSaveNormal, - PaletteState.Disabled => _integratedToolbarSaveDisabled, - _ => _integratedToolbarSaveDisabled - }, - PaletteButtonSpecStyle.Cut => state switch - { - PaletteState.Normal => _integratedToolbarCutNormal, - PaletteState.Disabled => _integratedToolbarCutDisabled, - _ => _integratedToolbarCutDisabled - }, - PaletteButtonSpecStyle.Copy => state switch - { - PaletteState.Normal => _integratedToolbarCopyNormal, - PaletteState.Disabled => _integratedToolbarCopyDisabled, - _ => _integratedToolbarCopyDisabled - }, - PaletteButtonSpecStyle.Paste => state switch - { - PaletteState.Normal => _integratedToolbarPasteNormal, - PaletteState.Disabled => _integratedToolbarPasteDisabled, - _ => _integratedToolbarPasteDisabled - }, - PaletteButtonSpecStyle.Undo => state switch - { - PaletteState.Normal => _integratedToolbarUndoNormal, - PaletteState.Disabled => _integratedToolbarUndoDisabled, - _ => _integratedToolbarUndoDisabled - }, - PaletteButtonSpecStyle.Redo => state switch - { - PaletteState.Normal => _integratedToolbarRedoNormal, - PaletteState.Disabled => _integratedToolbarRedoDisabled, - _ => _integratedToolbarRedoDisabled - }, - PaletteButtonSpecStyle.PageSetup => state switch - { - PaletteState.Normal => _integratedToolbarPageSetupNormal, - PaletteState.Disabled => _integratedToolbarPageSetupDisabled, - _ => _integratedToolbarPageSetupDisabled - }, - PaletteButtonSpecStyle.PrintPreview => state switch - { - PaletteState.Normal => _integratedToolbarPrintPreviewNormal, - PaletteState.Disabled => _integratedToolbarPrintPreviewDisabled, - _ => _integratedToolbarPrintPreviewDisabled - }, - PaletteButtonSpecStyle.Print => state switch - { - PaletteState.Normal => _integratedToolbarPrintNormal, - PaletteState.Disabled => _integratedToolbarPrintDisabled, - _ => _integratedToolbarPrintDisabled - }, - PaletteButtonSpecStyle.QuickPrint => state switch - { - PaletteState.Normal => _integratedToolbarQuickPrintNormal, - PaletteState.Disabled => _integratedToolbarQuickPrintDisabled, - _ => _integratedToolbarQuickPrintDisabled - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + PaletteButtonSpecStyle.New => state switch + { + PaletteState.Normal => _integratedToolbarNewNormal, + PaletteState.Disabled => _integratedToolbarNewDisabled, + _ => _integratedToolbarNewDisabled + }, + PaletteButtonSpecStyle.Open => state switch + { + PaletteState.Normal => _integratedToolbarOpenNormal, + PaletteState.Disabled => _integratedToolbarOpenDisabled, + _ => _integratedToolbarOpenDisabled + }, + PaletteButtonSpecStyle.SaveAll => state switch + { + PaletteState.Normal => _integratedToolbarSaveAllNormal, + PaletteState.Disabled => _integratedToolbarSaveAllDisabled, + _ => _integratedToolbarSaveAllDisabled + }, + PaletteButtonSpecStyle.SaveAs => state switch + { + PaletteState.Normal => _integratedToolbarSaveAsNormal, + PaletteState.Disabled => _integratedToolbarSaveAsDisabled, + _ => _integratedToolbarSaveAsDisabled + }, + PaletteButtonSpecStyle.Save => state switch + { + PaletteState.Normal => _integratedToolbarSaveNormal, + PaletteState.Disabled => _integratedToolbarSaveDisabled, + _ => _integratedToolbarSaveDisabled + }, + PaletteButtonSpecStyle.Cut => state switch + { + PaletteState.Normal => _integratedToolbarCutNormal, + PaletteState.Disabled => _integratedToolbarCutDisabled, + _ => _integratedToolbarCutDisabled + }, + PaletteButtonSpecStyle.Copy => state switch + { + PaletteState.Normal => _integratedToolbarCopyNormal, + PaletteState.Disabled => _integratedToolbarCopyDisabled, + _ => _integratedToolbarCopyDisabled + }, + PaletteButtonSpecStyle.Paste => state switch + { + PaletteState.Normal => _integratedToolbarPasteNormal, + PaletteState.Disabled => _integratedToolbarPasteDisabled, + _ => _integratedToolbarPasteDisabled + }, + PaletteButtonSpecStyle.Undo => state switch + { + PaletteState.Normal => _integratedToolbarUndoNormal, + PaletteState.Disabled => _integratedToolbarUndoDisabled, + _ => _integratedToolbarUndoDisabled + }, + PaletteButtonSpecStyle.Redo => state switch + { + PaletteState.Normal => _integratedToolbarRedoNormal, + PaletteState.Disabled => _integratedToolbarRedoDisabled, + _ => _integratedToolbarRedoDisabled + }, + PaletteButtonSpecStyle.PageSetup => state switch + { + PaletteState.Normal => _integratedToolbarPageSetupNormal, + PaletteState.Disabled => _integratedToolbarPageSetupDisabled, + _ => _integratedToolbarPageSetupDisabled + }, + PaletteButtonSpecStyle.PrintPreview => state switch + { + PaletteState.Normal => _integratedToolbarPrintPreviewNormal, + PaletteState.Disabled => _integratedToolbarPrintPreviewDisabled, + _ => _integratedToolbarPrintPreviewDisabled + }, + PaletteButtonSpecStyle.Print => state switch + { + PaletteState.Normal => _integratedToolbarPrintNormal, + PaletteState.Disabled => _integratedToolbarPrintDisabled, + _ => _integratedToolbarPrintDisabled + }, + PaletteButtonSpecStyle.QuickPrint => state switch + { + PaletteState.Normal => _integratedToolbarQuickPrintNormal, + PaletteState.Disabled => _integratedToolbarQuickPrintDisabled, + _ => _integratedToolbarQuickPrintDisabled + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } } \ No newline at end of file diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Official Themes/PaletteMicrosoft365White.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Official Themes/PaletteMicrosoft365White.cs index 5df111f57..02c756da4 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Official Themes/PaletteMicrosoft365White.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Microsoft 365/Official Themes/PaletteMicrosoft365White.cs @@ -438,132 +438,129 @@ public PaletteMicrosoft365White() /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - PaletteButtonSpecStyle.New => state switch - { - PaletteState.Normal => _integratedToolbarNewNormal, - PaletteState.Disabled => _integratedToolbarNewDisabled, - _ => _integratedToolbarNewDisabled - }, - PaletteButtonSpecStyle.Open => state switch - { - PaletteState.Normal => _integratedToolbarOpenNormal, - PaletteState.Disabled => _integratedToolbarOpenDisabled, - _ => _integratedToolbarOpenDisabled - }, - PaletteButtonSpecStyle.SaveAll => state switch - { - PaletteState.Normal => _integratedToolbarSaveAllNormal, - PaletteState.Disabled => _integratedToolbarSaveAllDisabled, - _ => _integratedToolbarSaveAllDisabled - }, - PaletteButtonSpecStyle.SaveAs => state switch - { - PaletteState.Normal => _integratedToolbarSaveAsNormal, - PaletteState.Disabled => _integratedToolbarSaveAsDisabled, - _ => _integratedToolbarSaveAsDisabled - }, - PaletteButtonSpecStyle.Save => state switch - { - PaletteState.Normal => _integratedToolbarSaveNormal, - PaletteState.Disabled => _integratedToolbarSaveDisabled, - _ => _integratedToolbarSaveDisabled - }, - PaletteButtonSpecStyle.Cut => state switch - { - PaletteState.Normal => _integratedToolbarCutNormal, - PaletteState.Disabled => _integratedToolbarCutDisabled, - _ => _integratedToolbarCutDisabled - }, - PaletteButtonSpecStyle.Copy => state switch - { - PaletteState.Normal => _integratedToolbarCopyNormal, - PaletteState.Disabled => _integratedToolbarCopyDisabled, - _ => _integratedToolbarCopyDisabled - }, - PaletteButtonSpecStyle.Paste => state switch - { - PaletteState.Normal => _integratedToolbarPasteNormal, - PaletteState.Disabled => _integratedToolbarPasteDisabled, - _ => _integratedToolbarPasteDisabled - }, - PaletteButtonSpecStyle.Undo => state switch - { - PaletteState.Normal => _integratedToolbarUndoNormal, - PaletteState.Disabled => _integratedToolbarUndoDisabled, - _ => _integratedToolbarUndoDisabled - }, - PaletteButtonSpecStyle.Redo => state switch - { - PaletteState.Normal => _integratedToolbarRedoNormal, - PaletteState.Disabled => _integratedToolbarRedoDisabled, - _ => _integratedToolbarRedoDisabled - }, - PaletteButtonSpecStyle.PageSetup => state switch - { - PaletteState.Normal => _integratedToolbarPageSetupNormal, - PaletteState.Disabled => _integratedToolbarPageSetupDisabled, - _ => _integratedToolbarPageSetupDisabled - }, - PaletteButtonSpecStyle.PrintPreview => state switch - { - PaletteState.Normal => _integratedToolbarPrintPreviewNormal, - PaletteState.Disabled => _integratedToolbarPrintPreviewDisabled, - _ => _integratedToolbarPrintPreviewDisabled - }, - PaletteButtonSpecStyle.Print => state switch - { - PaletteState.Normal => _integratedToolbarPrintNormal, - PaletteState.Disabled => _integratedToolbarPrintDisabled, - _ => _integratedToolbarPrintDisabled - }, - PaletteButtonSpecStyle.QuickPrint => state switch - { - PaletteState.Normal => _integratedToolbarQuickPrintNormal, - PaletteState.Disabled => _integratedToolbarQuickPrintDisabled, - _ => _integratedToolbarQuickPrintDisabled - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + PaletteButtonSpecStyle.New => state switch + { + PaletteState.Normal => _integratedToolbarNewNormal, + PaletteState.Disabled => _integratedToolbarNewDisabled, + _ => _integratedToolbarNewDisabled + }, + PaletteButtonSpecStyle.Open => state switch + { + PaletteState.Normal => _integratedToolbarOpenNormal, + PaletteState.Disabled => _integratedToolbarOpenDisabled, + _ => _integratedToolbarOpenDisabled + }, + PaletteButtonSpecStyle.SaveAll => state switch + { + PaletteState.Normal => _integratedToolbarSaveAllNormal, + PaletteState.Disabled => _integratedToolbarSaveAllDisabled, + _ => _integratedToolbarSaveAllDisabled + }, + PaletteButtonSpecStyle.SaveAs => state switch + { + PaletteState.Normal => _integratedToolbarSaveAsNormal, + PaletteState.Disabled => _integratedToolbarSaveAsDisabled, + _ => _integratedToolbarSaveAsDisabled + }, + PaletteButtonSpecStyle.Save => state switch + { + PaletteState.Normal => _integratedToolbarSaveNormal, + PaletteState.Disabled => _integratedToolbarSaveDisabled, + _ => _integratedToolbarSaveDisabled + }, + PaletteButtonSpecStyle.Cut => state switch + { + PaletteState.Normal => _integratedToolbarCutNormal, + PaletteState.Disabled => _integratedToolbarCutDisabled, + _ => _integratedToolbarCutDisabled + }, + PaletteButtonSpecStyle.Copy => state switch + { + PaletteState.Normal => _integratedToolbarCopyNormal, + PaletteState.Disabled => _integratedToolbarCopyDisabled, + _ => _integratedToolbarCopyDisabled + }, + PaletteButtonSpecStyle.Paste => state switch + { + PaletteState.Normal => _integratedToolbarPasteNormal, + PaletteState.Disabled => _integratedToolbarPasteDisabled, + _ => _integratedToolbarPasteDisabled + }, + PaletteButtonSpecStyle.Undo => state switch + { + PaletteState.Normal => _integratedToolbarUndoNormal, + PaletteState.Disabled => _integratedToolbarUndoDisabled, + _ => _integratedToolbarUndoDisabled + }, + PaletteButtonSpecStyle.Redo => state switch + { + PaletteState.Normal => _integratedToolbarRedoNormal, + PaletteState.Disabled => _integratedToolbarRedoDisabled, + _ => _integratedToolbarRedoDisabled + }, + PaletteButtonSpecStyle.PageSetup => state switch + { + PaletteState.Normal => _integratedToolbarPageSetupNormal, + PaletteState.Disabled => _integratedToolbarPageSetupDisabled, + _ => _integratedToolbarPageSetupDisabled + }, + PaletteButtonSpecStyle.PrintPreview => state switch + { + PaletteState.Normal => _integratedToolbarPrintPreviewNormal, + PaletteState.Disabled => _integratedToolbarPrintPreviewDisabled, + _ => _integratedToolbarPrintPreviewDisabled + }, + PaletteButtonSpecStyle.Print => state switch + { + PaletteState.Normal => _integratedToolbarPrintNormal, + PaletteState.Disabled => _integratedToolbarPrintDisabled, + _ => _integratedToolbarPrintDisabled + }, + PaletteButtonSpecStyle.QuickPrint => state switch + { + PaletteState.Normal => _integratedToolbarQuickPrintNormal, + PaletteState.Disabled => _integratedToolbarQuickPrintDisabled, + _ => _integratedToolbarQuickPrintDisabled + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } } \ No newline at end of file diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Bases/PaletteOffice2007Base.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Bases/PaletteOffice2007Base.cs index 9b9c7206f..6e8b5e87c 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Bases/PaletteOffice2007Base.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Bases/PaletteOffice2007Base.cs @@ -3716,15 +3716,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ThemeName diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Extra Themes/PaletteOffice2007BlackDarkMode.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Extra Themes/PaletteOffice2007BlackDarkMode.cs index 6f7dd1853..dda0067b7 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Extra Themes/PaletteOffice2007BlackDarkMode.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Extra Themes/PaletteOffice2007BlackDarkMode.cs @@ -324,19 +324,16 @@ public PaletteOffice2007BlackDarkMode() /// Background style. /// Palette value should be applicable to this state. /// Color drawing style. - public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) + public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) => style switch { - return style switch + PaletteBackStyle.ButtonForm => state switch { - PaletteBackStyle.ButtonForm => state switch - { - PaletteState.Tracking or PaletteState.CheckedTracking or PaletteState.Pressed or PaletteState.CheckedPressed => PaletteColorStyle.GlassBottom, - _ => PaletteColorStyle.GlassNormalFull - }, - PaletteBackStyle.HeaderForm => PaletteColorStyle.Rounding3, - _ => base.GetBackColorStyle(style, state) - }; - } + PaletteState.Tracking or PaletteState.CheckedTracking or PaletteState.Pressed or PaletteState.CheckedPressed => PaletteColorStyle.GlassBottom, + _ => PaletteColorStyle.GlassNormalFull + }, + PaletteBackStyle.HeaderForm => PaletteColorStyle.Rounding3, + _ => base.GetBackColorStyle(style, state) + }; /// /// Gets the second back color. @@ -516,49 +513,46 @@ public override Color GetContentLongTextColor2(PaletteContentStyle style, Palett /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Disabled => _blackCloseDisabled, - PaletteState.Tracking => _blackCloseActive, - PaletteState.Pressed => _blackClosePressed, - _ => _blackCloseNormal - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Disabled => _blackMinimiseDisabled, - PaletteState.Tracking => _blackMinimiseActive, - PaletteState.Pressed => _blackMinimisePressed, - _ => _blackMinimiseNormal - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Disabled => _blackMaximiseDisabled, - PaletteState.Tracking => _blackMaximiseActive, - PaletteState.Pressed => _blackMaximisePressed, - _ => _blackMaximiseNormal - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Disabled => _blackRestoreDisabled, - PaletteState.Tracking => _blackRestoreActive, - PaletteState.Pressed => _blackRestorePressed, - _ => _blackRestoreNormal - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Disabled => _blackHelpDisabled, - PaletteState.Tracking => _blackHelpActive, - _ => _blackHelpNormal - }, - PaletteButtonSpecStyle.RibbonMinimize => _blackRibbonMinimize, - PaletteButtonSpecStyle.RibbonExpand => _blackRibbonExpand, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Disabled => _blackCloseDisabled, + PaletteState.Tracking => _blackCloseActive, + PaletteState.Pressed => _blackClosePressed, + _ => _blackCloseNormal + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Disabled => _blackMinimiseDisabled, + PaletteState.Tracking => _blackMinimiseActive, + PaletteState.Pressed => _blackMinimisePressed, + _ => _blackMinimiseNormal + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Disabled => _blackMaximiseDisabled, + PaletteState.Tracking => _blackMaximiseActive, + PaletteState.Pressed => _blackMaximisePressed, + _ => _blackMaximiseNormal + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Disabled => _blackRestoreDisabled, + PaletteState.Tracking => _blackRestoreActive, + PaletteState.Pressed => _blackRestorePressed, + _ => _blackRestoreNormal + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Disabled => _blackHelpDisabled, + PaletteState.Tracking => _blackHelpActive, + _ => _blackHelpNormal + }, + PaletteButtonSpecStyle.RibbonMinimize => _blackRibbonMinimize, + PaletteButtonSpecStyle.RibbonExpand => _blackRibbonExpand, + _ => base.GetButtonSpecImage(style, state) + }; #endregion #region RibbonBack @@ -4435,15 +4429,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Extra Themes/PaletteOffice2007BlueDarkMode.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Extra Themes/PaletteOffice2007BlueDarkMode.cs index 3260c0641..9348957ce 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Extra Themes/PaletteOffice2007BlueDarkMode.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Extra Themes/PaletteOffice2007BlueDarkMode.cs @@ -325,14 +325,11 @@ public PaletteOffice2007BlueDarkMode() /// Background style. /// Palette value should be applicable to this state. /// Color drawing style. - public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) + public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) => style switch { - return style switch - { - PaletteBackStyle.HeaderForm => PaletteColorStyle.Rounding4, - _ => base.GetBackColorStyle(style, state) - }; - } + PaletteBackStyle.HeaderForm => PaletteColorStyle.Rounding4, + _ => base.GetBackColorStyle(style, state) + }; #endregion #region Images @@ -358,48 +355,45 @@ public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, Pale /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Disabled => _blueCloseDisabled, - PaletteState.Tracking => _blueCloseActive, - PaletteState.Pressed => _blueClosePressed, - _ => _blueCloseNormal - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Disabled => _blueMinimiseDisabled, - PaletteState.Tracking => _blueMinimiseActive, - PaletteState.Pressed => _blueMinimisePressed, - _ => _blueMinimiseNormal - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Disabled => _blueMaximiseDisabled, - PaletteState.Tracking => _blueMaximiseActive, - PaletteState.Pressed => _blueMaximisePressed, - _ => _blueMaximiseNormal - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Disabled => _blueRestoreDisabled, - PaletteState.Tracking => _blueRestoreActive, - PaletteState.Pressed => _blueRestorePressed, - _ => _blueRestoreNormal - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Disabled => _blueHelpDisabled, - PaletteState.Tracking => _blueHelpActive, - PaletteState.Pressed => _blueHelpPressed, - _ => _blueHelpNormal - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Disabled => _blueCloseDisabled, + PaletteState.Tracking => _blueCloseActive, + PaletteState.Pressed => _blueClosePressed, + _ => _blueCloseNormal + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Disabled => _blueMinimiseDisabled, + PaletteState.Tracking => _blueMinimiseActive, + PaletteState.Pressed => _blueMinimisePressed, + _ => _blueMinimiseNormal + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Disabled => _blueMaximiseDisabled, + PaletteState.Tracking => _blueMaximiseActive, + PaletteState.Pressed => _blueMaximisePressed, + _ => _blueMaximiseNormal + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Disabled => _blueRestoreDisabled, + PaletteState.Tracking => _blueRestoreActive, + PaletteState.Pressed => _blueRestorePressed, + _ => _blueRestoreNormal + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Disabled => _blueHelpDisabled, + PaletteState.Tracking => _blueHelpActive, + PaletteState.Pressed => _blueHelpPressed, + _ => _blueHelpNormal + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion #region RibbonBack @@ -3744,15 +3738,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Extra Themes/PaletteOffice2007BlueLightMode.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Extra Themes/PaletteOffice2007BlueLightMode.cs index c77c3d2c8..5fe6f325c 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Extra Themes/PaletteOffice2007BlueLightMode.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Extra Themes/PaletteOffice2007BlueLightMode.cs @@ -326,14 +326,11 @@ public PaletteOffice2007BlueLightMode() /// Background style. /// Palette value should be applicable to this state. /// Color drawing style. - public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) + public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) => style switch { - return style switch - { - PaletteBackStyle.HeaderForm => PaletteColorStyle.Rounding4, - _ => base.GetBackColorStyle(style, state) - }; - } + PaletteBackStyle.HeaderForm => PaletteColorStyle.Rounding4, + _ => base.GetBackColorStyle(style, state) + }; #endregion #region Images @@ -359,48 +356,45 @@ public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, Pale /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Disabled => _blueCloseDisabled, - PaletteState.Tracking => _blueCloseActive, - PaletteState.Pressed => _blueClosePressed, - _ => _blueCloseNormal - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Disabled => _blueMinimiseDisabled, - PaletteState.Tracking => _blueMinimiseActive, - PaletteState.Pressed => _blueMinimisePressed, - _ => _blueMinimiseNormal - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Disabled => _blueMaximiseDisabled, - PaletteState.Tracking => _blueMaximiseActive, - PaletteState.Pressed => _blueMaximisePressed, - _ => _blueMaximiseNormal - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Disabled => _blueRestoreDisabled, - PaletteState.Tracking => _blueRestoreActive, - PaletteState.Pressed => _blueRestorePressed, - _ => _blueRestoreNormal - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Disabled => _blueHelpDisabled, - PaletteState.Tracking => _blueHelpActive, - PaletteState.Pressed => _blueHelpPressed, - _ => _blueHelpNormal - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Disabled => _blueCloseDisabled, + PaletteState.Tracking => _blueCloseActive, + PaletteState.Pressed => _blueClosePressed, + _ => _blueCloseNormal + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Disabled => _blueMinimiseDisabled, + PaletteState.Tracking => _blueMinimiseActive, + PaletteState.Pressed => _blueMinimisePressed, + _ => _blueMinimiseNormal + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Disabled => _blueMaximiseDisabled, + PaletteState.Tracking => _blueMaximiseActive, + PaletteState.Pressed => _blueMaximisePressed, + _ => _blueMaximiseNormal + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Disabled => _blueRestoreDisabled, + PaletteState.Tracking => _blueRestoreActive, + PaletteState.Pressed => _blueRestorePressed, + _ => _blueRestoreNormal + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Disabled => _blueHelpDisabled, + PaletteState.Tracking => _blueHelpActive, + PaletteState.Pressed => _blueHelpPressed, + _ => _blueHelpNormal + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion #region RibbonBack @@ -4211,15 +4205,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Extra Themes/PaletteOffice2007SilverDarkMode.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Extra Themes/PaletteOffice2007SilverDarkMode.cs index 44769d4c6..568ae5655 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Extra Themes/PaletteOffice2007SilverDarkMode.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Extra Themes/PaletteOffice2007SilverDarkMode.cs @@ -337,14 +337,11 @@ public PaletteOffice2007SilverDarkMode() /// Background style. /// Palette value should be applicable to this state. /// Color drawing style. - public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) + public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) => style switch { - return style switch - { - PaletteBackStyle.HeaderForm => PaletteColorStyle.Rounding2, - _ => base.GetBackColorStyle(style, state) - }; - } + PaletteBackStyle.HeaderForm => PaletteColorStyle.Rounding2, + _ => base.GetBackColorStyle(style, state) + }; #endregion #region Images @@ -370,48 +367,45 @@ public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, Pale /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Disabled => _silverCloseDisabled, - PaletteState.Tracking => _silverCloseActive, - PaletteState.Pressed => _silverClosePressed, - _ => _silverCloseNormal - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Disabled => _silverMinimiseDisabled, - PaletteState.Tracking => _silverMinimiseActive, - PaletteState.Pressed => _silverMinimisePressed, - _ => _silverMinimiseNormal - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Disabled => _silverMaximiseDisabled, - PaletteState.Tracking => _silverMaximiseActive, - PaletteState.Pressed => _silverMaximisePressed, - _ => _silverMaximiseNormal - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Disabled => _silverRestoreDisabled, - PaletteState.Tracking => _silverRestoreActive, - PaletteState.Pressed => _silverRestorePressed, - _ => _silverRestoreNormal - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Disabled => _silverHelpDisabled, - PaletteState.Tracking => _silverHelpActive, - PaletteState.Pressed => _silverHelpPressed, - _ => _silverHelpNormal - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Disabled => _silverCloseDisabled, + PaletteState.Tracking => _silverCloseActive, + PaletteState.Pressed => _silverClosePressed, + _ => _silverCloseNormal + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Disabled => _silverMinimiseDisabled, + PaletteState.Tracking => _silverMinimiseActive, + PaletteState.Pressed => _silverMinimisePressed, + _ => _silverMinimiseNormal + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Disabled => _silverMaximiseDisabled, + PaletteState.Tracking => _silverMaximiseActive, + PaletteState.Pressed => _silverMaximisePressed, + _ => _silverMaximiseNormal + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Disabled => _silverRestoreDisabled, + PaletteState.Tracking => _silverRestoreActive, + PaletteState.Pressed => _silverRestorePressed, + _ => _silverRestoreNormal + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Disabled => _silverHelpDisabled, + PaletteState.Tracking => _silverHelpActive, + PaletteState.Pressed => _silverHelpPressed, + _ => _silverHelpNormal + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } #endregion @@ -4192,15 +4186,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Extra Themes/PaletteOffice2007SilverLightMode.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Extra Themes/PaletteOffice2007SilverLightMode.cs index 995c5134b..f79a8eb89 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Extra Themes/PaletteOffice2007SilverLightMode.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Extra Themes/PaletteOffice2007SilverLightMode.cs @@ -342,14 +342,11 @@ public PaletteOffice2007SilverLightMode() /// Background style. /// Palette value should be applicable to this state. /// Color drawing style. - public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) + public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) => style switch { - return style switch - { - PaletteBackStyle.HeaderForm => PaletteColorStyle.Rounding2, - _ => base.GetBackColorStyle(style, state) - }; - } + PaletteBackStyle.HeaderForm => PaletteColorStyle.Rounding2, + _ => base.GetBackColorStyle(style, state) + }; #endregion #region Images @@ -375,48 +372,45 @@ public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, Pale /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Disabled => _silverCloseDisabled, - PaletteState.Tracking => _silverCloseActive, - PaletteState.Pressed => _silverClosePressed, - _ => _silverCloseNormal - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Disabled => _silverMinimiseDisabled, - PaletteState.Tracking => _silverMinimiseActive, - PaletteState.Pressed => _silverMinimisePressed, - _ => _silverMinimiseNormal - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Disabled => _silverMaximiseDisabled, - PaletteState.Tracking => _silverMaximiseActive, - PaletteState.Pressed => _silverMaximisePressed, - _ => _silverMaximiseNormal - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Disabled => _silverRestoreDisabled, - PaletteState.Tracking => _silverRestoreActive, - PaletteState.Pressed => _silverRestorePressed, - _ => _silverRestoreNormal - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Disabled => _silverHelpDisabled, - PaletteState.Tracking => _silverHelpActive, - PaletteState.Pressed => _silverHelpPressed, - _ => _silverHelpNormal - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Disabled => _silverCloseDisabled, + PaletteState.Tracking => _silverCloseActive, + PaletteState.Pressed => _silverClosePressed, + _ => _silverCloseNormal + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Disabled => _silverMinimiseDisabled, + PaletteState.Tracking => _silverMinimiseActive, + PaletteState.Pressed => _silverMinimisePressed, + _ => _silverMinimiseNormal + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Disabled => _silverMaximiseDisabled, + PaletteState.Tracking => _silverMaximiseActive, + PaletteState.Pressed => _silverMaximisePressed, + _ => _silverMaximiseNormal + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Disabled => _silverRestoreDisabled, + PaletteState.Tracking => _silverRestoreActive, + PaletteState.Pressed => _silverRestorePressed, + _ => _silverRestoreNormal + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Disabled => _silverHelpDisabled, + PaletteState.Tracking => _silverHelpActive, + PaletteState.Pressed => _silverHelpPressed, + _ => _silverHelpNormal + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } #endregion @@ -4251,15 +4245,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Non Official Themes/PaletteOffice2007DarkGray.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Non Official Themes/PaletteOffice2007DarkGray.cs index 54e7ea4ab..80a3acd91 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Non Official Themes/PaletteOffice2007DarkGray.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Non Official Themes/PaletteOffice2007DarkGray.cs @@ -337,14 +337,11 @@ public PaletteOffice2007DarkGray() : base(_themeName, _schemeOfficeColours, _che /// Background style. /// Palette value should be applicable to this state. /// Color drawing style. - public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) + public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) => style switch { - return style switch - { - PaletteBackStyle.HeaderForm => PaletteColorStyle.Rounding2, - _ => base.GetBackColorStyle(style, state) - }; - } + PaletteBackStyle.HeaderForm => PaletteColorStyle.Rounding2, + _ => base.GetBackColorStyle(style, state) + }; #endregion #region Images @@ -369,48 +366,45 @@ public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, Pale /// Style of button spec. /// State for which image is required. /// Image value. - public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) + public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, PaletteState state) => style switch { - return style switch + PaletteButtonSpecStyle.FormClose => state switch { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Disabled => _silverCloseDisabled, - PaletteState.Tracking => _silverCloseActive, - PaletteState.Pressed => _silverClosePressed, - _ => _silverCloseNormal - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Disabled => _silverMinimiseDisabled, - PaletteState.Tracking => _silverMinimiseActive, - PaletteState.Pressed => _silverMinimisePressed, - _ => _silverMinimiseNormal - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Disabled => _silverMaximiseDisabled, - PaletteState.Tracking => _silverMaximiseActive, - PaletteState.Pressed => _silverMaximisePressed, - _ => _silverMaximiseNormal - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Disabled => _silverRestoreDisabled, - PaletteState.Tracking => _silverRestoreActive, - PaletteState.Pressed => _silverRestorePressed, - _ => _silverRestoreNormal - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Disabled => _silverHelpDisabled, - PaletteState.Tracking => _silverHelpActive, - PaletteState.Pressed => _silverHelpPressed, - _ => _silverHelpNormal - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState.Disabled => _silverCloseDisabled, + PaletteState.Tracking => _silverCloseActive, + PaletteState.Pressed => _silverClosePressed, + _ => _silverCloseNormal + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Disabled => _silverMinimiseDisabled, + PaletteState.Tracking => _silverMinimiseActive, + PaletteState.Pressed => _silverMinimisePressed, + _ => _silverMinimiseNormal + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Disabled => _silverMaximiseDisabled, + PaletteState.Tracking => _silverMaximiseActive, + PaletteState.Pressed => _silverMaximisePressed, + _ => _silverMaximiseNormal + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Disabled => _silverRestoreDisabled, + PaletteState.Tracking => _silverRestoreActive, + PaletteState.Pressed => _silverRestorePressed, + _ => _silverRestoreNormal + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Disabled => _silverHelpDisabled, + PaletteState.Tracking => _silverHelpActive, + PaletteState.Pressed => _silverHelpPressed, + _ => _silverHelpNormal + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Non Official Themes/PaletteOffice2007LightGray.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Non Official Themes/PaletteOffice2007LightGray.cs index 3884c7641..57260e3c4 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Non Official Themes/PaletteOffice2007LightGray.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Non Official Themes/PaletteOffice2007LightGray.cs @@ -20,9 +20,6 @@ public PaletteOffice2007LightGray(string themeName, Color[] schemeColors, ImageL { } - public override Image? GetContextMenuSubMenuImage() - { - throw new NotImplementedException(); - } + public override Image? GetContextMenuSubMenuImage() => throw new NotImplementedException(); } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Non Official Themes/PaletteOffice2007White.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Non Official Themes/PaletteOffice2007White.cs index f491d0188..2a7c76e82 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Non Official Themes/PaletteOffice2007White.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Non Official Themes/PaletteOffice2007White.cs @@ -326,14 +326,11 @@ public PaletteOffice2007White() /// Background style. /// Palette value should be applicable to this state. /// Color drawing style. - public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) + public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) => style switch { - return style switch - { - PaletteBackStyle.HeaderForm => PaletteColorStyle.Rounding2, - _ => base.GetBackColorStyle(style, state) - }; - } + PaletteBackStyle.HeaderForm => PaletteColorStyle.Rounding2, + _ => base.GetBackColorStyle(style, state) + }; #endregion #region Images @@ -359,48 +356,45 @@ public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, Pale /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Disabled => _silverCloseDisabled, - PaletteState.Tracking => _silverCloseActive, - PaletteState.Pressed => _silverClosePressed, - _ => _silverCloseNormal - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Disabled => _silverMinimiseDisabled, - PaletteState.Tracking => _silverMinimiseActive, - PaletteState.Pressed => _silverMinimisePressed, - _ => _silverMinimiseNormal - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Disabled => _silverMaximiseDisabled, - PaletteState.Tracking => _silverMaximiseActive, - PaletteState.Pressed => _silverMaximisePressed, - _ => _silverMaximiseNormal - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Disabled => _silverRestoreDisabled, - PaletteState.Tracking => _silverRestoreActive, - PaletteState.Pressed => _silverRestorePressed, - _ => _silverRestoreNormal - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Disabled => _silverHelpDisabled, - PaletteState.Tracking => _silverHelpActive, - PaletteState.Pressed => _silverHelpPressed, - _ => _silverHelpNormal - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Disabled => _silverCloseDisabled, + PaletteState.Tracking => _silverCloseActive, + PaletteState.Pressed => _silverClosePressed, + _ => _silverCloseNormal + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Disabled => _silverMinimiseDisabled, + PaletteState.Tracking => _silverMinimiseActive, + PaletteState.Pressed => _silverMinimisePressed, + _ => _silverMinimiseNormal + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Disabled => _silverMaximiseDisabled, + PaletteState.Tracking => _silverMaximiseActive, + PaletteState.Pressed => _silverMaximisePressed, + _ => _silverMaximiseNormal + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Disabled => _silverRestoreDisabled, + PaletteState.Tracking => _silverRestoreActive, + PaletteState.Pressed => _silverRestorePressed, + _ => _silverRestoreNormal + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Disabled => _silverHelpDisabled, + PaletteState.Tracking => _silverHelpActive, + PaletteState.Pressed => _silverHelpPressed, + _ => _silverHelpNormal + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } } \ No newline at end of file diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Official Themes/PaletteOffice2007Black.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Official Themes/PaletteOffice2007Black.cs index 169980cbf..3188ceaec 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Official Themes/PaletteOffice2007Black.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Official Themes/PaletteOffice2007Black.cs @@ -318,19 +318,16 @@ public PaletteOffice2007Black() /// Background style. /// Palette value should be applicable to this state. /// Color drawing style. - public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) + public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) => style switch { - return style switch + PaletteBackStyle.ButtonForm => state switch { - PaletteBackStyle.ButtonForm => state switch - { - PaletteState.Tracking or PaletteState.CheckedTracking or PaletteState.Pressed or PaletteState.CheckedPressed => PaletteColorStyle.GlassBottom, - _ => PaletteColorStyle.GlassNormalFull - }, - PaletteBackStyle.HeaderForm => PaletteColorStyle.Rounding3, - _ => base.GetBackColorStyle(style, state) - }; - } + PaletteState.Tracking or PaletteState.CheckedTracking or PaletteState.Pressed or PaletteState.CheckedPressed => PaletteColorStyle.GlassBottom, + _ => PaletteColorStyle.GlassNormalFull + }, + PaletteBackStyle.HeaderForm => PaletteColorStyle.Rounding3, + _ => base.GetBackColorStyle(style, state) + }; /// /// Gets the second back color. @@ -510,49 +507,46 @@ public override Color GetContentLongTextColor2(PaletteContentStyle style, Palett /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Disabled => _blackCloseDisabled, - PaletteState.Tracking => _blackCloseActive, - PaletteState.Pressed => _blackClosePressed, - _ => _blackCloseNormal - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Disabled => _blackMinimiseDisabled, - PaletteState.Tracking => _blackMinimiseActive, - PaletteState.Pressed => _blackMinimisePressed, - _ => _blackMinimiseNormal - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Disabled => _blackMaximiseDisabled, - PaletteState.Tracking => _blackMaximiseActive, - PaletteState.Pressed => _blackMaximisePressed, - _ => _blackMaximiseNormal - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Disabled => _blackRestoreDisabled, - PaletteState.Tracking => _blackRestoreActive, - PaletteState.Pressed => _blackRestorePressed, - _ => _blackRestoreNormal - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Disabled => _blackHelpDisabled, - PaletteState.Tracking => _blackHelpActive, - _ => _blackHelpNormal - }, - PaletteButtonSpecStyle.RibbonMinimize => _blackRibbonMinimize, - PaletteButtonSpecStyle.RibbonExpand => _blackRibbonExpand, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Disabled => _blackCloseDisabled, + PaletteState.Tracking => _blackCloseActive, + PaletteState.Pressed => _blackClosePressed, + _ => _blackCloseNormal + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Disabled => _blackMinimiseDisabled, + PaletteState.Tracking => _blackMinimiseActive, + PaletteState.Pressed => _blackMinimisePressed, + _ => _blackMinimiseNormal + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Disabled => _blackMaximiseDisabled, + PaletteState.Tracking => _blackMaximiseActive, + PaletteState.Pressed => _blackMaximisePressed, + _ => _blackMaximiseNormal + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Disabled => _blackRestoreDisabled, + PaletteState.Tracking => _blackRestoreActive, + PaletteState.Pressed => _blackRestorePressed, + _ => _blackRestoreNormal + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Disabled => _blackHelpDisabled, + PaletteState.Tracking => _blackHelpActive, + _ => _blackHelpNormal + }, + PaletteButtonSpecStyle.RibbonMinimize => _blackRibbonMinimize, + PaletteButtonSpecStyle.RibbonExpand => _blackRibbonExpand, + _ => base.GetButtonSpecImage(style, state) + }; #endregion #region RibbonBack diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Official Themes/PaletteOffice2007Blue.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Official Themes/PaletteOffice2007Blue.cs index 8f1c53a6c..2107b2e3b 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Official Themes/PaletteOffice2007Blue.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Official Themes/PaletteOffice2007Blue.cs @@ -316,14 +316,11 @@ public PaletteOffice2007Blue() /// Background style. /// Palette value should be applicable to this state. /// Color drawing style. - public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) + public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) => style switch { - return style switch - { - PaletteBackStyle.HeaderForm => PaletteColorStyle.Rounding4, - _ => base.GetBackColorStyle(style, state) - }; - } + PaletteBackStyle.HeaderForm => PaletteColorStyle.Rounding4, + _ => base.GetBackColorStyle(style, state) + }; #endregion #region Images @@ -349,48 +346,45 @@ public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, Pale /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Disabled => _blueCloseDisabled, - PaletteState.Tracking => _blueCloseActive, - PaletteState.Pressed => _blueClosePressed, - _ => _blueCloseNormal - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Disabled => _blueMinimiseDisabled, - PaletteState.Tracking => _blueMinimiseActive, - PaletteState.Pressed => _blueMinimisePressed, - _ => _blueMinimiseNormal - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Disabled => _blueMaximiseDisabled, - PaletteState.Tracking => _blueMaximiseActive, - PaletteState.Pressed => _blueMaximisePressed, - _ => _blueMaximiseNormal - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Disabled => _blueRestoreDisabled, - PaletteState.Tracking => _blueRestoreActive, - PaletteState.Pressed => _blueRestorePressed, - _ => _blueRestoreNormal - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Disabled => _blueHelpDisabled, - PaletteState.Tracking => _blueHelpActive, - PaletteState.Pressed => _blueHelpPressed, - _ => _blueHelpNormal - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Disabled => _blueCloseDisabled, + PaletteState.Tracking => _blueCloseActive, + PaletteState.Pressed => _blueClosePressed, + _ => _blueCloseNormal + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Disabled => _blueMinimiseDisabled, + PaletteState.Tracking => _blueMinimiseActive, + PaletteState.Pressed => _blueMinimisePressed, + _ => _blueMinimiseNormal + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Disabled => _blueMaximiseDisabled, + PaletteState.Tracking => _blueMaximiseActive, + PaletteState.Pressed => _blueMaximisePressed, + _ => _blueMaximiseNormal + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Disabled => _blueRestoreDisabled, + PaletteState.Tracking => _blueRestoreActive, + PaletteState.Pressed => _blueRestorePressed, + _ => _blueRestoreNormal + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Disabled => _blueHelpDisabled, + PaletteState.Tracking => _blueHelpActive, + PaletteState.Pressed => _blueHelpPressed, + _ => _blueHelpNormal + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion #region RibbonBack diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Official Themes/PaletteOffice2007Silver.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Official Themes/PaletteOffice2007Silver.cs index 4681669c9..eece0bfbc 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Official Themes/PaletteOffice2007Silver.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2007/Official Themes/PaletteOffice2007Silver.cs @@ -316,14 +316,11 @@ public PaletteOffice2007Silver() /// Background style. /// Palette value should be applicable to this state. /// Color drawing style. - public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) + public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, PaletteState state) => style switch { - return style switch - { - PaletteBackStyle.HeaderForm => PaletteColorStyle.Rounding2, - _ => base.GetBackColorStyle(style, state) - }; - } + PaletteBackStyle.HeaderForm => PaletteColorStyle.Rounding2, + _ => base.GetBackColorStyle(style, state) + }; #endregion #region Images @@ -349,48 +346,45 @@ public override PaletteColorStyle GetBackColorStyle(PaletteBackStyle style, Pale /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Disabled => _silverCloseDisabled, - PaletteState.Tracking => _silverCloseActive, - PaletteState.Pressed => _silverClosePressed, - _ => _silverCloseNormal - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Disabled => _silverMinimiseDisabled, - PaletteState.Tracking => _silverMinimiseActive, - PaletteState.Pressed => _silverMinimisePressed, - _ => _silverMinimiseNormal - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Disabled => _silverMaximiseDisabled, - PaletteState.Tracking => _silverMaximiseActive, - PaletteState.Pressed => _silverMaximisePressed, - _ => _silverMaximiseNormal - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Disabled => _silverRestoreDisabled, - PaletteState.Tracking => _silverRestoreActive, - PaletteState.Pressed => _silverRestorePressed, - _ => _silverRestoreNormal - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Disabled => _silverHelpDisabled, - PaletteState.Tracking => _silverHelpActive, - PaletteState.Pressed => _silverHelpPressed, - _ => _silverHelpNormal - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Disabled => _silverCloseDisabled, + PaletteState.Tracking => _silverCloseActive, + PaletteState.Pressed => _silverClosePressed, + _ => _silverCloseNormal + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Disabled => _silverMinimiseDisabled, + PaletteState.Tracking => _silverMinimiseActive, + PaletteState.Pressed => _silverMinimisePressed, + _ => _silverMinimiseNormal + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Disabled => _silverMaximiseDisabled, + PaletteState.Tracking => _silverMaximiseActive, + PaletteState.Pressed => _silverMaximisePressed, + _ => _silverMaximiseNormal + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Disabled => _silverRestoreDisabled, + PaletteState.Tracking => _silverRestoreActive, + PaletteState.Pressed => _silverRestorePressed, + _ => _silverRestoreNormal + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Disabled => _silverHelpDisabled, + PaletteState.Tracking => _silverHelpActive, + PaletteState.Pressed => _silverHelpPressed, + _ => _silverHelpNormal + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Bases/PaletteOffice2010Base.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Bases/PaletteOffice2010Base.cs index 2ee479b9e..8520e58dc 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Bases/PaletteOffice2010Base.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Bases/PaletteOffice2010Base.cs @@ -3102,15 +3102,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Extra Themes/PaletteOffice2010BlackDarkMode.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Extra Themes/PaletteOffice2010BlackDarkMode.cs index 89ab03e09..309b676c3 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Extra Themes/PaletteOffice2010BlackDarkMode.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Extra Themes/PaletteOffice2010BlackDarkMode.cs @@ -615,53 +615,50 @@ public override Color GetContentLongTextColor2(PaletteContentStyle style, Palett /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.PendantClose => _buttonSpecPendantClose, - PaletteButtonSpecStyle.PendantMin => _buttonSpecPendantMin, - PaletteButtonSpecStyle.PendantRestore => _buttonSpecPendantRestore, - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - PaletteButtonSpecStyle.RibbonMinimize => _buttonSpecRibbonMinimize, - PaletteButtonSpecStyle.RibbonExpand => _buttonSpecRibbonExpand, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.PendantClose => _buttonSpecPendantClose, + PaletteButtonSpecStyle.PendantMin => _buttonSpecPendantMin, + PaletteButtonSpecStyle.PendantRestore => _buttonSpecPendantRestore, + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + PaletteButtonSpecStyle.RibbonMinimize => _buttonSpecRibbonMinimize, + PaletteButtonSpecStyle.RibbonExpand => _buttonSpecRibbonExpand, + _ => base.GetButtonSpecImage(style, state) + }; #endregion #region RibbonText @@ -3972,15 +3969,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Extra Themes/PaletteOffice2010BlueDarkMode.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Extra Themes/PaletteOffice2010BlueDarkMode.cs index 7044717ce..128001020 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Extra Themes/PaletteOffice2010BlueDarkMode.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Extra Themes/PaletteOffice2010BlueDarkMode.cs @@ -359,48 +359,45 @@ public PaletteOffice2010BlueDarkMode() /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } #endregion @@ -3614,15 +3611,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Extra Themes/PaletteOffice2010BlueLightMode.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Extra Themes/PaletteOffice2010BlueLightMode.cs index 4a1030e1e..d8d20fc65 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Extra Themes/PaletteOffice2010BlueLightMode.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Extra Themes/PaletteOffice2010BlueLightMode.cs @@ -365,48 +365,45 @@ public PaletteOffice2010BlueLightMode() /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } #endregion @@ -3593,15 +3590,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Extra Themes/PaletteOffice2010SilverDarkMode.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Extra Themes/PaletteOffice2010SilverDarkMode.cs index 392a249a0..dcf69d996 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Extra Themes/PaletteOffice2010SilverDarkMode.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Extra Themes/PaletteOffice2010SilverDarkMode.cs @@ -358,48 +358,45 @@ public PaletteOffice2010SilverDarkMode() /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } #endregion @@ -3588,15 +3585,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Extra Themes/PaletteOffice2010SilverLightMode.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Extra Themes/PaletteOffice2010SilverLightMode.cs index c6d731748..9cf837a19 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Extra Themes/PaletteOffice2010SilverLightMode.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Extra Themes/PaletteOffice2010SilverLightMode.cs @@ -370,48 +370,45 @@ public PaletteOffice2010SilverLightMode() /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } #endregion @@ -3630,15 +3627,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Non Official Themes/PaletteOffice2010DarkGray.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Non Official Themes/PaletteOffice2010DarkGray.cs index 3413c6ba0..3833f05b1 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Non Official Themes/PaletteOffice2010DarkGray.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Non Official Themes/PaletteOffice2010DarkGray.cs @@ -359,48 +359,45 @@ public PaletteOffice2010DarkGray() /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Non Official Themes/PaletteOffice2010LightGray.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Non Official Themes/PaletteOffice2010LightGray.cs index 4f692632b..f8a86657e 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Non Official Themes/PaletteOffice2010LightGray.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Non Official Themes/PaletteOffice2010LightGray.cs @@ -18,9 +18,6 @@ public PaletteOffice2010LightGray(Color[] schemeColors, ImageList checkBoxList, { } - public override Image? GetContextMenuSubMenuImage() - { - throw new NotImplementedException(); - } + public override Image? GetContextMenuSubMenuImage() => throw new NotImplementedException(); } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Non Official Themes/PaletteOffice2010White.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Non Official Themes/PaletteOffice2010White.cs index d1dda1c80..8c6262809 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Non Official Themes/PaletteOffice2010White.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Non Official Themes/PaletteOffice2010White.cs @@ -344,48 +344,45 @@ public PaletteOffice2010White() /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Official Themes/PaletteOffice2010Black.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Official Themes/PaletteOffice2010Black.cs index e72fca120..ceb56cad5 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Official Themes/PaletteOffice2010Black.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Official Themes/PaletteOffice2010Black.cs @@ -611,53 +611,50 @@ public override Color GetContentLongTextColor2(PaletteContentStyle style, Palett /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.PendantClose => _buttonSpecPendantClose, - PaletteButtonSpecStyle.PendantMin => _buttonSpecPendantMin, - PaletteButtonSpecStyle.PendantRestore => _buttonSpecPendantRestore, - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - PaletteButtonSpecStyle.RibbonMinimize => _buttonSpecRibbonMinimize, - PaletteButtonSpecStyle.RibbonExpand => _buttonSpecRibbonExpand, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.PendantClose => _buttonSpecPendantClose, + PaletteButtonSpecStyle.PendantMin => _buttonSpecPendantMin, + PaletteButtonSpecStyle.PendantRestore => _buttonSpecPendantRestore, + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + PaletteButtonSpecStyle.RibbonMinimize => _buttonSpecRibbonMinimize, + PaletteButtonSpecStyle.RibbonExpand => _buttonSpecRibbonExpand, + _ => base.GetButtonSpecImage(style, state) + }; #endregion #region RibbonText diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Official Themes/PaletteOffice2010Blue.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Official Themes/PaletteOffice2010Blue.cs index 19f0f9670..62d3212bc 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Official Themes/PaletteOffice2010Blue.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Official Themes/PaletteOffice2010Blue.cs @@ -344,48 +344,45 @@ public PaletteOffice2010Blue() /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Official Themes/PaletteOffice2010Silver.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Official Themes/PaletteOffice2010Silver.cs index ef5298eee..91d6ee30e 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Official Themes/PaletteOffice2010Silver.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2010/Official Themes/PaletteOffice2010Silver.cs @@ -344,48 +344,45 @@ public PaletteOffice2010Silver() /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2013/Bases/PaletteOffice2013Base.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2013/Bases/PaletteOffice2013Base.cs index cb75d9a7c..a78c6a2de 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2013/Bases/PaletteOffice2013Base.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2013/Bases/PaletteOffice2013Base.cs @@ -3070,15 +3070,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2013/Official Themes/PaletteOffice2013DarkGray.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2013/Official Themes/PaletteOffice2013DarkGray.cs index 1b3a2068d..345d034ff 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2013/Official Themes/PaletteOffice2013DarkGray.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2013/Official Themes/PaletteOffice2013DarkGray.cs @@ -362,48 +362,45 @@ public PaletteOffice2013DarkGray() /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2013/Official Themes/PaletteOffice2013White.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2013/Official Themes/PaletteOffice2013White.cs index 8d278ba64..d3cf46d4d 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2013/Official Themes/PaletteOffice2013White.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Office 2013/Official Themes/PaletteOffice2013White.cs @@ -375,48 +375,45 @@ public PaletteOffice2013White() /// State for which image is required. /// Image value. public override Image? GetButtonSpecImage(PaletteButtonSpecStyle style, - PaletteState state) - { - return style switch - { - PaletteButtonSpecStyle.FormClose => state switch - { - PaletteState.Tracking => _formCloseActive, - PaletteState.Normal => _formCloseNormal, - PaletteState.Pressed => _formClosePressed, - _ => _formCloseDisabled - }, - PaletteButtonSpecStyle.FormMin => state switch - { - PaletteState.Normal => _formMinimiseNormal, - PaletteState.Tracking => _formMinimiseActive, - PaletteState.Pressed => _formMinimisePressed, - _ => _formMinimiseDisabled - }, - PaletteButtonSpecStyle.FormMax => state switch - { - PaletteState.Normal => _formMaximiseNormal, - PaletteState.Tracking => _formMaximiseActive, - PaletteState.Pressed => _formMaximisePressed, - _ => _formMaximiseDisabled - }, - PaletteButtonSpecStyle.FormRestore => state switch - { - PaletteState.Normal => _formRestoreNormal, - PaletteState.Tracking => _formRestoreActive, - PaletteState.Pressed => _formRestorePressed, - _ => _formRestoreDisabled - }, - PaletteButtonSpecStyle.FormHelp => state switch - { - PaletteState.Tracking => _formHelpActive, - PaletteState.Pressed => _formHelpPressed, - PaletteState.Normal => _formHelpNormal, - _ => _formHelpDisabled - }, - _ => base.GetButtonSpecImage(style, state) - }; - } + PaletteState state) => style switch + { + PaletteButtonSpecStyle.FormClose => state switch + { + PaletteState.Tracking => _formCloseActive, + PaletteState.Normal => _formCloseNormal, + PaletteState.Pressed => _formClosePressed, + _ => _formCloseDisabled + }, + PaletteButtonSpecStyle.FormMin => state switch + { + PaletteState.Normal => _formMinimiseNormal, + PaletteState.Tracking => _formMinimiseActive, + PaletteState.Pressed => _formMinimisePressed, + _ => _formMinimiseDisabled + }, + PaletteButtonSpecStyle.FormMax => state switch + { + PaletteState.Normal => _formMaximiseNormal, + PaletteState.Tracking => _formMaximiseActive, + PaletteState.Pressed => _formMaximisePressed, + _ => _formMaximiseDisabled + }, + PaletteButtonSpecStyle.FormRestore => state switch + { + PaletteState.Normal => _formRestoreNormal, + PaletteState.Tracking => _formRestoreActive, + PaletteState.Pressed => _formRestorePressed, + _ => _formRestoreDisabled + }, + PaletteButtonSpecStyle.FormHelp => state switch + { + PaletteState.Tracking => _formHelpActive, + PaletteState.Pressed => _formHelpPressed, + PaletteState.Normal => _formHelpNormal, + _ => _formHelpDisabled + }, + _ => base.GetButtonSpecImage(style, state) + }; #endregion } @@ -3471,15 +3468,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], - PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], - _ => _galleryButtonList.Images[0] - }; - } + PaletteRibbonGalleryButton.Up => _galleryButtonList.Images[1], + PaletteRibbonGalleryButton.DropDown => _galleryButtonList.Images[2], + _ => _galleryButtonList.Images[0] + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Professional/PaletteProfessionalOffice2003.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Professional/PaletteProfessionalOffice2003.cs index 86db4455e..030e11abc 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Professional/PaletteProfessionalOffice2003.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Professional/PaletteProfessionalOffice2003.cs @@ -3094,15 +3094,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Down => _galleryImageDown ??= CreateGalleryDownImage(SystemColors.ControlText), - PaletteRibbonGalleryButton.DropDown => _galleryImageDropDown ??= CreateGalleryDropDownImage(SystemColors.ControlText), - _ => _galleryImageUp ??= CreateGalleryUpImage(SystemColors.ControlText) - }; - } + PaletteRibbonGalleryButton.Down => _galleryImageDown ??= CreateGalleryDownImage(SystemColors.ControlText), + PaletteRibbonGalleryButton.DropDown => _galleryImageDropDown ??= CreateGalleryDropDownImage(SystemColors.ControlText), + _ => _galleryImageUp ??= CreateGalleryUpImage(SystemColors.ControlText) + }; #endregion #region ButtonSpec @@ -4585,7 +4582,7 @@ public override Color GetElementColor5(PaletteElement element, PaletteState stat internal virtual KryptonProfessionalKCT GenerateColorTable(bool useSystemColors) { // Create the color table to use as the base for getting krypton colors - KryptonColorTable kct = new KryptonColorTable(this) + var kct = new KryptonColorTable(this) { // Always turn off the use of any theme specific colors @@ -4951,13 +4948,13 @@ private Image CreateDropDownImage(Color color) // Use a graphics instance for drawing the image using Graphics g = Graphics.FromImage(image); // Draw a solid arrow - using (SolidBrush fill = new SolidBrush(color)) + using (var fill = new SolidBrush(color)) { g.FillPolygon(fill, new Point[] { new Point(2, 3), new Point(4, 6), new Point(7, 3) }); } // Draw semi-transparent outline around the arrow - using Pen outline = new Pen(Color.FromArgb(128, color)); + using var outline = new Pen(Color.FromArgb(128, color)); g.DrawLines(outline, new Point[] { new Point(1, 3), new Point(4, 6), new Point(7, 3) }); return image; @@ -4971,7 +4968,7 @@ private Image CreateGalleryUpImage(Color color) // Use a graphics instance for drawing the image using Graphics g = Graphics.FromImage(image); // Draw a solid arrow - using SolidBrush fill = new SolidBrush(color); + using var fill = new SolidBrush(color); g.FillPolygon(fill, new Point[] { new Point(3, 6), new Point(6, 2), new Point(9, 6) }); return image; @@ -4985,7 +4982,7 @@ private Image CreateGalleryDownImage(Color color) // Use a graphics instance for drawing the image using Graphics g = Graphics.FromImage(image); // Draw a solid arrow - using SolidBrush fill = new SolidBrush(color); + using var fill = new SolidBrush(color); g.FillPolygon(fill, new Point[] { new Point(4, 3), new Point(6, 6), new Point(9, 3) }); return image; @@ -4999,13 +4996,13 @@ private Image CreateGalleryDropDownImage(Color color) // Use a graphics instance for drawing the image using Graphics g = Graphics.FromImage(image); // Draw a solid arrow - using (SolidBrush fill = new SolidBrush(color)) + using (var fill = new SolidBrush(color)) { g.FillPolygon(fill, new Point[] { new Point(4, 3), new Point(6, 6), new Point(9, 3) }); } // Draw the line above the arrow - using Pen pen = new Pen(color); + using var pen = new Pen(color); g.DrawLine(pen, 4, 1, 8, 1); return image; diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Professional/PaletteProfessionalSystem.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Professional/PaletteProfessionalSystem.cs index be5fa4e48..65f9bc4b5 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Professional/PaletteProfessionalSystem.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Professional/PaletteProfessionalSystem.cs @@ -2831,15 +2831,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Down => _galleryImageDown ??= CreateGalleryDownImage(SystemColors.ControlText), - PaletteRibbonGalleryButton.DropDown => _galleryImageDropDown ??= CreateGalleryDropDownImage(SystemColors.ControlText), - _ => _galleryImageUp ??= CreateGalleryUpImage(SystemColors.ControlText) - }; - } + PaletteRibbonGalleryButton.Down => _galleryImageDown ??= CreateGalleryDownImage(SystemColors.ControlText), + PaletteRibbonGalleryButton.DropDown => _galleryImageDropDown ??= CreateGalleryDropDownImage(SystemColors.ControlText), + _ => _galleryImageUp ??= CreateGalleryUpImage(SystemColors.ControlText) + }; #endregion #region ButtonSpec @@ -4324,7 +4321,7 @@ public override Color GetElementColor5(PaletteElement element, PaletteState stat internal virtual KryptonProfessionalKCT GenerateColorTable(bool useSystemColors) { // Create the color table to use as the base for getting krypton colors - KryptonColorTable kct = new KryptonColorTable(this) + var kct = new KryptonColorTable(this) { // Always turn off the use of any theme specific colors @@ -4690,13 +4687,13 @@ private Image CreateDropDownImage(Color color) // Use a graphics instance for drawing the image using Graphics g = Graphics.FromImage(image); // Draw a solid arrow - using (SolidBrush fill = new SolidBrush(color)) + using (var fill = new SolidBrush(color)) { g.FillPolygon(fill, new Point[] { new Point(2, 3), new Point(4, 6), new Point(7, 3) }); } // Draw semi-transparent outline around the arrow - using Pen outline = new Pen(Color.FromArgb(128, color)); + using var outline = new Pen(Color.FromArgb(128, color)); g.DrawLines(outline, new Point[] { new Point(1, 3), new Point(4, 6), new Point(7, 3) }); return image; @@ -4710,7 +4707,7 @@ private Image CreateGalleryUpImage(Color color) // Use a graphics instance for drawing the image using Graphics g = Graphics.FromImage(image); // Draw a solid arrow - using SolidBrush fill = new SolidBrush(color); + using var fill = new SolidBrush(color); g.FillPolygon(fill, new Point[] { new Point(3, 6), new Point(6, 2), new Point(9, 6) }); return image; @@ -4724,7 +4721,7 @@ private Image CreateGalleryDownImage(Color color) // Use a graphics instance for drawing the image using Graphics g = Graphics.FromImage(image); // Draw a solid arrow - using SolidBrush fill = new SolidBrush(color); + using var fill = new SolidBrush(color); g.FillPolygon(fill, new Point[] { new Point(4, 3), new Point(6, 6), new Point(9, 3) }); return image; @@ -4738,13 +4735,13 @@ private Image CreateGalleryDropDownImage(Color color) // Use a graphics instance for drawing the image using Graphics g = Graphics.FromImage(image); // Draw a solid arrow - using (SolidBrush fill = new SolidBrush(color)) + using (var fill = new SolidBrush(color)) { g.FillPolygon(fill, new Point[] { new Point(4, 3), new Point(6, 6), new Point(9, 3) }); } // Draw the line above the arrow - using Pen pen = new Pen(color); + using var pen = new Pen(color); g.DrawLine(pen, 4, 1, 8, 1); return image; diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Sparkle/Base/PaletteSparkleBase.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Sparkle/Base/PaletteSparkleBase.cs index 9529a1321..583b67392 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Sparkle/Base/PaletteSparkleBase.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Sparkle/Base/PaletteSparkleBase.cs @@ -3087,15 +3087,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => state == PaletteState.Disabled ? _disabledDropUp : _sparkleDropUpButton, - PaletteRibbonGalleryButton.DropDown => state == PaletteState.Disabled ? _disabledGalleryDrop : _sparkleGalleryDropButton, - _ => state == PaletteState.Disabled ? _disabledDropDown : _sparkleDropDownButton - }; - } + PaletteRibbonGalleryButton.Up => state == PaletteState.Disabled ? _disabledDropUp : _sparkleDropUpButton, + PaletteRibbonGalleryButton.DropDown => state == PaletteState.Disabled ? _disabledGalleryDrop : _sparkleGalleryDropButton, + _ => state == PaletteState.Disabled ? _disabledDropDown : _sparkleDropDownButton + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Sparkle/Extra Themes/PaletteSparkleBlueDarkMode.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Sparkle/Extra Themes/PaletteSparkleBlueDarkMode.cs index 808332232..6650ec5bc 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Sparkle/Extra Themes/PaletteSparkleBlueDarkMode.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Builtin/Sparkle/Extra Themes/PaletteSparkleBlueDarkMode.cs @@ -3315,15 +3315,12 @@ public override Padding GetMetricPadding(PaletteState state, PaletteMetricPaddin /// Enum of the button to fetch. /// State of the button to fetch. /// Appropriate image for drawing; otherwise null. - public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) + public override Image? GetGalleryButtonImage(PaletteRibbonGalleryButton button, PaletteState state) => button switch { - return button switch - { - PaletteRibbonGalleryButton.Up => state == PaletteState.Disabled ? _disabledDropUp : _sparkleDropUpButton, - PaletteRibbonGalleryButton.DropDown => state == PaletteState.Disabled ? _disabledGalleryDrop : _sparkleGalleryDropButton, - _ => state == PaletteState.Disabled ? _disabledDropDown : _sparkleDropDownButton - }; - } + PaletteRibbonGalleryButton.Up => state == PaletteState.Disabled ? _disabledDropUp : _sparkleDropUpButton, + PaletteRibbonGalleryButton.DropDown => state == PaletteState.Disabled ? _disabledGalleryDrop : _sparkleGalleryDropButton, + _ => state == PaletteState.Disabled ? _disabledDropDown : _sparkleDropDownButton + }; #endregion #region ButtonSpec diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteCargo.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteCargo.cs index 267a52f55..bff082581 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteCargo.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteCargo.cs @@ -66,10 +66,7 @@ public KryptonPaletteCargo(NeedPaintHandler needPaint) /// /// esets the Color1 property to its default value. /// - public void ResetColor1() - { - Color1 = Color.Empty; - } + public void ResetColor1() => Color1 = Color.Empty; #endregion #region Color2 @@ -86,10 +83,7 @@ public void ResetColor1() /// /// esets the Color2 property to its default value. /// - public void ResetColor2() - { - Color2 = Color.Empty; - } + public void ResetColor2() => Color2 = Color.Empty; #endregion #region Color3 @@ -106,10 +100,7 @@ public void ResetColor2() /// /// esets the Color3 property to its default value. /// - public void ResetColor3() - { - Color3 = Color.Empty; - } + public void ResetColor3() => Color3 = Color.Empty; #endregion #region Color4 @@ -126,10 +117,7 @@ public void ResetColor3() /// /// esets the Color4 property to its default value. /// - public void ResetColor4() - { - Color4 = Color.Empty; - } + public void ResetColor4() => Color4 = Color.Empty; #endregion #region Color5 @@ -146,10 +134,7 @@ public void ResetColor4() /// /// esets the Color5 property to its default value. /// - public void ResetColor5() - { - Color5 = Color.Empty; - } + public void ResetColor5() => Color5 = Color.Empty; #endregion /* diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteHeaderGroupState.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteHeaderGroupState.cs index 1708843be..82d43c368 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteHeaderGroupState.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteHeaderGroupState.cs @@ -106,10 +106,7 @@ public Padding PrimaryHeaderPadding /// /// Reset the PrimaryHeaderPadding to the default value. /// - public void ResetPrimaryHeaderPadding() - { - PrimaryHeaderPadding = CommonHelper.InheritPadding; - } + public void ResetPrimaryHeaderPadding() => PrimaryHeaderPadding = CommonHelper.InheritPadding; #endregion #region SecondaryHeaderPadding @@ -138,10 +135,7 @@ public Padding SecondaryHeaderPadding /// /// Reset the SecondaryHeaderPadding to the default value. /// - public void ResetSecondaryHeaderPadding() - { - SecondaryHeaderPadding = CommonHelper.InheritPadding; - } + public void ResetSecondaryHeaderPadding() => SecondaryHeaderPadding = CommonHelper.InheritPadding; #endregion #region DockInactiveHeaderPadding @@ -170,10 +164,7 @@ public Padding DockInactiveHeaderPadding /// /// Reset the DockInactiveHeaderPadding to the default value. /// - public void ResetDockInactiveHeaderPadding() - { - DockInactiveHeaderPadding = CommonHelper.InheritPadding; - } + public void ResetDockInactiveHeaderPadding() => DockInactiveHeaderPadding = CommonHelper.InheritPadding; #endregion #region DockActiveHeaderPadding @@ -202,10 +193,7 @@ public Padding DockActiveHeaderPadding /// /// Reset the DockActiveHeaderPadding to the default value. /// - public void ResetDockActiveHeaderPadding() - { - DockActiveHeaderPadding = CommonHelper.InheritPadding; - } + public void ResetDockActiveHeaderPadding() => DockActiveHeaderPadding = CommonHelper.InheritPadding; #endregion #region OverlayHeaders @@ -234,10 +222,7 @@ public InheritBool OverlayHeaders /// /// Resets the OverlayHeaders property to its default value. /// - public void ResetOverlayHeaders() - { - OverlayHeaders = InheritBool.Inherit; - } + public void ResetOverlayHeaders() => OverlayHeaders = InheritBool.Inherit; #endregion #region IPaletteMetric diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesCheckBox.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesCheckBox.cs index 8ec2a9a3b..8c2874e27 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesCheckBox.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesCheckBox.cs @@ -113,11 +113,9 @@ public void PopulateFromBase() /// Update the redirector with new reference. /// /// Target redirector. - public void SetRedirector(PaletteRedirect? redirect) - { + public void SetRedirector(PaletteRedirect? redirect) => // Update our cached reference _redirect = redirect; - } #endregion #region Common @@ -146,10 +144,7 @@ public Image? Common /// /// Resets the Common property to its default value. /// - public void ResetCommon() - { - Common = null; - } + public void ResetCommon() => Common = null; #endregion #region UncheckedDisabled @@ -178,10 +173,7 @@ public Image? UncheckedDisabled /// /// Resets the UncheckedDisabled property to its default value. /// - public void ResetUncheckedDisabled() - { - UncheckedDisabled = null; - } + public void ResetUncheckedDisabled() => UncheckedDisabled = null; #endregion #region UncheckedNormal @@ -210,10 +202,7 @@ public Image? UncheckedNormal /// /// Resets the UncheckedNormal property to its default value. /// - public void ResetUncheckedNormal() - { - UncheckedNormal = null; - } + public void ResetUncheckedNormal() => UncheckedNormal = null; #endregion #region UncheckedTracking @@ -242,10 +231,7 @@ public Image? UncheckedTracking /// /// Resets the UncheckedTracking property to its default value. /// - public void ResetUncheckedTracking() - { - UncheckedTracking = null; - } + public void ResetUncheckedTracking() => UncheckedTracking = null; #endregion #region UncheckedPressed @@ -274,10 +260,7 @@ public Image? UncheckedPressed /// /// Resets the UncheckedPressed property to its default value. /// - public void ResetUncheckedPressed() - { - UncheckedPressed = null; - } + public void ResetUncheckedPressed() => UncheckedPressed = null; #endregion #region CheckedDisabled @@ -306,10 +289,7 @@ public Image? CheckedDisabled /// /// Resets the CheckedDisabled property to its default value. /// - public void ResetCheckedDisabled() - { - CheckedDisabled = null; - } + public void ResetCheckedDisabled() => CheckedDisabled = null; #endregion #region CheckedNormal @@ -338,10 +318,7 @@ public Image? CheckedNormal /// /// Resets the CheckedNormal property to its default value. /// - public void ResetCheckedNormal() - { - CheckedNormal = null; - } + public void ResetCheckedNormal() => CheckedNormal = null; #endregion #region CheckedTracking @@ -370,10 +347,7 @@ public Image? CheckedTracking /// /// Resets the CheckedTracking property to its default value. /// - public void ResetCheckedTracking() - { - CheckedTracking = null; - } + public void ResetCheckedTracking() => CheckedTracking = null; #endregion #region CheckedPressed @@ -402,10 +376,7 @@ public Image? CheckedPressed /// /// Resets the CheckedPressed property to its default value. /// - public void ResetCheckedPressed() - { - CheckedPressed = null; - } + public void ResetCheckedPressed() => CheckedPressed = null; #endregion #region IndeterminateDisabled @@ -434,10 +405,7 @@ public Image? IndeterminateDisabled /// /// Resets the IndeterminateDisabled property to its default value. /// - public void ResetIndeterminateDisabled() - { - IndeterminateDisabled = null; - } + public void ResetIndeterminateDisabled() => IndeterminateDisabled = null; #endregion #region IndeterminateNormal @@ -466,10 +434,7 @@ public Image? IndeterminateNormal /// /// Resets the IndeterminateNormal property to its default value. /// - public void ResetIndeterminateNormal() - { - IndeterminateNormal = null; - } + public void ResetIndeterminateNormal() => IndeterminateNormal = null; #endregion #region IndeterminateTracking @@ -498,10 +463,7 @@ public Image? IndeterminateTracking /// /// Resets the IndeterminateTracking property to its default value. /// - public void ResetIndeterminateTracking() - { - IndeterminateTracking = null; - } + public void ResetIndeterminateTracking() => IndeterminateTracking = null; #endregion #region IndeterminatePressed @@ -530,10 +492,7 @@ public Image? IndeterminatePressed /// /// Resets the IndeterminatePressed property to its default value. /// - public void ResetIndeterminatePressed() - { - IndeterminatePressed = null; - } + public void ResetIndeterminatePressed() => IndeterminatePressed = null; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesContextMenu.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesContextMenu.cs index b93d7e75a..ee7488698 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesContextMenu.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesContextMenu.cs @@ -74,11 +74,9 @@ public void PopulateFromBase() /// Update the redirector with new reference. /// /// Target redirector. - public void SetRedirector(PaletteRedirect? redirect) - { + public void SetRedirector(PaletteRedirect? redirect) => // Update our cached reference _redirect = redirect; - } #endregion #region Checked @@ -107,10 +105,7 @@ public Image? Checked /// /// Resets the Checked property to its default value. /// - public void ResetChecked() - { - Checked = null; - } + public void ResetChecked() => Checked = null; #endregion #region Indeterminate @@ -139,10 +134,7 @@ public Image? Indeterminate /// /// Resets the Indeterminate property to its default value. /// - public void ResetIndeterminate() - { - Indeterminate = null; - } + public void ResetIndeterminate() => Indeterminate = null; #endregion #region SubMenu @@ -171,10 +163,7 @@ public Image? SubMenu /// /// Resets the SubMenu property to its default value. /// - public void ResetSubMenu() - { - SubMenu = null; - } + public void ResetSubMenu() => SubMenu = null; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesDropDownButton.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesDropDownButton.cs index fbc3f2bf2..ca7785e42 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesDropDownButton.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesDropDownButton.cs @@ -81,11 +81,9 @@ public void PopulateFromBase() /// Update the redirector with new reference. /// /// Target redirector. - public void SetRedirector(PaletteRedirect? redirect) - { + public void SetRedirector(PaletteRedirect? redirect) => // Update our cached reference _redirect = redirect; - } #endregion #region Common @@ -114,10 +112,7 @@ public Image? Common /// /// Resets the Common property to its default value. /// - public void ResetCommon() - { - Common = null; - } + public void ResetCommon() => Common = null; #endregion #region Disabled @@ -146,10 +141,7 @@ public Image? Disabled /// /// Resets the Disabled property to its default value. /// - public void ResetDisabled() - { - Disabled = null; - } + public void ResetDisabled() => Disabled = null; #endregion #region Normal @@ -178,10 +170,7 @@ public Image? Normal /// /// Resets the Normal property to its default value. /// - public void ResetNormal() - { - Normal = null; - } + public void ResetNormal() => Normal = null; #endregion #region Tracking @@ -210,10 +199,7 @@ public Image? Tracking /// /// Resets the Tracking property to its default value. /// - public void ResetTracking() - { - Tracking = null; - } + public void ResetTracking() => Tracking = null; #endregion #region Pressed @@ -242,10 +228,7 @@ public Image? Pressed /// /// Resets the Pressed property to its default value. /// - public void ResetPressed() - { - Pressed = null; - } + public void ResetPressed() => Pressed = null; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesGalleryButton.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesGalleryButton.cs index 4818df324..be067b45f 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesGalleryButton.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesGalleryButton.cs @@ -82,11 +82,9 @@ public void PopulateFromBase() /// Update the redirector with new reference. /// /// Target redirector. - public void SetRedirector(PaletteRedirect? redirect) - { + public void SetRedirector(PaletteRedirect? redirect) => // Update our cached reference _redirect = redirect; - } #endregion #region Common @@ -115,10 +113,7 @@ public Image? Common /// /// Resets the Common property to its default value. /// - public void ResetCommon() - { - Common = null; - } + public void ResetCommon() => Common = null; #endregion #region Disabled @@ -147,10 +142,7 @@ public Image? Disabled /// /// Resets the Disabled property to its default value. /// - public void ResetDisabled() - { - Disabled = null; - } + public void ResetDisabled() => Disabled = null; #endregion #region Normal @@ -179,10 +171,7 @@ public Image? Normal /// /// Resets the Normal property to its default value. /// - public void ResetNormal() - { - Normal = null; - } + public void ResetNormal() => Normal = null; #endregion #region Tracking @@ -211,10 +200,7 @@ public Image? Tracking /// /// Resets the Tracking property to its default value. /// - public void ResetTracking() - { - Tracking = null; - } + public void ResetTracking() => Tracking = null; #endregion #region Pressed @@ -243,10 +229,7 @@ public Image? Pressed /// /// Resets the Pressed property to its default value. /// - public void ResetPressed() - { - Pressed = null; - } + public void ResetPressed() => Pressed = null; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesRadioButton.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesRadioButton.cs index b5e4130e8..68f172fd2 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesRadioButton.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesRadioButton.cs @@ -97,11 +97,9 @@ public void PopulateFromBase() /// Update the redirector with new reference. /// /// Target redirector. - public void SetRedirector(PaletteRedirect? redirect) - { + public void SetRedirector(PaletteRedirect? redirect) => // Update our cached reference _redirect = redirect; - } #endregion #region Common @@ -130,10 +128,7 @@ public Image? Common /// /// Resets the Common property to its default value. /// - public void ResetCommon() - { - Common = null; - } + public void ResetCommon() => Common = null; #endregion #region UncheckedDisabled @@ -162,10 +157,7 @@ public Image? UncheckedDisabled /// /// Resets the UncheckedDisabled property to its default value. /// - public void ResetUncheckedDisabled() - { - UncheckedDisabled = null; - } + public void ResetUncheckedDisabled() => UncheckedDisabled = null; #endregion #region UncheckedNormal @@ -194,10 +186,7 @@ public Image? UncheckedNormal /// /// Resets the UncheckedNormal property to its default value. /// - public void ResetUncheckedNormal() - { - UncheckedNormal = null; - } + public void ResetUncheckedNormal() => UncheckedNormal = null; #endregion #region UncheckedTracking @@ -226,10 +215,7 @@ public Image? UncheckedTracking /// /// Resets the UncheckedTracking property to its default value. /// - public void ResetUncheckedTracking() - { - UncheckedTracking = null; - } + public void ResetUncheckedTracking() => UncheckedTracking = null; #endregion #region UncheckedPressed @@ -258,10 +244,7 @@ public Image? UncheckedPressed /// /// Resets the UncheckedPressed property to its default value. /// - public void ResetUncheckedPressed() - { - UncheckedPressed = null; - } + public void ResetUncheckedPressed() => UncheckedPressed = null; #endregion #region CheckedDisabled @@ -290,10 +273,7 @@ public Image? CheckedDisabled /// /// Resets the CheckedDisabled property to its default value. /// - public void ResetCheckedDisabled() - { - CheckedDisabled = null; - } + public void ResetCheckedDisabled() => CheckedDisabled = null; #endregion #region CheckedNormal @@ -322,10 +302,7 @@ public Image? CheckedNormal /// /// Resets the CheckedNormal property to its default value. /// - public void ResetCheckedNormal() - { - CheckedNormal = null; - } + public void ResetCheckedNormal() => CheckedNormal = null; #endregion #region CheckedTracking @@ -354,10 +331,7 @@ public Image? CheckedTracking /// /// Resets the CheckedTracking property to its default value. /// - public void ResetCheckedTracking() - { - CheckedTracking = null; - } + public void ResetCheckedTracking() => CheckedTracking = null; #endregion #region CheckedPressed @@ -386,10 +360,7 @@ public Image? CheckedPressed /// /// Resets the CheckedPressed property to its default value. /// - public void ResetCheckedPressed() - { - CheckedPressed = null; - } + public void ResetCheckedPressed() => CheckedPressed = null; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesTreeView.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesTreeView.cs index ab21cb8dc..5a27ebb19 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesTreeView.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteImagesTreeView.cs @@ -70,11 +70,9 @@ public void PopulateFromBase() /// Update the redirector with new reference. /// /// Target redirector. - public void SetRedirector(PaletteRedirect? redirect) - { + public void SetRedirector(PaletteRedirect? redirect) => // Update our cached reference _redirect = redirect; - } #endregion #region Plus @@ -103,10 +101,7 @@ public Image? Plus /// /// Resets the Plus property to its default value. /// - public void ResetPlus() - { - Plus = null; - } + public void ResetPlus() => Plus = null; #endregion #region Plus @@ -135,10 +130,7 @@ public Image? Minus /// /// Resets the Minus property to its default value. /// - public void ResetMinus() - { - Minus = null; - } + public void ResetMinus() => Minus = null; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteNavigatorStateBar.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteNavigatorStateBar.cs index 19dbbae6d..e0534f5ea 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteNavigatorStateBar.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteNavigatorStateBar.cs @@ -121,10 +121,7 @@ public Padding BarPaddingTabs /// /// Reset the BarPaddingTabs to the default value. /// - public void ResetBarPaddingTabs() - { - BarPaddingTabs = CommonHelper.InheritPadding; - } + public void ResetBarPaddingTabs() => BarPaddingTabs = CommonHelper.InheritPadding; #endregion #region BarPaddingInside @@ -153,10 +150,7 @@ public Padding BarPaddingInside /// /// Reset the BarPaddingInside to the default value. /// - public void ResetBarPaddingInside() - { - BarPaddingInside = CommonHelper.InheritPadding; - } + public void ResetBarPaddingInside() => BarPaddingInside = CommonHelper.InheritPadding; #endregion #region BarPaddingOutside @@ -185,10 +179,7 @@ public Padding BarPaddingOutside /// /// Reset the BarPaddingOutside to the default value. /// - public void ResetBarPaddingOutside() - { - BarPaddingOutside = CommonHelper.InheritPadding; - } + public void ResetBarPaddingOutside() => BarPaddingOutside = CommonHelper.InheritPadding; #endregion #region BarPaddingOnly @@ -217,10 +208,7 @@ public Padding BarPaddingOnly /// /// Reset the BarPaddingOnly to the default value. /// - public void ResetBarPaddingOnly() - { - BarPaddingOnly = CommonHelper.InheritPadding; - } + public void ResetBarPaddingOnly() => BarPaddingOnly = CommonHelper.InheritPadding; #endregion #region ButtonPadding @@ -249,10 +237,7 @@ public Padding ButtonPadding /// /// Reset the ButtonPadding to the default value. /// - public void ResetButtonPadding() - { - ButtonPadding = CommonHelper.InheritPadding; - } + public void ResetButtonPadding() => ButtonPadding = CommonHelper.InheritPadding; #endregion #region ButtonEdgeOutside @@ -281,10 +266,7 @@ public int ButtonEdgeOutside /// /// Reset the ButtonEdgeOutside to the default value. /// - public void ResetButtonEdgeOutside() - { - ButtonEdgeOutside = -1; - } + public void ResetButtonEdgeOutside() => ButtonEdgeOutside = -1; #endregion #region ButtonEdgeInside @@ -313,10 +295,7 @@ public int ButtonEdgeInside /// /// Reset the ButtonEdgeInside to the default value. /// - public void ResetButtonEdgeInside() - { - ButtonEdgeInside = -1; - } + public void ResetButtonEdgeInside() => ButtonEdgeInside = -1; #endregion #region CheckButtonGap @@ -345,10 +324,7 @@ public int CheckButtonGap /// /// Reset the CheckButtonGap to the default value. /// - public void ResetCheckButtonGap() - { - CheckButtonGap = -1; - } + public void ResetCheckButtonGap() => CheckButtonGap = -1; #endregion #region RibbonTabGap @@ -377,10 +353,7 @@ public int RibbonTabGap /// /// Reset the RibbonTabGap to the default value. /// - public void ResetRibbonTabGap() - { - RibbonTabGap = -1; - } + public void ResetRibbonTabGap() => RibbonTabGap = -1; #endregion #region IPaletteMetric diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMS.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMS.cs index 2dc6d6828..6fc54d27c 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMS.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMS.cs @@ -211,10 +211,7 @@ public InheritBool UseRoundedEdges /// /// esets the UseRoundedEdges property to its default value. /// - public void ResetUseRoundedEdges() - { - UseRoundedEdges = InheritBool.Inherit; - } + public void ResetUseRoundedEdges() => UseRoundedEdges = InheritBool.Inherit; #endregion #region Internal diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSButton.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSButton.cs index baa8f1301..4b0528c9c 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSButton.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSButton.cs @@ -115,10 +115,7 @@ public Color ButtonCheckedGradientBegin /// /// Resets the ButtonCheckedGradientBegin property to its default value. /// - public void ResetButtonCheckedGradientBegin() - { - ButtonCheckedGradientBegin = Color.Empty; - } + public void ResetButtonCheckedGradientBegin() => ButtonCheckedGradientBegin = Color.Empty; #endregion #region ButtonCheckedGradientEnd @@ -143,10 +140,7 @@ public Color ButtonCheckedGradientEnd /// /// Resets the ButtonCheckedGradientEnd property to its default value. /// - public void ResetButtonCheckedGradientEnd() - { - ButtonCheckedGradientEnd = Color.Empty; - } + public void ResetButtonCheckedGradientEnd() => ButtonCheckedGradientEnd = Color.Empty; #endregion #region ButtonCheckedGradientMiddle @@ -171,10 +165,7 @@ public Color ButtonCheckedGradientMiddle /// /// Resets the ButtonCheckedGradientMiddle property to its default value. /// - public void ResetButtonCheckedGradientMiddle() - { - ButtonCheckedGradientMiddle = Color.Empty; - } + public void ResetButtonCheckedGradientMiddle() => ButtonCheckedGradientMiddle = Color.Empty; #endregion #region ButtonCheckedHighlight @@ -199,10 +190,7 @@ public Color ButtonCheckedHighlight /// /// Resets the ButtonCheckedHighlight property to its default value. /// - public void ResetButtonCheckedHighlight() - { - ButtonCheckedHighlight = Color.Empty; - } + public void ResetButtonCheckedHighlight() => ButtonCheckedHighlight = Color.Empty; #endregion #region ButtonCheckedHighlightBorder @@ -227,10 +215,7 @@ public Color ButtonCheckedHighlightBorder /// /// Resets the ButtonCheckedHighlightBorder property to its default value. /// - public void ResetButtonCheckedHighlightBorder() - { - ButtonCheckedHighlightBorder = Color.Empty; - } + public void ResetButtonCheckedHighlightBorder() => ButtonCheckedHighlightBorder = Color.Empty; #endregion #region ButtonPressedBorder @@ -255,10 +240,7 @@ public Color ButtonPressedBorder /// /// Resets the ButtonPressedBorder property to its default value. /// - public void ResetButtonPressedBorder() - { - ButtonPressedBorder = Color.Empty; - } + public void ResetButtonPressedBorder() => ButtonPressedBorder = Color.Empty; #endregion #region ButtonPressedGradientBegin @@ -283,10 +265,7 @@ public Color ButtonPressedGradientBegin /// /// Resets the ButtonPressedGradientBegin property to its default value. /// - public void ResetButtonPressedGradientBegin() - { - ButtonPressedGradientBegin = Color.Empty; - } + public void ResetButtonPressedGradientBegin() => ButtonPressedGradientBegin = Color.Empty; #endregion #region ButtonPressedGradientEnd @@ -311,10 +290,7 @@ public Color ButtonPressedGradientEnd /// /// Resets the ButtonPressedGradientEnd property to its default value. /// - public void ResetButtonPressedGradientEnd() - { - ButtonPressedGradientEnd = Color.Empty; - } + public void ResetButtonPressedGradientEnd() => ButtonPressedGradientEnd = Color.Empty; #endregion #region ButtonPressedGradientMiddle @@ -339,10 +315,7 @@ public Color ButtonPressedGradientMiddle /// /// Resets the ButtonPressedGradientMiddle property to its default value. /// - public void ResetButtonPressedGradientMiddle() - { - ButtonPressedGradientMiddle = Color.Empty; - } + public void ResetButtonPressedGradientMiddle() => ButtonPressedGradientMiddle = Color.Empty; #endregion #region ButtonPressedHighlight @@ -367,10 +340,7 @@ public Color ButtonPressedHighlight /// /// Resets the ButtonPressedHighlight property to its default value. /// - public void ResetButtonPressedHighlight() - { - ButtonPressedHighlight = Color.Empty; - } + public void ResetButtonPressedHighlight() => ButtonPressedHighlight = Color.Empty; #endregion #region ButtonPressedHighlightBorder @@ -395,10 +365,7 @@ public Color ButtonPressedHighlightBorder /// /// Resets the ButtonPressedHighlightBorder property to its default value. /// - public void ResetButtonPressedHighlightBorder() - { - ButtonPressedHighlightBorder = Color.Empty; - } + public void ResetButtonPressedHighlightBorder() => ButtonPressedHighlightBorder = Color.Empty; #endregion #region ButtonSelectedBorder @@ -423,10 +390,7 @@ public Color ButtonSelectedBorder /// /// Resets the ButtonSelectedBorder property to its default value. /// - public void ResetButtonSelectedBorder() - { - ButtonSelectedBorder = Color.Empty; - } + public void ResetButtonSelectedBorder() => ButtonSelectedBorder = Color.Empty; #endregion #region ButtonSelectedGradientBegin @@ -451,10 +415,7 @@ public Color ButtonSelectedGradientBegin /// /// Resets the ButtonSelectedGradientBegin property to its default value. /// - public void ResetButtonSelectedGradientBegin() - { - ButtonSelectedGradientBegin = Color.Empty; - } + public void ResetButtonSelectedGradientBegin() => ButtonSelectedGradientBegin = Color.Empty; #endregion #region ButtonSelectedGradientEnd @@ -479,10 +440,7 @@ public Color ButtonSelectedGradientEnd /// /// Resets the ButtonSelectedGradientEnd property to its default value. /// - public void ResetButtonSelectedGradientEnd() - { - ButtonSelectedGradientEnd = Color.Empty; - } + public void ResetButtonSelectedGradientEnd() => ButtonSelectedGradientEnd = Color.Empty; #endregion #region ButtonSelectedGradientMiddle @@ -507,10 +465,7 @@ public Color ButtonSelectedGradientMiddle /// /// Resets the ButtonSelectedGradientMiddle property to its default value. /// - public void ResetButtonSelectedGradientMiddle() - { - ButtonSelectedGradientMiddle = Color.Empty; - } + public void ResetButtonSelectedGradientMiddle() => ButtonSelectedGradientMiddle = Color.Empty; #endregion #region ButtonSelectedHighlight @@ -535,10 +490,7 @@ public Color ButtonSelectedHighlight /// /// Resets the ButtonSelectedHighlight property to its default value. /// - public void ResetButtonSelectedHighlight() - { - ButtonSelectedHighlight = Color.Empty; - } + public void ResetButtonSelectedHighlight() => ButtonSelectedHighlight = Color.Empty; #endregion #region ButtonSelectedHighlightBorder @@ -563,10 +515,7 @@ public Color ButtonSelectedHighlightBorder /// /// Resets the ButtonSelectedHighlightBorder property to its default value. /// - public void ResetButtonSelectedHighlightBorder() - { - ButtonSelectedHighlightBorder = Color.Empty; - } + public void ResetButtonSelectedHighlightBorder() => ButtonSelectedHighlightBorder = Color.Empty; #endregion #region CheckBackground @@ -591,10 +540,7 @@ public Color CheckBackground /// /// esets the CheckBackground property to its default value. /// - public void ResetCheckBackground() - { - CheckBackground = Color.Empty; - } + public void ResetCheckBackground() => CheckBackground = Color.Empty; #endregion #region CheckPressedBackground @@ -619,10 +565,7 @@ public Color CheckPressedBackground /// /// esets the CheckPressedBackground property to its default value. /// - public void ResetCheckPressedBackground() - { - CheckPressedBackground = Color.Empty; - } + public void ResetCheckPressedBackground() => CheckPressedBackground = Color.Empty; #endregion #region CheckSelectedBackground @@ -647,10 +590,7 @@ public Color CheckSelectedBackground /// /// esets the CheckSelectedBackground property to its default value. /// - public void ResetCheckSelectedBackground() - { - CheckSelectedBackground = Color.Empty; - } + public void ResetCheckSelectedBackground() => CheckSelectedBackground = Color.Empty; #endregion #region OverflowButtonGradientBegin @@ -675,10 +615,7 @@ public Color OverflowButtonGradientBegin /// /// esets the OverflowButtonGradientBegin property to its default value. /// - public void ResetOverflowButtonGradientBegin() - { - OverflowButtonGradientBegin = Color.Empty; - } + public void ResetOverflowButtonGradientBegin() => OverflowButtonGradientBegin = Color.Empty; #endregion #region OverflowButtonGradientEnd @@ -703,10 +640,7 @@ public Color OverflowButtonGradientEnd /// /// esets the OverflowButtonGradientEnd property to its default value. /// - public void ResetOverflowButtonGradientEnd() - { - OverflowButtonGradientEnd = Color.Empty; - } + public void ResetOverflowButtonGradientEnd() => OverflowButtonGradientEnd = Color.Empty; #endregion #region OverflowButtonGradientMiddle @@ -731,10 +665,7 @@ public Color OverflowButtonGradientMiddle /// /// esets the OverflowButtonGradientMiddle property to its default value. /// - public void ResetOverflowButtonGradientMiddle() - { - OverflowButtonGradientMiddle = Color.Empty; - } + public void ResetOverflowButtonGradientMiddle() => OverflowButtonGradientMiddle = Color.Empty; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSGrip.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSGrip.cs index 258f5929e..3c2e6552a 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSGrip.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSGrip.cs @@ -73,10 +73,7 @@ public Color GripDark /// /// esets the GripDark property to its default value. /// - public void ResetGripDark() - { - GripDark = Color.Empty; - } + public void ResetGripDark() => GripDark = Color.Empty; #endregion #region GripLight @@ -101,10 +98,7 @@ public Color GripLight /// /// esets the GripLight property to its default value. /// - public void ResetGripLight() - { - GripLight = Color.Empty; - } + public void ResetGripLight() => GripLight = Color.Empty; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSMenu.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSMenu.cs index 5bc008e22..69d2c9b61 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSMenu.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSMenu.cs @@ -99,10 +99,7 @@ public Color ImageMarginGradientBegin /// /// esets the ImageMarginGradientBegin property to its default value. /// - public void ResetImageMarginGradientBegin() - { - ImageMarginGradientBegin = Color.Empty; - } + public void ResetImageMarginGradientBegin() => ImageMarginGradientBegin = Color.Empty; #endregion #region ImageMarginGradientEnd @@ -127,10 +124,7 @@ public Color ImageMarginGradientEnd /// /// esets the ImageMarginGradientEnd property to its default value. /// - public void ResetImageMarginGradientEnd() - { - ImageMarginGradientEnd = Color.Empty; - } + public void ResetImageMarginGradientEnd() => ImageMarginGradientEnd = Color.Empty; #endregion #region ImageMarginGradientMiddle @@ -155,10 +149,7 @@ public Color ImageMarginGradientMiddle /// /// esets the ImageMarginGradientMiddle property to its default value. /// - public void ResetImageMarginGradientMiddle() - { - ImageMarginGradientMiddle = Color.Empty; - } + public void ResetImageMarginGradientMiddle() => ImageMarginGradientMiddle = Color.Empty; #endregion #region ImageMarginRevealedGradientBegin @@ -183,10 +174,7 @@ public Color ImageMarginRevealedGradientBegin /// /// esets the ImageMarginRevealedGradientBegin property to its default value. /// - public void ResetImageMarginRevealedGradientBegin() - { - ImageMarginRevealedGradientBegin = Color.Empty; - } + public void ResetImageMarginRevealedGradientBegin() => ImageMarginRevealedGradientBegin = Color.Empty; #endregion #region ImageMarginRevealedGradientEnd @@ -211,10 +199,7 @@ public Color ImageMarginRevealedGradientEnd /// /// esets the ImageMarginRevealedGradientEnd property to its default value. /// - public void ResetImageMarginRevealedGradientEnd() - { - ImageMarginRevealedGradientEnd = Color.Empty; - } + public void ResetImageMarginRevealedGradientEnd() => ImageMarginRevealedGradientEnd = Color.Empty; #endregion #region ImageMarginRevealedGradientMiddle @@ -239,10 +224,7 @@ public Color ImageMarginRevealedGradientMiddle /// /// esets the ImageMarginRevealedGradientMiddle property to its default value. /// - public void ResetImageMarginRevealedGradientMiddle() - { - ImageMarginRevealedGradientMiddle = Color.Empty; - } + public void ResetImageMarginRevealedGradientMiddle() => ImageMarginRevealedGradientMiddle = Color.Empty; #endregion #region MenuBorder @@ -267,10 +249,7 @@ public Color MenuBorder /// /// esets the MenuBorder property to its default value. /// - public void ResetMenuBorder() - { - MenuBorder = Color.Empty; - } + public void ResetMenuBorder() => MenuBorder = Color.Empty; #endregion #region MenuItemText @@ -295,10 +274,7 @@ public Color MenuItemText /// /// esets the MenuItemText property to its default value. /// - public void ResetMenuItemText() - { - MenuItemText = Color.Empty; - } + public void ResetMenuItemText() => MenuItemText = Color.Empty; #endregion #region MenuItemBorder @@ -323,10 +299,7 @@ public Color MenuItemBorder /// /// esets the MenuItemBorder property to its default value. /// - public void ResetMenuItemBorder() - { - MenuItemBorder = Color.Empty; - } + public void ResetMenuItemBorder() => MenuItemBorder = Color.Empty; #endregion #region MenuItemPressedGradientBegin @@ -351,10 +324,7 @@ public Color MenuItemPressedGradientBegin /// /// esets the MenuItemPressedGradientBegin property to its default value. /// - public void ResetMenuItemPressedGradientBegin() - { - MenuItemPressedGradientBegin = Color.Empty; - } + public void ResetMenuItemPressedGradientBegin() => MenuItemPressedGradientBegin = Color.Empty; #endregion #region MenuItemPressedGradientEnd @@ -379,10 +349,7 @@ public Color MenuItemPressedGradientEnd /// /// esets the MenuItemPressedGradientEnd property to its default value. /// - public void ResetMenuItemPressedGradientEnd() - { - MenuItemPressedGradientEnd = Color.Empty; - } + public void ResetMenuItemPressedGradientEnd() => MenuItemPressedGradientEnd = Color.Empty; #endregion #region MenuItemPressedGradientMiddle @@ -407,10 +374,7 @@ public Color MenuItemPressedGradientMiddle /// /// esets the MenuItemPressedGradientMiddle property to its default value. /// - public void ResetMenuItemPressedGradientMiddle() - { - MenuItemPressedGradientMiddle = Color.Empty; - } + public void ResetMenuItemPressedGradientMiddle() => MenuItemPressedGradientMiddle = Color.Empty; #endregion #region MenuItemSelected @@ -435,10 +399,7 @@ public Color MenuItemSelected /// /// esets the MenuItemSelected property to its default value. /// - public void ResetMenuItemSelected() - { - MenuItemSelected = Color.Empty; - } + public void ResetMenuItemSelected() => MenuItemSelected = Color.Empty; #endregion #region MenuItemSelectedGradientBegin @@ -463,10 +424,7 @@ public Color MenuItemSelectedGradientBegin /// /// esets the MenuItemSelectedGradientBegin property to its default value. /// - public void ResetMenuItemSelectedGradientBegin() - { - MenuItemSelectedGradientBegin = Color.Empty; - } + public void ResetMenuItemSelectedGradientBegin() => MenuItemSelectedGradientBegin = Color.Empty; #endregion #region MenuItemSelectedGradientEnd @@ -491,10 +449,7 @@ public Color MenuItemSelectedGradientEnd /// /// esets the MenuItemSelectedGradientEnd property to its default value. /// - public void ResetMenuItemSelectedGradientEnd() - { - MenuItemSelectedGradientEnd = Color.Empty; - } + public void ResetMenuItemSelectedGradientEnd() => MenuItemSelectedGradientEnd = Color.Empty; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSMenuStrip.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSMenuStrip.cs index 1d1a0e39c..5da7a95ac 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSMenuStrip.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSMenuStrip.cs @@ -77,10 +77,7 @@ public Color MenuStripText /// /// esets the MenuStripText property to its default value. /// - public void ResetMenuStripText() - { - MenuStripText = Color.Empty; - } + public void ResetMenuStripText() => MenuStripText = Color.Empty; #endregion #region MenuStripFont @@ -105,10 +102,7 @@ public Font? MenuStripFont /// /// esets the MenuStripFont property to its default value. /// - public void ResetMenuStripFont() - { - MenuStripFont = null; - } + public void ResetMenuStripFont() => MenuStripFont = null; #endregion #region MenuStripGradientBegin @@ -133,10 +127,7 @@ public Color MenuStripGradientBegin /// /// esets the MenuStripGradientBegin property to its default value. /// - public void ResetMenuStripGradientBegin() - { - MenuStripGradientBegin = Color.Empty; - } + public void ResetMenuStripGradientBegin() => MenuStripGradientBegin = Color.Empty; #endregion #region MenuStripGradientEnd @@ -161,10 +152,7 @@ public Color MenuStripGradientEnd /// /// esets the MenuStripGradientEnd property to its default value. /// - public void ResetMenuStripGradientEnd() - { - MenuStripGradientEnd = Color.Empty; - } + public void ResetMenuStripGradientEnd() => MenuStripGradientEnd = Color.Empty; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSRafting.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSRafting.cs index 87ef389e4..72ff164b4 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSRafting.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSRafting.cs @@ -73,10 +73,7 @@ public Color RaftingContainerGradientBegin /// /// esets the RaftingContainerGradientBegin property to its default value. /// - public void ResetRaftingContainerGradientBegin() - { - RaftingContainerGradientBegin = Color.Empty; - } + public void ResetRaftingContainerGradientBegin() => RaftingContainerGradientBegin = Color.Empty; #endregion #region RaftingContainerGradientEnd @@ -101,10 +98,7 @@ public Color RaftingContainerGradientEnd /// /// esets the RaftingContainerGradientEnd property to its default value. /// - public void ResetRaftingContainerGradientEnd() - { - RaftingContainerGradientEnd = Color.Empty; - } + public void ResetRaftingContainerGradientEnd() => RaftingContainerGradientEnd = Color.Empty; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSSeparator.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSSeparator.cs index d7def645b..269034092 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSSeparator.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSSeparator.cs @@ -73,10 +73,7 @@ public Color SeparatorDark /// /// Resets the SeparatorDark property to its default value. /// - public void ResetSeparatorDark() - { - SeparatorDark = Color.Empty; - } + public void ResetSeparatorDark() => SeparatorDark = Color.Empty; #endregion #region SeparatorLight @@ -101,10 +98,7 @@ public Color SeparatorLight /// /// Resets the SeparatorLight property to its default value. /// - public void ResetSeparatorLight() - { - SeparatorLight = Color.Empty; - } + public void ResetSeparatorLight() => SeparatorLight = Color.Empty; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSStatusStrip.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSStatusStrip.cs index 01f0946b7..c4f17b821 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSStatusStrip.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSStatusStrip.cs @@ -77,10 +77,7 @@ public Color StatusStripText /// /// Resets the StatusStripText property to its default value. /// - public void ResetStatusStripText() - { - StatusStripText = Color.Empty; - } + public void ResetStatusStripText() => StatusStripText = Color.Empty; #endregion #region StatusStripFont @@ -105,10 +102,7 @@ public Font? StatusStripFont /// /// Resets the StatusStripFont property to its default value. /// - public void ResetStatusStripFont() - { - StatusStripText = Color.Empty; - } + public void ResetStatusStripFont() => StatusStripText = Color.Empty; #endregion #region StatusStripGradientBegin @@ -133,10 +127,7 @@ public Color StatusStripGradientBegin /// /// Resets the StatusStripGradientBegin property to its default value. /// - public void ResetStatusStripGradientBegin() - { - StatusStripGradientBegin = Color.Empty; - } + public void ResetStatusStripGradientBegin() => StatusStripGradientBegin = Color.Empty; #endregion #region StatusStripGradientEnd @@ -161,10 +152,7 @@ public Color StatusStripGradientEnd /// /// Resets the StatusStripGradientEnd property to its default value. /// - public void ResetStatusStripGradientEnd() - { - StatusStripGradientEnd = Color.Empty; - } + public void ResetStatusStripGradientEnd() => StatusStripGradientEnd = Color.Empty; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSToolStrip.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSToolStrip.cs index b4b95b45f..7b3d1cddf 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSToolStrip.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Component/KryptonPaletteTMSToolStrip.cs @@ -91,10 +91,7 @@ public Color ToolStripText /// /// esets the ToolStripText property to its default value. /// - public void ResetToolStripText() - { - ToolStripText = Color.Empty; - } + public void ResetToolStripText() => ToolStripText = Color.Empty; #endregion #region ToolStripFont @@ -119,10 +116,7 @@ public Font? ToolStripFont /// /// esets the ToolStripFont property to its default value. /// - public void ResetToolStripFont() - { - ToolStripFont = null; - } + public void ResetToolStripFont() => ToolStripFont = null; #endregion #region ToolStripBorder @@ -147,10 +141,7 @@ public Color ToolStripBorder /// /// esets the ToolStripBorder property to its default value. /// - public void ResetToolStripBorder() - { - ToolStripBorder = Color.Empty; - } + public void ResetToolStripBorder() => ToolStripBorder = Color.Empty; #endregion #region ToolStripContentPanelGradientBegin @@ -175,10 +166,7 @@ public Color ToolStripContentPanelGradientBegin /// /// esets the ToolStripContentPanelGradientBegin property to its default value. /// - public void ResetToolStripContentPanelGradientBegin() - { - ToolStripContentPanelGradientBegin = Color.Empty; - } + public void ResetToolStripContentPanelGradientBegin() => ToolStripContentPanelGradientBegin = Color.Empty; #endregion #region ToolStripContentPanelGradientEnd @@ -203,10 +191,7 @@ public Color ToolStripContentPanelGradientEnd /// /// esets the ToolStripContentPanelGradientEnd property to its default value. /// - public void ResetToolStripContentPanelGradientEnd() - { - ToolStripContentPanelGradientEnd = Color.Empty; - } + public void ResetToolStripContentPanelGradientEnd() => ToolStripContentPanelGradientEnd = Color.Empty; #endregion #region ToolStripDropDownBackground @@ -231,10 +216,7 @@ public Color ToolStripDropDownBackground /// /// esets the ToolStripDropDownBackground property to its default value. /// - public void ResetToolStripDropDownBackground() - { - ToolStripDropDownBackground = Color.Empty; - } + public void ResetToolStripDropDownBackground() => ToolStripDropDownBackground = Color.Empty; #endregion #region ToolStripGradientBegin @@ -259,10 +241,7 @@ public Color ToolStripGradientBegin /// /// esets the ToolStripGradientBegin property to its default value. /// - public void ResetToolStripGradientBegin() - { - ToolStripGradientBegin = Color.Empty; - } + public void ResetToolStripGradientBegin() => ToolStripGradientBegin = Color.Empty; #endregion #region ToolStripGradientEnd @@ -287,10 +266,7 @@ public Color ToolStripGradientEnd /// /// esets the ToolStripGradientEnd property to its default value. /// - public void ResetToolStripGradientEnd() - { - ToolStripGradientEnd = Color.Empty; - } + public void ResetToolStripGradientEnd() => ToolStripGradientEnd = Color.Empty; #endregion #region ToolStripGradientMiddle @@ -315,10 +291,7 @@ public Color ToolStripGradientMiddle /// /// esets the ToolStripGradientMiddle property to its default value. /// - public void ResetToolStripGradientMiddle() - { - ToolStripGradientMiddle = Color.Empty; - } + public void ResetToolStripGradientMiddle() => ToolStripGradientMiddle = Color.Empty; #endregion #region ToolStripPanelGradientBegin @@ -343,10 +316,7 @@ public Color ToolStripPanelGradientBegin /// /// esets the ToolStripPanelGradientBegin property to its default value. /// - public void ResetToolStripPanelGradientBegin() - { - ToolStripPanelGradientBegin = Color.Empty; - } + public void ResetToolStripPanelGradientBegin() => ToolStripPanelGradientBegin = Color.Empty; #endregion #region ToolStripPanelGradientEnd @@ -371,10 +341,7 @@ public Color ToolStripPanelGradientEnd /// /// esets the ToolStripPanelGradientEnd property to its default value. /// - public void ResetToolStripPanelGradientEnd() - { - ToolStripPanelGradientEnd = Color.Empty; - } + public void ResetToolStripPanelGradientEnd() => ToolStripPanelGradientEnd = Color.Empty; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/KryptonDataGridViewStyles.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/KryptonDataGridViewStyles.cs index 1e70f9de7..2b226ae1d 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/KryptonDataGridViewStyles.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/KryptonDataGridViewStyles.cs @@ -110,10 +110,7 @@ public DataGridViewStyle Style private bool ShouldSerializeStyle() => Style != DataGridViewStyle.List; - private void ResetStyle() - { - Style = DataGridViewStyle.List; - } + private void ResetStyle() => Style = DataGridViewStyle.List; #endregion #region StyleColumn @@ -191,10 +188,7 @@ public GridStyle StyleColumn private bool ShouldSerializeStyleColumn() => StyleColumn != GridStyle.List; - private void ResetStyleColumn() - { - StyleColumn = GridStyle.List; - } + private void ResetStyleColumn() => StyleColumn = GridStyle.List; #endregion #region StyleRow @@ -272,10 +266,7 @@ public GridStyle StyleRow private bool ShouldSerializeStyleRow() => StyleRow != GridStyle.List; - private void ResetStyleRow() - { - StyleRow = GridStyle.List; - } + private void ResetStyleRow() => StyleRow = GridStyle.List; #endregion #region StyleDataCells @@ -353,10 +344,7 @@ public GridStyle StyleDataCells private bool ShouldSerializeStyleDataCells() => StyleDataCells != GridStyle.List; - private void ResetStyleDataCells() - { - StyleDataCells = GridStyle.List; - } + private void ResetStyleDataCells() => StyleDataCells = GridStyle.List; #endregion #region StyleBackground @@ -409,10 +397,7 @@ PaletteBackStyle.GridBackgroundCustom3 when (_columnStyle == GridStyle.Custom3) private bool ShouldSerializeStyleBackground() => StyleBackground != PaletteBackStyle.GridBackgroundList; - private void ResetStyleBackground() - { - StyleBackground = PaletteBackStyle.GridBackgroundList; - } + private void ResetStyleBackground() => StyleBackground = PaletteBackStyle.GridBackgroundList; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteBorderEdgeRedirect.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteBorderEdgeRedirect.cs index 707105eb2..8d1cfd53b 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteBorderEdgeRedirect.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteBorderEdgeRedirect.cs @@ -127,7 +127,7 @@ public PaletteGraphicsHint GetBackGraphicsHint(PaletteState state) => /// Source for inheriting defaulted values. /// Delegate for notifying paint requests. public PaletteBorderEdgeRedirect(IPaletteBorder inherit, - NeedPaintHandler? needPaint) + NeedPaintHandler needPaint) : base(null, needPaint) { // Remember inheritance @@ -182,10 +182,7 @@ public int Width /// Update the source palettes for drawing. /// /// Palette source for the border. - public virtual void SetPalette(IPaletteBorder paletteBorder) - { - _inherit = paletteBorder; - } + public virtual void SetPalette(IPaletteBorder paletteBorder) => _inherit = paletteBorder; #endregion #region IPaletteBorder diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteContentInheritNode.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteContentInheritNode.cs index f22e1eb43..020fd2b6b 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteContentInheritNode.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteContentInheritNode.cs @@ -216,7 +216,7 @@ public PaletteContentInheritNode(IPaletteContent inherit) => /// Palette value should be applicable to this state. /// Font value. public override Font GetContentLongTextFont(PaletteState state) => - (TreeNode is KryptonTreeNode { LongNodeFont: { } } kryptonNode) + (TreeNode is KryptonTreeNode { LongNodeFont: not null } kryptonNode) ? kryptonNode.LongNodeFont : _inherit.GetContentLongTextFont(state); diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteDataGridViewBackInherit.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteDataGridViewBackInherit.cs index 5b22285a6..75bdd3f98 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteDataGridViewBackInherit.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteDataGridViewBackInherit.cs @@ -59,15 +59,12 @@ public void SetInherit([DisallowNull] IPaletteBack inherit, /// /// Palette value should be applicable to this state. /// Color value. - public override Color GetBackColor1(PaletteState state) + public override Color GetBackColor1(PaletteState state) => state switch { - return state switch - { - PaletteState.Normal => _cellStyle.BackColor, - PaletteState.CheckedNormal => _cellStyle.SelectionBackColor, - _ => _inherit.GetBackColor1(state) - }; - } + PaletteState.Normal => _cellStyle.BackColor, + PaletteState.CheckedNormal => _cellStyle.SelectionBackColor, + _ => _inherit.GetBackColor1(state) + }; /// /// Gets the second back color. diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteDataGridViewContentCommon.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteDataGridViewContentCommon.cs index 1a6da0d0e..dc2e76c1a 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteDataGridViewContentCommon.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteDataGridViewContentCommon.cs @@ -195,10 +195,7 @@ public Padding Padding /// /// Reset the Padding to the default value. /// - public void ResetPadding() - { - Padding = CommonHelper.InheritPadding; - } + public void ResetPadding() => Padding = CommonHelper.InheritPadding; /// /// Gets the actual padding between the border and content drawing. diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteDataGridViewContentInherit.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteDataGridViewContentInherit.cs index fd3e1fce5..e41aed353 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteDataGridViewContentInherit.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteDataGridViewContentInherit.cs @@ -136,32 +136,26 @@ public void SetInherit([DisallowNull] IPaletteContent inherit, /// /// Palette value should be applicable to this state. /// RelativeAlignment value. - public override PaletteRelativeAlign GetContentShortTextH(PaletteState state) + public override PaletteRelativeAlign GetContentShortTextH(PaletteState state) => _cellStyle.Alignment switch { - return _cellStyle.Alignment switch - { - DataGridViewContentAlignment.TopLeft or DataGridViewContentAlignment.MiddleLeft or DataGridViewContentAlignment.BottomLeft => PaletteRelativeAlign.Near, - DataGridViewContentAlignment.TopCenter or DataGridViewContentAlignment.MiddleCenter or DataGridViewContentAlignment.BottomCenter => PaletteRelativeAlign.Center, - DataGridViewContentAlignment.TopRight or DataGridViewContentAlignment.MiddleRight or DataGridViewContentAlignment.BottomRight => PaletteRelativeAlign.Far, - _ => _inherit.GetContentShortTextH(state) - }; - } + DataGridViewContentAlignment.TopLeft or DataGridViewContentAlignment.MiddleLeft or DataGridViewContentAlignment.BottomLeft => PaletteRelativeAlign.Near, + DataGridViewContentAlignment.TopCenter or DataGridViewContentAlignment.MiddleCenter or DataGridViewContentAlignment.BottomCenter => PaletteRelativeAlign.Center, + DataGridViewContentAlignment.TopRight or DataGridViewContentAlignment.MiddleRight or DataGridViewContentAlignment.BottomRight => PaletteRelativeAlign.Far, + _ => _inherit.GetContentShortTextH(state) + }; /// /// Gets the vertical relative alignment of the short text. /// /// Palette value should be applicable to this state. /// RelativeAlignment value. - public override PaletteRelativeAlign GetContentShortTextV(PaletteState state) + public override PaletteRelativeAlign GetContentShortTextV(PaletteState state) => _cellStyle.Alignment switch { - return _cellStyle.Alignment switch - { - DataGridViewContentAlignment.TopCenter or DataGridViewContentAlignment.TopLeft or DataGridViewContentAlignment.TopRight => PaletteRelativeAlign.Near, - DataGridViewContentAlignment.MiddleCenter or DataGridViewContentAlignment.MiddleLeft or DataGridViewContentAlignment.MiddleRight => PaletteRelativeAlign.Center, - DataGridViewContentAlignment.BottomCenter or DataGridViewContentAlignment.BottomLeft or DataGridViewContentAlignment.BottomRight => PaletteRelativeAlign.Far, - _ => _inherit.GetContentShortTextV(state) - }; - } + DataGridViewContentAlignment.TopCenter or DataGridViewContentAlignment.TopLeft or DataGridViewContentAlignment.TopRight => PaletteRelativeAlign.Near, + DataGridViewContentAlignment.MiddleCenter or DataGridViewContentAlignment.MiddleLeft or DataGridViewContentAlignment.MiddleRight => PaletteRelativeAlign.Center, + DataGridViewContentAlignment.BottomCenter or DataGridViewContentAlignment.BottomLeft or DataGridViewContentAlignment.BottomRight => PaletteRelativeAlign.Far, + _ => _inherit.GetContentShortTextV(state) + }; /// /// Gets the vertical relative alignment of the short text. @@ -175,15 +169,12 @@ public override PaletteRelativeAlign GetContentShortTextV(PaletteState state) /// /// Palette value should be applicable to this state. /// Color value. - public override Color GetContentShortTextColor1(PaletteState state) + public override Color GetContentShortTextColor1(PaletteState state) => state switch { - return state switch - { - PaletteState.Normal => _cellStyle.ForeColor, - PaletteState.CheckedNormal => _cellStyle.SelectionForeColor, - _ => _inherit.GetContentShortTextColor1(state) - }; - } + PaletteState.Normal => _cellStyle.ForeColor, + PaletteState.CheckedNormal => _cellStyle.SelectionForeColor, + _ => _inherit.GetContentShortTextColor1(state) + }; /// /// Gets the second back color for the short text. @@ -281,32 +272,26 @@ public override Color GetContentShortTextColor1(PaletteState state) /// /// Palette value should be applicable to this state. /// RelativeAlignment value. - public override PaletteRelativeAlign GetContentLongTextH(PaletteState state) + public override PaletteRelativeAlign GetContentLongTextH(PaletteState state) => _cellStyle.Alignment switch { - return _cellStyle.Alignment switch - { - DataGridViewContentAlignment.TopLeft or DataGridViewContentAlignment.MiddleLeft or DataGridViewContentAlignment.BottomLeft => PaletteRelativeAlign.Near, - DataGridViewContentAlignment.TopCenter or DataGridViewContentAlignment.MiddleCenter or DataGridViewContentAlignment.BottomCenter => PaletteRelativeAlign.Center, - DataGridViewContentAlignment.TopRight or DataGridViewContentAlignment.MiddleRight or DataGridViewContentAlignment.BottomRight => PaletteRelativeAlign.Far, - _ => _inherit.GetContentLongTextH(state) - }; - } + DataGridViewContentAlignment.TopLeft or DataGridViewContentAlignment.MiddleLeft or DataGridViewContentAlignment.BottomLeft => PaletteRelativeAlign.Near, + DataGridViewContentAlignment.TopCenter or DataGridViewContentAlignment.MiddleCenter or DataGridViewContentAlignment.BottomCenter => PaletteRelativeAlign.Center, + DataGridViewContentAlignment.TopRight or DataGridViewContentAlignment.MiddleRight or DataGridViewContentAlignment.BottomRight => PaletteRelativeAlign.Far, + _ => _inherit.GetContentLongTextH(state) + }; /// /// Gets the vertical relative alignment of the long text. /// /// Palette value should be applicable to this state. /// RelativeAlignment value. - public override PaletteRelativeAlign GetContentLongTextV(PaletteState state) + public override PaletteRelativeAlign GetContentLongTextV(PaletteState state) => _cellStyle.Alignment switch { - return _cellStyle.Alignment switch - { - DataGridViewContentAlignment.TopLeft or DataGridViewContentAlignment.MiddleLeft or DataGridViewContentAlignment.BottomLeft => PaletteRelativeAlign.Near, - DataGridViewContentAlignment.TopCenter or DataGridViewContentAlignment.MiddleCenter or DataGridViewContentAlignment.BottomCenter => PaletteRelativeAlign.Center, - DataGridViewContentAlignment.TopRight or DataGridViewContentAlignment.MiddleRight or DataGridViewContentAlignment.BottomRight => PaletteRelativeAlign.Far, - _ => _inherit.GetContentLongTextV(state) - }; - } + DataGridViewContentAlignment.TopLeft or DataGridViewContentAlignment.MiddleLeft or DataGridViewContentAlignment.BottomLeft => PaletteRelativeAlign.Near, + DataGridViewContentAlignment.TopCenter or DataGridViewContentAlignment.MiddleCenter or DataGridViewContentAlignment.BottomCenter => PaletteRelativeAlign.Center, + DataGridViewContentAlignment.TopRight or DataGridViewContentAlignment.MiddleRight or DataGridViewContentAlignment.BottomRight => PaletteRelativeAlign.Far, + _ => _inherit.GetContentLongTextV(state) + }; /// /// Gets the vertical relative alignment of the long text. diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteDataGridViewContentStates.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteDataGridViewContentStates.cs index 0b8c6fe1e..b5826fa90 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteDataGridViewContentStates.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteDataGridViewContentStates.cs @@ -102,10 +102,7 @@ public PaletteDataGridViewContentStates([DisallowNull] IPaletteContent inherit, /// /// Sets the inheritance parent. /// - public void SetInherit(IPaletteContent inherit) - { - Inherit = inherit; - } + public void SetInherit(IPaletteContent inherit) => Inherit = inherit; #endregion #region PopulateFromBase diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteHeaderButtonRedirect.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteHeaderButtonRedirect.cs index e3ab5fca8..fcee5ddf5 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteHeaderButtonRedirect.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteHeaderButtonRedirect.cs @@ -86,10 +86,7 @@ public int ButtonEdgeInset /// /// Reset the ButtonEdgeInset to the default value. /// - public void ResetButtonEdgeInset() - { - ButtonEdgeInset = -1; - } + public void ResetButtonEdgeInset() => ButtonEdgeInset = -1; #endregion #region ButtonPadding @@ -117,10 +114,7 @@ public Padding ButtonPadding /// /// Reset the ButtonPadding to the default value. /// - public void ResetButtonPadding() - { - ButtonPadding = CommonHelper.InheritPadding; - } + public void ResetButtonPadding() => ButtonPadding = CommonHelper.InheritPadding; #endregion #region IPaletteMetric diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteHeaderPaddingRedirect.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteHeaderPaddingRedirect.cs index 6494b13ce..35e528342 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteHeaderPaddingRedirect.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteHeaderPaddingRedirect.cs @@ -83,10 +83,7 @@ public Padding HeaderPadding /// /// Reset the HeaderPadding to the default value. /// - public void ResetHeaderPadding() - { - HeaderPadding = CommonHelper.InheritPadding; - } + public void ResetHeaderPadding() => HeaderPadding = CommonHelper.InheritPadding; #endregion #region IPaletteMetric diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteHeaderRedirect.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteHeaderRedirect.cs index a9d693404..9f5440397 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteHeaderRedirect.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteHeaderRedirect.cs @@ -102,10 +102,7 @@ public int ButtonEdgeInset /// /// Reset the ButtonEdgeInset to the default value. /// - public void ResetButtonEdgeInset() - { - ButtonEdgeInset = -1; - } + public void ResetButtonEdgeInset() => ButtonEdgeInset = -1; #endregion #region ButtonPadding @@ -133,10 +130,7 @@ public Padding ButtonPadding /// /// Reset the ButtonPadding to the default value. /// - public void ResetButtonPadding() - { - ButtonPadding = CommonHelper.InheritPadding; - } + public void ResetButtonPadding() => ButtonPadding = CommonHelper.InheritPadding; #endregion #region IPaletteMetric diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteInputControlBackStates.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteInputControlBackStates.cs index 79bd6a34f..b09c5ae8e 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteInputControlBackStates.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteInputControlBackStates.cs @@ -58,10 +58,7 @@ public PaletteInputControlBackStates([DisallowNull] IPaletteBack inherit, /// /// Sets the inheritance parent. /// - public void SetInherit(IPaletteBack inherit) - { - Inherit = inherit; - } + public void SetInherit(IPaletteBack inherit) => Inherit = inherit; #endregion #region PopulateFromBase @@ -69,11 +66,9 @@ public void SetInherit(IPaletteBack inherit) /// Populate values from the base palette. /// /// Palette state to use when populating. - public virtual void PopulateFromBase(PaletteState state) - { + public virtual void PopulateFromBase(PaletteState state) => // Get the values and set into storage Color1 = GetBackColor1(state); - } #endregion #region Draw diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteInputControlContentStates.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteInputControlContentStates.cs index 5a27e6a5e..9f57f0da5 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteInputControlContentStates.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteInputControlContentStates.cs @@ -69,10 +69,7 @@ public PaletteInputControlContentStates([DisallowNull] IPaletteContent inherit, /// /// Sets the inheritance parent. /// - public void SetInherit(IPaletteContent inherit) - { - Inherit = inherit; - } + public void SetInherit(IPaletteContent inherit) => Inherit = inherit; #endregion #region PopulateFromBase diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteSeparatorPadding.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteSeparatorPadding.cs index f1a398499..e04b1d701 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteSeparatorPadding.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteSeparatorPadding.cs @@ -108,10 +108,7 @@ public Padding Padding /// /// Reset the Padding to the default value. /// - public void ResetPadding() - { - Padding = CommonHelper.InheritPadding; - } + public void ResetPadding() => Padding = CommonHelper.InheritPadding; #endregion #region IPaletteMetric diff --git a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteSeparatorPaddingRedirect.cs b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteSeparatorPaddingRedirect.cs index 777b80c88..ec8780e30 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteSeparatorPaddingRedirect.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Palette Controls/PaletteSeparatorPaddingRedirect.cs @@ -83,10 +83,7 @@ public Padding Padding /// /// Reset the Padding to the default value. /// - public void ResetPadding() - { - Padding = CommonHelper.InheritPadding; - } + public void ResetPadding() => Padding = CommonHelper.InheritPadding; #endregion #region IPaletteMetric diff --git a/Source/Krypton Components/Krypton.Toolkit/Rendering/RenderExpertHelpers.cs b/Source/Krypton Components/Krypton.Toolkit/Rendering/RenderExpertHelpers.cs index d1648e9da..8dd2d7a27 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Rendering/RenderExpertHelpers.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Rendering/RenderExpertHelpers.cs @@ -60,7 +60,7 @@ static RenderExpertHelpers() GraphicsPath path, IDisposable? memento) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); MementoDouble? cache; if (memento is MementoDouble mementoDouble) @@ -103,7 +103,7 @@ static RenderExpertHelpers() GraphicsPath path, IDisposable? memento) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); // Cannot draw a zero length rectangle if (rect is { Width: > 0, Height: > 0 }) { @@ -142,7 +142,7 @@ static RenderExpertHelpers() cache.Brush3 = new SolidBrush(backColor1); } - using var aa = new AntiAlias(context.Graphics); + using AntiAlias aa = new AntiAlias(context.Graphics); context.Graphics.FillRectangle(cache.Brush3, rect); context.Graphics.FillPath(cache.Brush1, cache.Path1); context.Graphics.FillPath(cache.Brush2, cache.Path2); @@ -170,7 +170,7 @@ static RenderExpertHelpers() GraphicsPath path, IDisposable? memento) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); // Draw the expert background which is gradient with highlight at bottom return DrawBackExpert(rect, backColor1, backColor2, orientation, context.Graphics, memento, true, false); } @@ -193,7 +193,7 @@ static RenderExpertHelpers() GraphicsPath path, IDisposable? memento) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); MementoDouble? cache; if (memento is MementoDouble mementoDouble) @@ -238,7 +238,7 @@ static RenderExpertHelpers() IDisposable? memento, bool light) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); // Cannot draw a zero length rectangle if (rect is { Width: > 0, Height: > 0 }) { @@ -421,7 +421,7 @@ private static IDisposable DrawBackSolid(RectangleF drawRect, } // Create rectangle that covers the enter area - var gradientRect = new RectangleF(drawRect.X - 1, drawRect.Y - 1, drawRect.Width + 2, + RectangleF gradientRect = new RectangleF(drawRect.X - 1, drawRect.Y - 1, drawRect.Width + 2, drawRect.Height + 2); // Cannot draw a zero length rectangle @@ -474,7 +474,7 @@ private static IDisposable DrawBackSolid(RectangleF drawRect, if (cache.EntireBrush != null) { - using var clip = new Clipping(g, cache.ClipPath); + using Clipping clip = new Clipping(g, cache.ClipPath); g.FillRectangle(cache.EntireBrush, cache.DrawRect); g.FillPath(cache.InsideLighten, cache.EllipsePath); } @@ -490,7 +490,7 @@ private static GraphicsPath CreateBorderPath(Rectangle rect, float cut) rect.Height--; // Create path using a simple set of lines that cut the corner - var path = new GraphicsPath(); + GraphicsPath path = new GraphicsPath(); path.AddLine(rect.Left + cut, rect.Top, rect.Right - cut, rect.Top); path.AddLine(rect.Right - cut, rect.Top, rect.Right, rect.Top + cut); path.AddLine(rect.Right, rect.Top + cut, rect.Right, rect.Bottom - cut); @@ -502,16 +502,13 @@ private static GraphicsPath CreateBorderPath(Rectangle rect, float cut) return path; } - private static float AngleFromOrientation(VisualOrientation orientation) + private static float AngleFromOrientation(VisualOrientation orientation) => orientation switch { - return orientation switch - { - VisualOrientation.Bottom => 270f, - VisualOrientation.Left => 0f, - VisualOrientation.Right => 180, - _ => 90f - }; - } + VisualOrientation.Bottom => 270f, + VisualOrientation.Left => 0f, + VisualOrientation.Right => 180, + _ => 90f + }; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Rendering/RenderGlassHelpers.cs b/Source/Krypton Components/Krypton.Toolkit/Rendering/RenderGlassHelpers.cs index 1a9328f64..8ad5eccfb 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Rendering/RenderGlassHelpers.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Rendering/RenderGlassHelpers.cs @@ -61,7 +61,7 @@ static RenderGlassHelpers() GraphicsPath path, IDisposable? memento) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); MementoDouble? cache; if (memento is MementoDouble mementoDouble) @@ -114,7 +114,7 @@ static RenderGlassHelpers() GraphicsPath path, IDisposable? memento) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); MementoDouble? cache; if (memento is MementoDouble mementoDouble) @@ -166,7 +166,7 @@ static RenderGlassHelpers() GraphicsPath path, IDisposable? memento) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); MementoDouble? cache; if (memento is MementoDouble mementoDouble) @@ -456,7 +456,7 @@ static RenderGlassHelpers() GraphicsPath path, IDisposable? memento) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); var generate = true; MementoBackGlassThreeEdge? cache; @@ -528,7 +528,7 @@ static RenderGlassHelpers() GraphicsPath path, IDisposable? memento) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); // Draw the inside area return DrawBackGlassLinear(rect, rect, backColor1, backColor2, @@ -558,7 +558,7 @@ static RenderGlassHelpers() GraphicsPath path, IDisposable? memento) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); // Draw the inside area as a glass effect return DrawBackGlassRadial(rect, backColor1, backColor2, _glassColorTopL, _glassColorBottomL, @@ -584,7 +584,7 @@ static RenderGlassHelpers() GraphicsPath path, IDisposable? memento) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); // Draw the inside areas as a glass effect return DrawBackGlassRadial(rect, backColor1, backColor2, _glassColorTopL, _glassColorBottomL, @@ -610,7 +610,7 @@ static RenderGlassHelpers() GraphicsPath path, IDisposable? memento) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); // Draw the inside areas as a glass effect return DrawBackGlassRadial(rect, backColor1, backColor2, _glassColorTopD, _glassColorBottomD, @@ -636,7 +636,7 @@ static RenderGlassHelpers() GraphicsPath path, IDisposable? memento) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); // Draw the inside areas as a glass effect return DrawBackGlassRadial(rect, backColor1, backColor2, _glassColorTopD, _glassColorBottomD, @@ -656,7 +656,7 @@ static RenderGlassHelpers() float glassPercent, IDisposable? memento) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); MementoDouble? cache; if (memento is MementoDouble mementoDouble) @@ -672,7 +672,7 @@ static RenderGlassHelpers() } // Get the drawing rectangle for the path - var drawRect = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height); + RectangleF drawRect = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height); // Draw the border as a lighter version of the inside cache.First = DrawBackGlassLinear(drawRect, drawRect, @@ -712,7 +712,7 @@ static RenderGlassHelpers() float glassPercent, IDisposable? memento) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); MementoDouble? cache; if (memento is MementoDouble mementoDouble) @@ -728,7 +728,7 @@ static RenderGlassHelpers() } // Get the drawing rectangle for the path - var drawRect = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height); + RectangleF drawRect = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height); // Draw the border as a lighter version of the inside cache.First = DrawBackGlassLinear(drawRect, drawRect, @@ -767,7 +767,7 @@ static RenderGlassHelpers() float glassPercent, IDisposable? memento) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); MementoDouble? cache; if (memento is MementoDouble mementoDouble) @@ -811,7 +811,7 @@ static RenderGlassHelpers() float glassPercent, IDisposable? memento) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); MementoTriple? cache; if (memento is MementoTriple triple) @@ -861,7 +861,7 @@ static RenderGlassHelpers() float glassPercent, IDisposable? memento) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); MementoTriple? cache; if (memento is MementoTriple triple) @@ -913,7 +913,7 @@ static RenderGlassHelpers() float glassPercent, IDisposable? memento) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); MementoTriple? cache; if (memento is MementoTriple triple) @@ -1321,7 +1321,7 @@ private static IDisposable DrawBackGlassFade(RectangleF drawRect, cache.Dispose(); // Create gradient rect from the drawing rect - var gradientRect = new RectangleF(drawRect.X - 1, drawRect.Y - 1, drawRect.Width + 2, + RectangleF gradientRect = new RectangleF(drawRect.X - 1, drawRect.Y - 1, drawRect.Width + 2, drawRect.Height + 2); // Cannot draw a zero sized rectangle @@ -1371,7 +1371,7 @@ private static IDisposable DrawBackGlassFade(RectangleF drawRect, } // Create gradient rectangles - var glassGradientRect = new RectangleF(glassRect.X - 1, glassRect.Y - 1, glassRect.Width + 2, + RectangleF glassGradientRect = new RectangleF(glassRect.X - 1, glassRect.Y - 1, glassRect.Width + 2, glassRect.Height + 2); // Cannot draw a zero sized rectangle @@ -1479,9 +1479,9 @@ private static IDisposable DrawBackGlassFade(RectangleF drawRect, cache.MainRect = mainRect; // Create gradient rectangles - var glassGradientRect = new RectangleF(cache.GlassRect.X - 1, cache.GlassRect.Y - 1, + RectangleF glassGradientRect = new RectangleF(cache.GlassRect.X - 1, cache.GlassRect.Y - 1, cache.GlassRect.Width + 2, cache.GlassRect.Height + 2); - var mainGradientRect = new RectangleF(cache.MainRect.X - 1, cache.MainRect.Y - 1, + RectangleF mainGradientRect = new RectangleF(cache.MainRect.X - 1, cache.MainRect.Y - 1, cache.MainRect.Width + 2, cache.MainRect.Height + 2); // Cannot draw a zero length rectangle @@ -1498,7 +1498,7 @@ private static IDisposable DrawBackGlassFade(RectangleF drawRect, // Draw entire area in a solid color g.FillRectangle(cache.TotalBrush, drawRect); - if (cache is { TopBrush: { }, BottomBrush: { } }) + if (cache is { TopBrush: not null, BottomBrush: not null }) { g.FillRectangle(cache.TopBrush, cache.GlassRect); g.FillRectangle(cache.BottomBrush, cache.MainRect); @@ -1575,7 +1575,7 @@ private static RectangleF DrawBackGlassBasic(RectangleF drawRect, }; // Gradient rectangle is always a little bigger to prevent tiling at edges - var glassGradientRect = new RectangleF(glassRect.X - 1, glassRect.Y - 1, glassRect.Width + 2, + RectangleF glassGradientRect = new RectangleF(glassRect.X - 1, glassRect.Y - 1, glassRect.Width + 2, glassRect.Height + 2); // Cannot draw a zero length rectangle @@ -1633,7 +1633,7 @@ private static IDisposable DrawBackLinear(RectangleF drawRect, cache.Dispose(); // Create rectangle that covers the enter area - var gradientRect = new RectangleF(drawRect.X - 1, drawRect.Y - 1, drawRect.Width + 2, + RectangleF gradientRect = new RectangleF(drawRect.X - 1, drawRect.Y - 1, drawRect.Width + 2, drawRect.Height + 2); // Cannot draw a zero length rectangle @@ -1731,7 +1731,7 @@ private static IDisposable DrawBackDarkEdge(RectangleF drawRect, } // Create rectangle that covers the enter area - var gradientRect = new RectangleF(drawRect.X - 0.5f, drawRect.Y - 0.5f, + RectangleF gradientRect = new RectangleF(drawRect.X - 0.5f, drawRect.Y - 0.5f, drawRect.Width + 1, drawRect.Height + 1); // Cannot draw a zero length rectangle @@ -1757,17 +1757,14 @@ private static IDisposable DrawBackDarkEdge(RectangleF drawRect, private static bool VerticalOrientation(VisualOrientation orientation) => orientation is VisualOrientation.Top or VisualOrientation.Bottom; - private static float AngleFromOrientation(VisualOrientation orientation) + private static float AngleFromOrientation(VisualOrientation orientation) => orientation switch { - return orientation switch - { - VisualOrientation.Bottom => 270f, - VisualOrientation.Left => 0f, - VisualOrientation.Right => 180, - VisualOrientation.Top => 90f, - _ => 90f - }; - } + VisualOrientation.Bottom => 270f, + VisualOrientation.Left => 0f, + VisualOrientation.Right => 180, + VisualOrientation.Top => 90f, + _ => 90f + }; private static void ModifyRectByEdges(ref Rectangle rect, int left, diff --git a/Source/Krypton Components/Krypton.Toolkit/Rendering/RenderMementos.cs b/Source/Krypton Components/Krypton.Toolkit/Rendering/RenderMementos.cs index 06ac33f9a..da4547377 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Rendering/RenderMementos.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Rendering/RenderMementos.cs @@ -49,10 +49,7 @@ public void Dispose() /// Dispose of resources. /// /// - public virtual void Dispose(bool disposing) - { - _disposed = true; - } + public virtual void Dispose(bool disposing) => _disposed = true; } #endregion @@ -525,8 +522,7 @@ public MementoRibbonAppTab2013(Rectangle r, Color color1) } /// For internal use only. - public void GeneratePaths(Rectangle rect, PaletteState state) - { + public void GeneratePaths(Rectangle rect, PaletteState state) => //// Create the border path //borderPath = new GraphicsPath(); //borderPath.AddLine(rect.Left, rect.Bottom - 2, rect.Left, rect.Top + 1.75f); @@ -552,19 +548,7 @@ public void GeneratePaths(Rectangle rect, PaletteState state) //highlightBrush.SurroundColors = new Color[] { Color.Transparent }; // Reduce rectangle to the inside fill area - rect.X -= 1; - //rect.Y += 2; - //rect.Width -= 3; - //rect.Height -= 2; - - // Create inside path for filling - //insideFillPath = new GraphicsPath(); - //insideFillPath.AddLine(rect.Left, rect.Bottom - 1, rect.Left, rect.Top + 1f); - //insideFillPath.AddLine(rect.Left, rect.Top + 1f, rect.Left + 1, rect.Top); - //insideFillPath.AddLine(rect.Left + 1, rect.Top, rect.Right - 2, rect.Top); - //insideFillPath.AddLine(rect.Right - 2, rect.Top, rect.Right - 1, rect.Top + 1.75f); - //insideFillPath.AddLine(rect.Right - 1, rect.Top + 1.75f, rect.Right - 1, rect.Bottom - 1); - } + rect.X -= 1;//rect.Y += 2;//rect.Width -= 3;//rect.Height -= 2;// Create inside path for filling//insideFillPath = new GraphicsPath();//insideFillPath.AddLine(rect.Left, rect.Bottom - 1, rect.Left, rect.Top + 1f);//insideFillPath.AddLine(rect.Left, rect.Top + 1f, rect.Left + 1, rect.Top);//insideFillPath.AddLine(rect.Left + 1, rect.Top, rect.Right - 2, rect.Top);//insideFillPath.AddLine(rect.Right - 2, rect.Top, rect.Right - 1, rect.Top + 1.75f);//insideFillPath.AddLine(rect.Right - 1, rect.Top + 1.75f, rect.Right - 1, rect.Bottom - 1); /// For internal use only. public override void Dispose(bool disposing) => diff --git a/Source/Krypton Components/Krypton.Toolkit/Rendering/RenderStandard.cs b/Source/Krypton Components/Krypton.Toolkit/Rendering/RenderStandard.cs index 237102666..074ffac7f 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Rendering/RenderStandard.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Rendering/RenderStandard.cs @@ -386,7 +386,7 @@ public override ToolStripRenderer RenderToolStrip([DisallowNull] PaletteBase col } // Use the professional renderer but pull colors from the palette - var renderer = new KryptonStandardRenderer(colorPalette.ColorTable) + KryptonStandardRenderer renderer = new KryptonStandardRenderer(colorPalette.ColorTable) { // Setup the need to use rounded corners @@ -733,7 +733,7 @@ public override void DrawBorder([DisallowNull] RenderContext context, SmoothingMode smoothMode = palette.GetBorderRounding(state) > 0 ? SmoothingMode.AntiAlias : SmoothingMode.Default; // We want to draw using anti aliasing for a nice smooth effect - using var hint = new GraphicsHint(context.Graphics, palette.GetBorderGraphicsHint(state)); + using GraphicsHint hint = new GraphicsHint(context.Graphics, palette.GetBorderGraphicsHint(state)); // Cache commonly used values var borderWidth = palette.GetBorderWidth(state); @@ -764,7 +764,7 @@ public override void DrawBorder([DisallowNull] RenderContext context, // Use standard helper routine to create appropriate color brush PaletteColorStyle colorStyle = palette.GetBorderColorStyle(state); - using (var borderPen = + using (Pen borderPen = new Pen( CreateColorBrush(gradientRect, palette.GetBorderColor1(state), palette.GetBorderColor2(state), colorStyle, palette.GetBorderColorAngle(state), @@ -794,7 +794,7 @@ public override void DrawBorder([DisallowNull] RenderContext context, Rectangle imageRect = context.GetAlignedRectangle(palette.GetBorderImageAlign(state), rect); // Use standard helper routine to create appropriate image brush - using var borderPen = new Pen(CreateImageBrush(imageRect, borderImage!, borderImageStyle), + using Pen borderPen = new Pen(CreateImageBrush(imageRect, borderImage!, borderImageStyle), borderWidth); context.Graphics.DrawPath(borderPen, borderPath0); @@ -873,7 +873,7 @@ public override void DrawBorder([DisallowNull] RenderContext context, } // We want to draw using anti aliasing for a nice smooth effect - using var smooth = new GraphicsHint(context.Graphics, palette.GetBackGraphicsHint(state)); + using GraphicsHint smooth = new GraphicsHint(context.Graphics, palette.GetBackGraphicsHint(state)); // Cache commonly used values Image? backImage = palette.GetBackImage(state); PaletteImageStyle backImageStyle = palette.GetBackImageStyle(state); @@ -1067,7 +1067,7 @@ public override Size GetContentPreferredSize([DisallowNull] ViewLayoutContext co // Provide a maximum sized rectangle for placing content into, in // order to work out how much of the space is actually allocated - var displayRect = new Rectangle(Point.Empty, new Size(int.MaxValue, int.MaxValue)); + Rectangle displayRect = new Rectangle(Point.Empty, new Size(int.MaxValue, int.MaxValue)); // Track the allocated space in each grid position var allocation = new Size[3, 3] { { Size.Empty, Size.Empty, Size.Empty }, @@ -1075,7 +1075,7 @@ public override Size GetContentPreferredSize([DisallowNull] ViewLayoutContext co { Size.Empty, Size.Empty, Size.Empty } }; // Create a memento for storing calculations - using var memento = new StandardContentMemento(); + using StandardContentMemento memento = new StandardContentMemento(); // Cache the size of a spacing gap var spacingGap = palette.GetContentAdjacentGap(state); @@ -1205,7 +1205,7 @@ public override IDisposable LayoutContent([DisallowNull] ViewLayoutContext conte { Size.Empty, Size.Empty, Size.Empty } }; // Create a memento to return to caller - var memento = new StandardContentMemento(); + StandardContentMemento memento = new StandardContentMemento(); // Cache the size of a spacing gap var spacingGap = palette.GetContentAdjacentGap(state); @@ -1325,7 +1325,7 @@ public override void DrawContent([DisallowNull] RenderContext context, Debug.Assert(!context.Control.IsDisposed); // Cast the incoming memento to the correct type - var standard = (StandardContentMemento)memento; + StandardContentMemento standard = (StandardContentMemento)memento; if (standard.DrawImage) { @@ -1341,7 +1341,7 @@ public override void DrawContent([DisallowNull] RenderContext context, if (standard.DrawShortText) { - using var hint = new GraphicsTextHint(context.Graphics, standard.ShortTextHint); + using GraphicsTextHint hint = new GraphicsTextHint(context.Graphics, standard.ShortTextHint); // Get the rectangle to use when dealing with gradients Rectangle gradientRect = context.GetAlignedRectangle(palette.GetContentShortTextColorAlign(state), standard.ShortTextRect); @@ -1420,7 +1420,7 @@ public override void DrawContent([DisallowNull] RenderContext context, if (standard.DrawLongText) { - using var hint = new GraphicsTextHint(context.Graphics, standard.LongTextHint); + using GraphicsTextHint hint = new GraphicsTextHint(context.Graphics, standard.LongTextHint); // Get the rectangle to use when dealing with gradients Rectangle gradientRect = context.GetAlignedRectangle(palette.GetContentLongTextColorAlign(state), standard.LongTextRect); @@ -1516,7 +1516,7 @@ public override bool GetContentImageDisplayed(IDisposable memento) { if (memento != null) { - var standard = (StandardContentMemento)memento; + StandardContentMemento standard = (StandardContentMemento)memento; return standard.DrawImage; } else @@ -1534,7 +1534,7 @@ public override Rectangle GetContentImageRectangle(IDisposable memento) { if (memento != null) { - var standard = (StandardContentMemento)memento; + StandardContentMemento standard = (StandardContentMemento)memento; return standard.ImageRect; } else @@ -1552,7 +1552,7 @@ public override bool GetContentShortTextDisplayed(IDisposable memento) { if (memento != null) { - var standard = (StandardContentMemento)memento; + StandardContentMemento standard = (StandardContentMemento)memento; return standard.DrawShortText; } else @@ -1570,7 +1570,7 @@ public override Rectangle GetContentShortTextRectangle(IDisposable memento) { if (memento != null) { - var standard = (StandardContentMemento)memento; + StandardContentMemento standard = (StandardContentMemento)memento; return standard.ShortTextRect; } else @@ -1588,7 +1588,7 @@ public override bool GetContentLongTextDisplayed(IDisposable memento) { if (memento != null) { - var standard = (StandardContentMemento)memento; + StandardContentMemento standard = (StandardContentMemento)memento; return standard.DrawLongText; } else @@ -1606,7 +1606,7 @@ public override Rectangle GetContentLongTextRectangle(IDisposable memento) { if (memento != null) { - var standard = (StandardContentMemento)memento; + StandardContentMemento standard = (StandardContentMemento)memento; return standard.LongTextRect; } else @@ -1712,7 +1712,7 @@ public override Padding GetTabBorderDisplayPadding(ViewLayoutContext context, // Cache the right to left setting var rtl = context.Control.RightToLeft == RightToLeft.Yes; - var ret = Padding.Empty; + Padding ret = Padding.Empty; switch (tabBorderStyle) { @@ -1974,7 +1974,7 @@ public override void DrawTabBorder([DisallowNull] RenderContext context, if (rect is { Width: > 0, Height: > 0 }) { // Decide if we need to use anti aliasing for a smoother looking visual - using var hint = new GraphicsHint(context.Graphics, palette.GetBorderGraphicsHint(state)); + using GraphicsHint hint = new GraphicsHint(context.Graphics, palette.GetBorderGraphicsHint(state)); // Cache commonly used values var borderWidth = palette.GetBorderWidth(state); @@ -1996,7 +1996,7 @@ public override void DrawTabBorder([DisallowNull] RenderContext context, palette.GetBorderColorAngle(state), orientation)) { - using (var borderPen = new Pen(borderBrush, borderWidth)) + using (Pen borderPen = new Pen(borderBrush, borderWidth)) { context.Graphics.DrawPath(borderPen, borderPath); } @@ -2014,7 +2014,7 @@ public override void DrawTabBorder([DisallowNull] RenderContext context, PaletteImageStyle borderImageStyle = palette.GetBorderImageStyle(state); // Use standard helper routine to create appropriate image brush - using var borderPen = new Pen(CreateImageBrush(imageRect, borderImage, borderImageStyle), + using Pen borderPen = new Pen(CreateImageBrush(imageRect, borderImage, borderImageStyle), borderWidth); context.Graphics.DrawPath(borderPen, borderPath); } @@ -2058,7 +2058,7 @@ public override void DrawTabBorder([DisallowNull] RenderContext context, // Do nothing break; case PaletteRibbonColorStyle.Solid: - using (var backBrush = new SolidBrush(palette.GetRibbonBackColor1(state))) + using (SolidBrush backBrush = new SolidBrush(palette.GetRibbonBackColor1(state))) { context.Graphics.FillRectangle(backBrush, rect); } @@ -2232,7 +2232,7 @@ public override void DrawRibbonClusterEdge(PaletteRibbonShape shape, Debug.Assert(paletteBack != null); // Draw inside of the border edge in a lighter version of the border - using var drawBrush = new SolidBrush(paletteBack.GetBackColor1(state)); + using SolidBrush drawBrush = new SolidBrush(paletteBack.GetBackColor1(state)); context.Graphics.FillRectangle(drawBrush, displayRect); } #endregion @@ -2528,7 +2528,7 @@ public override Size GetDropDownButtonPreferredSize(ViewLayoutContext context, Image? drawImage = palette.GetDropDownButtonImage(state); // Get the image defined size - var imageSize = Size.Empty; + Size imageSize = Size.Empty; if (drawImage != null) { imageSize = drawImage.Size; @@ -2763,12 +2763,12 @@ public override void DrawRibbonDialogBoxLauncher(PaletteRibbonShape shape, } break; case PaletteRibbonShape.Office2010: - var dialogBrush = new LinearGradientBrush( + LinearGradientBrush dialogBrush = new LinearGradientBrush( new RectangleF(displayRect.X - 1, displayRect.Y - 1, displayRect.Width + 2, displayRect.Height + 2), paletteGeneral.GetRibbonGroupDialogLight(state), paletteGeneral.GetRibbonGroupDialogDark(state), 45f); - using (var dialogPen = new Pen(dialogBrush)) + using (Pen dialogPen = new Pen(dialogBrush)) { context.Graphics.DrawLine(dialogPen, displayRect.Left, displayRect.Top + 5, displayRect.Left, displayRect.Top); context.Graphics.DrawLine(dialogPen, displayRect.Left, displayRect.Top, displayRect.Left + 5, displayRect.Top); @@ -2832,7 +2832,7 @@ public override void DrawRibbonDropArrow(PaletteRibbonShape shape, } break; case PaletteRibbonShape.Office2010: - using (var fillBrush = new LinearGradientBrush( + using (LinearGradientBrush fillBrush = new LinearGradientBrush( new RectangleF(displayRect.X - 1, displayRect.Y - 1, displayRect.Width + 2, displayRect.Height + 2), lightColor, darkColor, 45f)) { @@ -3021,7 +3021,7 @@ public override void DrawRibbonGroupSeparator(PaletteRibbonShape shape, darkBrush.SetSigmaBellShape(0.5f); lightBrush.SetSigmaBellShape(0.5f); - using (var darkPen = new Pen(darkBrush)) + using (Pen darkPen = new Pen(darkBrush)) { context.Graphics.FillRectangle(lightBrush, x, displayRect.Top, 3, displayRect.Height); context.Graphics.DrawLine(darkPen, x + 1, displayRect.Top, x + 1, displayRect.Bottom - 1); @@ -3065,9 +3065,9 @@ public override Rectangle DrawGridSortGlyph([DisallowNull] RenderContext context Color imageColor = paletteContent.GetContentShortTextColor1(state); // Draw the image with remapping the image color to the foreground color - using (var attribs = new ImageAttributes()) + using (ImageAttributes attribs = new ImageAttributes()) { - var cm = new ColorMap + ColorMap cm = new ColorMap { OldColor = Color.Black, NewColor = CommonHelper.MergeColors(imageColor, 0.75f, Color.Transparent, 0.25f) @@ -3145,9 +3145,9 @@ public override Rectangle DrawGridRowGlyph([DisallowNull] RenderContext context, Color imageColor = paletteContent.GetContentShortTextColor1(state); // Draw the image with remapping the image color to the foreground color - using (var attribs = new ImageAttributes()) + using (ImageAttributes attribs = new ImageAttributes()) { - var cm = new ColorMap + ColorMap cm = new ColorMap { OldColor = Color.Black, NewColor = CommonHelper.MergeColors(imageColor, 0.75f, Color.Transparent, 0.25f) @@ -3233,12 +3233,12 @@ public override void DrawDragDropSolidGlyph([DisallowNull] RenderContext context Debug.Assert(context != null); Debug.Assert(dragDropPalette != null); - using (var backBrush = new SolidBrush(dragDropPalette.GetDragDropSolidBack())) + using (SolidBrush backBrush = new SolidBrush(dragDropPalette.GetDragDropSolidBack())) { context.Graphics.FillRectangle(backBrush, drawRect); } - using (var borderPen = new Pen(dragDropPalette.GetDragDropSolidBorder())) + using (Pen borderPen = new Pen(dragDropPalette.GetDragDropSolidBorder())) { context.Graphics.DrawRectangle(borderPen, drawRect); } @@ -3418,7 +3418,7 @@ public override void DrawTrackTicksGlyph(RenderContext context, } float range = maximum - minimum; - using var tickPen = new Pen(elementPalette.GetElementColor1(state)); + using Pen tickPen = new Pen(elementPalette.GetElementColor1(state)); if (orientation == Orientation.Horizontal) { // Reduce area by half the position indicator on each side @@ -3522,7 +3522,7 @@ public override void DrawTrackGlyph(RenderContext context, using Pen border1Pen = new Pen(elementPalette.GetElementColor1(state)), border2Pen = new Pen(elementPalette.GetElementColor2(state)); - using var insideBrush = new SolidBrush(elementPalette.GetElementColor3(state)); + using SolidBrush insideBrush = new SolidBrush(elementPalette.GetElementColor3(state)); if (!volumeControl) { context.Graphics.FillRectangle(insideBrush, drawRect.X + 1, drawRect.Y + 1, drawRect.Width - 2, drawRect.Height - 2); @@ -3539,7 +3539,7 @@ public override void DrawTrackGlyph(RenderContext context, { if (orientation == Orientation.Horizontal) { - using var aa = new AntiAlias(context.Graphics); + using AntiAlias aa = new AntiAlias(context.Graphics); context.Graphics.FillPolygon(insideBrush, new Point[]{ new Point(drawRect.X, drawRect.Bottom - 2), new Point(drawRect.Right - 1, drawRect.Y), new Point(drawRect.Right - 1, drawRect.Bottom - 1), new Point(drawRect.X, drawRect.Bottom - 1), @@ -3552,7 +3552,7 @@ public override void DrawTrackGlyph(RenderContext context, } else { - using var aa = new AntiAlias(context.Graphics); + using AntiAlias aa = new AntiAlias(context.Graphics); context.Graphics.FillPolygon(insideBrush, new Point[]{ new Point(drawRect.X + 1, drawRect.Bottom - 1), new Point(drawRect.Right - 1, drawRect.Y + 1), new Point(drawRect.X, drawRect.Y + 1), new Point(drawRect.X, drawRect.Bottom - 1), @@ -3624,21 +3624,21 @@ public override void DrawTrackPositionGlyph(RenderContext context, && (inside != null) ) { - using (var aa = new AntiAlias(context.Graphics)) + using (AntiAlias aa = new AntiAlias(context.Graphics)) { using (Pen outsidePen = new Pen(elementPalette.GetElementColor1(state)), borderPen = new Pen(elementPalette.GetElementColor2(state))) { context.Graphics.DrawPath(outsidePen, outside); - using (var insideBrush = new SolidBrush(elementPalette.GetElementColor3(state))) + using (SolidBrush insideBrush = new SolidBrush(elementPalette.GetElementColor3(state))) { context.Graphics.FillPath(insideBrush, border); } context.Graphics.DrawPath(borderPen, border); - using (var innerBrush = new LinearGradientBrush(inside.GetBounds(), + using (LinearGradientBrush innerBrush = new LinearGradientBrush(inside.GetBounds(), elementPalette.GetElementColor4(state), elementPalette.GetElementColor5(state), 90f)) { context.Graphics.FillPath(innerBrush, inside); @@ -3667,7 +3667,7 @@ private void CreatePositionPathsBoth(Rectangle drawRect, private GraphicsPath CreatePositionPathsBoth(Rectangle drawRect) { - var path = new GraphicsPath(); + GraphicsPath path = new GraphicsPath(); path.AddLines(new PointF[]{ new PointF(drawRect.X + 0.75f, drawRect.Y), new PointF(drawRect.Right - 1.75f, drawRect.Y), new PointF(drawRect.Right - 1.0f, drawRect.Y + 0.75f), @@ -3697,7 +3697,7 @@ private GraphicsPath CreatePositionPathsBottom(Rectangle drawRect) { var half = ((float)drawRect.Width / 2) - 0.5f; - var path = new GraphicsPath(); + GraphicsPath path = new GraphicsPath(); path.AddLines(new PointF[]{ new PointF(drawRect.X + half, drawRect.Y), new PointF(drawRect.Right - 1.0f, drawRect.Y + +half), new PointF(drawRect.Right - 1.0f, drawRect.Bottom - 2.0f), @@ -3724,7 +3724,7 @@ private GraphicsPath CreatePositionPathsTop(Rectangle drawRect) { var half = ((float)drawRect.Width / 2) - 0.5f; - var path = new GraphicsPath(); + GraphicsPath path = new GraphicsPath(); path.AddLines(new PointF[]{ new PointF(drawRect.X + 0.75f, drawRect.Y), new PointF(drawRect.Right - 1.75f, drawRect.Y), new PointF(drawRect.Right - 1.0f, drawRect.Y + 0.75f), @@ -3752,7 +3752,7 @@ private GraphicsPath CreatePositionPathsRight(Rectangle drawRect) { var half = ((float)drawRect.Height / 2) - 0.5f; - var path = new GraphicsPath(); + GraphicsPath path = new GraphicsPath(); path.AddLines(new PointF[]{ new PointF(drawRect.X + 0.75f, drawRect.Y), new PointF(drawRect.Right - half - 1.0f, drawRect.Y), new PointF(drawRect.Right - 1.0f, drawRect.Y + half), @@ -3780,7 +3780,7 @@ private GraphicsPath CreatePositionPathsLeft(Rectangle drawRect) { var half = ((float)drawRect.Height / 2) - 0.5f; - var path = new GraphicsPath(); + GraphicsPath path = new GraphicsPath(); path.AddLines(new PointF[]{ new PointF(drawRect.Right - 1.75f, drawRect.Y), new PointF(drawRect.Right - 1.0f, drawRect.Y + 0.75f), new PointF(drawRect.Right - 1.0f, drawRect.Bottom - 2.0f), @@ -3803,7 +3803,7 @@ private static GraphicsPath CreateBorderBackPath(bool forBorder, bool smoothing, int variant) { - var borderPath = new GraphicsPath(); + GraphicsPath borderPath = new GraphicsPath(); // A zero size rectangle cannot be drawn, so return a null path if (rect is { Width: > 0, Height: > 0 }) @@ -3929,7 +3929,7 @@ private static void CreateAllBorderBackPath(bool middle, else { // We create the path using a floating point rectangle - var rectF = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height); + RectangleF rectF = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height); // If trying to get the outside edge then perform some offsetting so that // when converted to a region it draws nicely inside the path outline @@ -4051,7 +4051,7 @@ private static void CreateBorderBackPathOnly(bool middle, rect.Height -= 1; // We create the path using a floating point rectangle - var rectF = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height); + RectangleF rectF = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height); // If trying to get the outside edge then perform some offsetting so that // when converted to a region it draws nicely inside the path outline @@ -4161,7 +4161,7 @@ private static void CreateBorderBackPathOnlyClosed(bool middle, rect.Height--; // We create the path using a floating point rectangle - var rectF = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height); + RectangleF rectF = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height); // If trying to get the outside edge then perform some offsetting so that // when converted to a region it draws nicely inside the path outline @@ -4247,7 +4247,7 @@ private static void CreateBorderBackPathComplete(bool middle, float arcLength) { // We create the path using a floating point rectangle - var rectF = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height); + RectangleF rectF = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height); // If trying to get the outside edge then perform some offsetting so that // when converted to a region it draws nicely inside the path outline @@ -4356,7 +4356,7 @@ private static GraphicsPath CreateTabBorderBackPath(RightToLeft rtl, VisualOrientation orientation, bool smoothing) { - var borderPath = new GraphicsPath(); + GraphicsPath borderPath = new GraphicsPath(); // A zero size rectangle cannot be drawn, so return a null path if (rect is { Width: > 0, Height: > 0 }) @@ -5147,7 +5147,7 @@ private static Brush CreateColorBrush(Rectangle rect, } // Otherwise we always create a linear brush using provided colors and angle - var brush = new LinearGradientBrush(rect, color1, color2, angle); + LinearGradientBrush brush = new LinearGradientBrush(rect, color1, color2, angle); switch (gradientStyle) { @@ -5213,7 +5213,7 @@ private static Brush CreateImageBrush(Rectangle rect, PaletteImageStyle imageStyle) { // Create brush based on the provided image - var brush = new TextureBrush(image); + TextureBrush brush = new TextureBrush(image); // Create appropriate wrapping mode from image style switch (imageStyle) @@ -5291,7 +5291,7 @@ private void DrawBackSolidInside(RenderContext context, GraphicsPath path) { // Clip to prevent drawing outside the path - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); // Get the rectangle that encloses the path RectangleF rectF = path.GetBounds(); @@ -5350,7 +5350,7 @@ private void DrawBackOneNote(RenderContext context, } // Make a copy of the original path, so we can change it - var insetPath = (GraphicsPath)path.Clone(); + GraphicsPath insetPath = (GraphicsPath)path.Clone(); // Offset by 1.5 pixels so the background shows around two of // the edges of the background we are about to draw @@ -5368,7 +5368,7 @@ private void DrawBackOneNote(RenderContext context, break; } - using (var clip = new Clipping(context.Graphics, path)) + using (Clipping clip = new Clipping(context.Graphics, path)) { // Draw the second color as the offset background using (Brush backBrush = CreateColorBrush(gradientRect, @@ -5393,9 +5393,9 @@ private void DrawBackSolidLine(RenderContext context, PaletteColorStyle style, GraphicsPath path) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); // Draw entire background in second color - using (var brushColor2 = new SolidBrush(backColor2)) + using (SolidBrush brushColor2 = new SolidBrush(backColor2)) { context.Graphics.FillRectangle(brushColor2, rect); } @@ -5426,7 +5426,7 @@ private void DrawBackSolidLine(RenderContext context, } // Draw the second color as a solid block - using (var brushColor2 = new SolidBrush(backColor1)) + using (SolidBrush brushColor2 = new SolidBrush(backColor1)) { context.Graphics.FillRectangle(brushColor2, rect); } @@ -5442,7 +5442,7 @@ private void DrawBackRoundedTopLeftWhite(RenderContext context, VisualOrientation orientation, GraphicsPath path) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); // Draw entire background in white context.Graphics.FillRectangle(Brushes.White, rect); @@ -5474,9 +5474,9 @@ private void DrawBackRoundedTopLight(RenderContext context, VisualOrientation orientation, GraphicsPath path) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); // Draw entire background in white - using (var lightBrush = new SolidBrush(ControlPaint.LightLight(backColor1))) + using (SolidBrush lightBrush = new SolidBrush(ControlPaint.LightLight(backColor1))) { context.Graphics.FillRectangle(lightBrush, rect); } @@ -5522,7 +5522,7 @@ private void DrawBackRounded4(RenderContext context, VisualOrientation orientation, GraphicsPath path) { - using var clip = new Clipping(context.Graphics, path); + using Clipping clip = new Clipping(context.Graphics, path); // Use standard helper routine to create appropriate color brush using (Brush backBrush = CreateColorBrush(gradientRect, backColor1, backColor2, backColorStyle, backColorAngle, orientation)) @@ -5530,7 +5530,7 @@ private void DrawBackRounded4(RenderContext context, context.Graphics.FillPath(backBrush, path); } - using (var linePen = new Pen(backColor1)) + using (Pen linePen = new Pen(backColor1)) { // Adjust angle for the orientation switch (orientation) @@ -5565,7 +5565,7 @@ private void DrawBackRounding5(RenderContext context, rect.Inflate(-1, -1); // Prevent drawing over that ourside edge - using var clip = new Clipping(context.Graphics, rect); + using Clipping clip = new Clipping(context.Graphics, rect); // Use standard helper routine to create appropriate color brush using Brush backBrush = CreateColorBrush(gradientRect, backColor1, backColor2, PaletteColorStyle.Rounding5, backColorAngle, @@ -5584,7 +5584,7 @@ private void DrawBackLinearShadow(RenderContext context, GraphicsPath path) { // Prevent drawing over that ourside edge - using var clip = new Clipping(context.Graphics, rect); + using Clipping clip = new Clipping(context.Graphics, rect); // Use standard helper routine to create appropriate color brush using (Brush backBrush = CreateColorBrush(gradientRect, backColor1, backColor2, PaletteColorStyle.Linear, backColorAngle, @@ -5594,7 +5594,7 @@ private void DrawBackLinearShadow(RenderContext context, } // Use path gradient to give the outside of the area a shadow effect - using (var borderBrush = new PathGradientBrush(path)) + using (PathGradientBrush borderBrush = new PathGradientBrush(path)) { borderBrush.Blend = _linearShadowBlend; borderBrush.CenterColor = backColor1; @@ -6146,7 +6146,7 @@ private static void PositionAlignContent([DisallowNull] StandardContentMemento m int spacingGap) { // Create client rectangle covering cell size - var cellRect = new Rectangle(cellX, cellY, cellWidth, cellHeight); + Rectangle cellRect = new Rectangle(cellX, cellY, cellWidth, cellHeight); PaletteRelativeAlign drawHImage = paletteContent.GetContentImageH(state); PaletteRelativeAlign drawVImage = paletteContent.GetContentImageV(state); @@ -6226,7 +6226,7 @@ private static Point PositionCellContent(RightToLeft rtl, int spacingGap, ref Rectangle cellRect) { - var location = Point.Empty; + Point location = Point.Empty; // If drawing from right to left... if (rtl == RightToLeft.Yes) @@ -6491,31 +6491,31 @@ private void DrawDragDockingRoundedMiddle(RenderContext context, { Color borderColor = dragData.ActiveMiddle ? active : border; Color insideColor = dragData.ActiveMiddle ? active : inside; - using var aa = new AntiAlias(context.Graphics); + using AntiAlias aa = new AntiAlias(context.Graphics); using GraphicsPath borderPath = new GraphicsPath(), insidePath = new GraphicsPath(); // Generate the graphics paths for the border and the inside area which is just inside the border Rectangle rect = dragData.RectMiddle; - var rectInside = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 4, rect.Height - 4); + Rectangle rectInside = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 4, rect.Height - 4); DrawDragDockingMiddleLines(borderPath, dragData.RectMiddle, 13); DrawDragDockingMiddleLines(insidePath, rectInside, 9); // Fill the entire border area - using (var borderBrush = new SolidBrush(Color.FromArgb(196, Color.White))) + using (SolidBrush borderBrush = new SolidBrush(Color.FromArgb(196, Color.White))) { context.Graphics.FillPath(borderBrush, borderPath); } // Fill with gradient the area inside the border - var rectBoundsF = new RectangleF(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2); - using (var insideBrush = + RectangleF rectBoundsF = new RectangleF(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2); + using (LinearGradientBrush insideBrush = new LinearGradientBrush(rectBoundsF, Color.FromArgb(196, Color.White), insideColor, 90)) { insideBrush.Blend = _dragRoundedInsideBlend; context.Graphics.FillPath(insideBrush, insidePath); } - using (var borderPen = new Pen(borderColor)) + using (Pen borderPen = new Pen(borderColor)) { // Finally draw the actual border context.Graphics.DrawPath(borderPen, borderPath); @@ -6527,16 +6527,13 @@ private void DrawDragDockingRoundedMiddle(RenderContext context, } } - private void DrawDragDockingMiddleLines(GraphicsPath path, Rectangle rect, int tabExtend) - { - path.AddLines(new Point[] { + private void DrawDragDockingMiddleLines(GraphicsPath path, Rectangle rect, int tabExtend) => path.AddLines(new Point[] { new Point(rect.X, rect.Bottom - 2), new Point(rect.X, rect.Y + 1), new Point(rect.X + 1, rect.Y), new Point(rect.Right - 1, rect.Y), new Point(rect.Right, rect.Y + 1), new Point(rect.Right, rect.Bottom - 6), new Point(rect.Right - 2, rect.Bottom - 4), new Point(rect.X + tabExtend, rect.Bottom - 4), new Point(rect.X + tabExtend, rect.Bottom - 2), new Point(rect.X + tabExtend - 1, rect.Bottom - 1), new Point(rect.X + 1, rect.Bottom - 1), new Point(rect.X, rect.Bottom - 2)}); - } private void DrawDragDockingRoundedRect(RenderContext context, Color inside, @@ -6544,26 +6541,26 @@ private void DrawDragDockingRoundedRect(RenderContext context, Rectangle drawRect, int rounding) { - using var aa = new AntiAlias(context.Graphics); - var rectBoundsF = + using AntiAlias aa = new AntiAlias(context.Graphics); + RectangleF rectBoundsF = new RectangleF(drawRect.X - 1, drawRect.Y - 1, drawRect.Width + 2, drawRect.Height + 1); - var rectInside = + Rectangle rectInside = new Rectangle(drawRect.X + 2, drawRect.Y + 2, drawRect.Width - 4, drawRect.Height - 4); using GraphicsPath borderPath = CreateBorderBackPath(true, true, drawRect, PaletteDrawBorders.All, 1, rounding, true, 0), insidePath = CreateBorderBackPath(true, true, rectInside, PaletteDrawBorders.All, 1, rounding - 1, true, 0); - using (var borderBrush = new SolidBrush(Color.FromArgb(196, Color.White))) + using (SolidBrush borderBrush = new SolidBrush(Color.FromArgb(196, Color.White))) { context.Graphics.FillPath(borderBrush, borderPath); } - using (var insideBrush = + using (LinearGradientBrush insideBrush = new LinearGradientBrush(rectBoundsF, Color.FromArgb(196, Color.White), inside, 90)) { insideBrush.Blend = _dragRoundedInsideBlend; context.Graphics.FillPath(insideBrush, insidePath); } - using (var borderPen = new Pen(border)) + using (Pen borderPen = new Pen(border)) { context.Graphics.DrawPath(borderPen, borderPath); } @@ -6574,7 +6571,7 @@ private void DrawDragDockingArrow(RenderContext context, Rectangle rect, VisualOrientation orientation) { - using var innerPath = new GraphicsPath(); + using GraphicsPath innerPath = new GraphicsPath(); var angle = 0f; switch (orientation) { @@ -6620,13 +6617,13 @@ private void DrawDragDockingArrow(RenderContext context, } // Draw background in white top highlight the arrow - using (var aa = new AntiAlias(context.Graphics)) + using (AntiAlias aa = new AntiAlias(context.Graphics)) { context.Graphics.FillPath(Brushes.White, innerPath); } // Draw the actual arrow itself - using (var innerBrush = + using (LinearGradientBrush innerBrush = new LinearGradientBrush(rect, ControlPaint.Dark(active), ControlPaint.Light(active), angle)) { context.Graphics.FillPath(innerBrush, innerPath); @@ -6685,8 +6682,8 @@ private void DrawDragDockingSquaresBackground(Graphics? g, } Color start = Color.FromArgb(190, 190, 190); - using var borderPen = new Pen(border); - using var insideBrush = new SolidBrush(inside); + using Pen borderPen = new Pen(border); + using SolidBrush insideBrush = new SolidBrush(inside); using LinearGradientBrush gradientLL = new LinearGradientBrush(new Rectangle(-1, -1, 5, 5), start, inside, 0f), gradientTL = new LinearGradientBrush(new Rectangle(-1, 23, 5, 5), start, inside, 90f), @@ -7111,7 +7108,7 @@ private void DrawDragDockingSquaresMiddle(Graphics? g, g.FillRectangle(SystemBrushes.Window, 49, 51, 5, 3); // Fill the inner indicator area - using (var innerBrush = new SolidBrush(Color.FromArgb(64, inactiveColor))) + using (SolidBrush innerBrush = new SolidBrush(Color.FromArgb(64, inactiveColor))) { g.FillRectangle(innerBrush, 34, 36, 19, 13); g.FillRectangle(innerBrush, 34, 49, 7, 3); @@ -7196,10 +7193,10 @@ protected virtual IDisposable DrawRibbonGroupAreaBorder1And2(RenderContext conte // Dispose of existing values cache.Dispose(); - var outsidePath = new GraphicsPath(); - var insidePathN = new GraphicsPath(); - var insidePathL = new GraphicsPath(); - var shadowPath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); + GraphicsPath insidePathN = new GraphicsPath(); + GraphicsPath insidePathL = new GraphicsPath(); + GraphicsPath shadowPath = new GraphicsPath(); // Create path for the entire border outsidePath.AddLine(rect.Left + 2, rect.Top, rect.Right - 3, rect.Top); @@ -7225,12 +7222,12 @@ protected virtual IDisposable DrawRibbonGroupAreaBorder1And2(RenderContext conte shadowPath.AddLine(rect.Right - 4, rect.Bottom, rect.Right, rect.Bottom - 3); shadowPath.AddLine(rect.Right, rect.Bottom - 3, rect.Right, rect.Top + 3); - var insideBrush = new LinearGradientBrush(rect, Color.Transparent, c2, 95f); + LinearGradientBrush insideBrush = new LinearGradientBrush(rect, Color.Transparent, c2, 95f); cache.InsidePen = new Pen(insideBrush); - var rectGradient = new Rectangle(rect.Left - 1, rect.Top, rect.Width + 2, rect.Height + 1); - var shadowBrushN = new LinearGradientBrush(rectGradient, _darken8, _darken38, 90f); - var shadowBrushL = new LinearGradientBrush(rectGradient, _darken8, _darken18, 90f); + Rectangle rectGradient = new Rectangle(rect.Left - 1, rect.Top, rect.Width + 2, rect.Height + 1); + LinearGradientBrush shadowBrushN = new LinearGradientBrush(rectGradient, _darken8, _darken38, 90f); + LinearGradientBrush shadowBrushL = new LinearGradientBrush(rectGradient, _darken8, _darken18, 90f); cache.ShadowPenN = new Pen(shadowBrushN); cache.ShadowPenL = new Pen(shadowBrushL); @@ -7253,12 +7250,12 @@ protected virtual IDisposable DrawRibbonGroupAreaBorder1And2(RenderContext conte context.Graphics.FillPath(cache.FillBrush, cache.OutsidePath); // Clip drawing to the outside border - using (var clip = new Clipping(context.Graphics, cache.OutsidePath)) + using (Clipping clip = new Clipping(context.Graphics, cache.OutsidePath)) { context.Graphics.FillPath(cache.FillTopBrush, cache.OutsidePath); } - using (var aa = new AntiAlias(context.Graphics)) + using (AntiAlias aa = new AntiAlias(context.Graphics)) { // Draw the outside of the entire border line context.Graphics.DrawPath(cache.OutsidePen, cache.OutsidePath); @@ -7400,9 +7397,9 @@ protected virtual IDisposable DrawRibbonGroupAreaBorderContext(RenderContext con // Dispose of existing values cache.Dispose(); - var outsidePath = new GraphicsPath(); - var insidePath = new GraphicsPath(); - var shadowPath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); + GraphicsPath insidePath = new GraphicsPath(); + GraphicsPath shadowPath = new GraphicsPath(); // Create path for the entire border outsidePath.AddLine(rect.Left + 2, rect.Top, rect.Right - 3, rect.Top); @@ -7427,11 +7424,11 @@ protected virtual IDisposable DrawRibbonGroupAreaBorderContext(RenderContext con shadowPath.AddLine(rect.Right - 4, rect.Bottom, rect.Right, rect.Bottom - 3); shadowPath.AddLine(rect.Right, rect.Bottom - 3, rect.Right, rect.Top + 3); - var insideBrush = new LinearGradientBrush(rect, Color.Transparent, c2, 95f); + LinearGradientBrush insideBrush = new LinearGradientBrush(rect, Color.Transparent, c2, 95f); cache.InsidePen = new Pen(insideBrush); - var rectGradient = new Rectangle(rect.Left - 1, rect.Top, rect.Width + 2, rect.Height + 1); - var shadowBrush = new LinearGradientBrush(rectGradient, _darken8, _darken38, 90f); + Rectangle rectGradient = new Rectangle(rect.Left - 1, rect.Top, rect.Width + 2, rect.Height + 1); + LinearGradientBrush shadowBrush = new LinearGradientBrush(rectGradient, _darken8, _darken38, 90f); cache.ShadowPen = new Pen(shadowBrush); cache.FillBrush = new LinearGradientBrush(rect, Color.White, _242, 90f) @@ -7452,12 +7449,12 @@ protected virtual IDisposable DrawRibbonGroupAreaBorderContext(RenderContext con context.Graphics.FillPath(cache.FillBrush, cache.OutsidePath); // Clip drawing to the outside border - using (var clip = new Clipping(context.Graphics, cache.OutsidePath)) + using (Clipping clip = new Clipping(context.Graphics, cache.OutsidePath)) { context.Graphics.FillPath(cache.FillTopBrush, cache.OutsidePath); } - using (var aa = new AntiAlias(context.Graphics)) + using (AntiAlias aa = new AntiAlias(context.Graphics)) { // Draw the outside of the entire border line context.Graphics.DrawPath(cache.OutsidePen, cache.OutsidePath); @@ -7552,7 +7549,7 @@ protected virtual IDisposable DrawRibbonTabTracking2007(PaletteRibbonShape shape } // Draw the actual border - using (var aa = new AntiAlias(context.Graphics)) + using (AntiAlias aa = new AntiAlias(context.Graphics)) { context.Graphics.DrawPath(cache.OutsidePen, cache.OutsidePath); } @@ -7587,7 +7584,7 @@ protected virtual void DrawRibbonTabTrackingTop2007(Rectangle rect, MementoRibbonTabTracking2007 cache) { // Create path for a curved border around the tab - var outsidePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); outsidePath.AddLine(rect.Left + 1, rect.Bottom - 2, rect.Left + 1, rect.Top + 1.5f); outsidePath.AddLine(rect.Left + 1, rect.Top + 1.5f, rect.Left + 3, rect.Top); outsidePath.AddLine(rect.Left + 3, rect.Top, rect.Right - 4, rect.Top); @@ -7595,7 +7592,7 @@ protected virtual void DrawRibbonTabTrackingTop2007(Rectangle rect, outsidePath.AddLine(rect.Right - 2, rect.Top + 1.5f, rect.Right - 2, rect.Bottom - 2); // Create path for the top hightlight line - var topPath = new GraphicsPath(); + GraphicsPath topPath = new GraphicsPath(); topPath.AddLine(rect.Left + 3, rect.Top + 2, rect.Left + 4, rect.Top + 1); topPath.AddLine(rect.Left + 4, rect.Top + 1, rect.Right - 5, rect.Top + 1); topPath.AddLine(rect.Right - 5, rect.Top + 1, rect.Right - 4, rect.Top + 2); @@ -7606,8 +7603,8 @@ protected virtual void DrawRibbonTabTrackingTop2007(Rectangle rect, var half2 = full - half1; cache.Half1Rect = new Rectangle(rect.Left + 3, rect.Top + 2, rect.Width - 6, half1); cache.Half2Rect = new Rectangle(rect.Left + 3, rect.Top + 2 + half1, rect.Width - 6, half2); - var fullRect = new Rectangle(rect.Left + 3, rect.Top + 2, rect.Width - 6, half1 + half2); - var half1RectF = new RectangleF(cache.Half1Rect.Left - 1, cache.Half1Rect.Top - 0.5f, + Rectangle fullRect = new Rectangle(rect.Left + 3, rect.Top + 2, rect.Width - 6, half1 + half2); + RectangleF half1RectF = new RectangleF(cache.Half1Rect.Left - 1, cache.Half1Rect.Top - 0.5f, cache.Half1Rect.Width + 2, cache.Half1Rect.Height + 1); cache.Half2RectF = new RectangleF(cache.Half2Rect.Left - 1, cache.Half2Rect.Top - 0.5f, cache.Half2Rect.Width + 2, cache.Half2Rect.Height + 1); @@ -7626,7 +7623,7 @@ protected virtual void DrawRibbonTabTrackingTop2007(Rectangle rect, cache.EllipseRect = new RectangleF(fullRect.Left - (fullRect.Width / 8), fullRect.Top, fullRect.Width * 1.25f, fullRect.Height); // Cannot draw a path that contains a zero sized element - var ellipsePath = new GraphicsPath(); + GraphicsPath ellipsePath = new GraphicsPath(); if (cache.EllipseRect is { Width: > 0, Height: > 0 }) { ellipsePath.AddEllipse(cache.EllipseRect); @@ -7634,14 +7631,14 @@ protected virtual void DrawRibbonTabTrackingTop2007(Rectangle rect, { CenterColor = Color.FromArgb(92, Color.White) }; - var centerPoint = new PointF(cache.EllipseRect.Left + (cache.EllipseRect.Width / 2), + PointF centerPoint = new PointF(cache.EllipseRect.Left + (cache.EllipseRect.Width / 2), cache.EllipseRect.Top + (cache.EllipseRect.Height / 2)); cache.EllipseBrush.CenterPoint = centerPoint; cache.EllipseBrush.SurroundColors = new[] { Color.Transparent }; } - var vertRectF = new RectangleF(rect.Left - 1, rect.Top + 2, rect.Width + 2, rect.Height - 2); - var horzRectF = new RectangleF(rect.Left + 1, rect.Top, rect.Width - 2, rect.Height); + RectangleF vertRectF = new RectangleF(rect.Left - 1, rect.Top + 2, rect.Width + 2, rect.Height - 2); + RectangleF horzRectF = new RectangleF(rect.Left + 1, rect.Top, rect.Width - 2, rect.Height); cache.OutsideBrush = new LinearGradientBrush(vertRectF, Color.Transparent, _whiten128, 90f) { Blend = _ribbonOutBlend @@ -7683,7 +7680,7 @@ protected virtual void DrawRibbonTabTrackingLeft2007(Rectangle rect, MementoRibbonTabTracking2007 cache) { // Create path for a curved border around the tab - var outsidePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); outsidePath.AddLine(rect.Right - 2, rect.Bottom - 2, rect.Left + 1.5f, rect.Bottom - 2); outsidePath.AddLine(rect.Left + 1.5f, rect.Bottom - 2, rect.Left, rect.Bottom - 4); outsidePath.AddLine(rect.Left, rect.Bottom - 4, rect.Left, rect.Top + 3); @@ -7691,7 +7688,7 @@ protected virtual void DrawRibbonTabTrackingLeft2007(Rectangle rect, outsidePath.AddLine(rect.Left + 1.5f, rect.Top + 1, rect.Right - 2, rect.Top + 1); // Create path for the top hightlight line - var topPath = new GraphicsPath(); + GraphicsPath topPath = new GraphicsPath(); topPath.AddLine(rect.Left + 2, rect.Bottom - 4, rect.Left + 1, rect.Bottom - 5); topPath.AddLine(rect.Left + 1, rect.Bottom - 5, rect.Left + 1, rect.Top + 4); topPath.AddLine(rect.Left + 1, rect.Top + 4, rect.Left + 2, rect.Top + 3); @@ -7702,8 +7699,8 @@ protected virtual void DrawRibbonTabTrackingLeft2007(Rectangle rect, var half2 = full - half1; cache.Half1Rect = new Rectangle(rect.Left + 2, rect.Top + 3, half1, rect.Height - 6); cache.Half2Rect = new Rectangle(rect.Left + 2 + half1, rect.Top + 3, half2, rect.Height - 6); - var fullRect = new Rectangle(rect.Left + 2, rect.Top + 3, half1 + half2, rect.Height - 6); - var half1RectF = new RectangleF(cache.Half1Rect.Left - 0.5f, cache.Half1Rect.Top - 1f, + Rectangle fullRect = new Rectangle(rect.Left + 2, rect.Top + 3, half1 + half2, rect.Height - 6); + RectangleF half1RectF = new RectangleF(cache.Half1Rect.Left - 0.5f, cache.Half1Rect.Top - 1f, cache.Half1Rect.Width + 1, cache.Half1Rect.Height + 2); cache.Half2RectF = new RectangleF(cache.Half2Rect.Left - 0.5f, cache.Half2Rect.Top - 1f, cache.Half2Rect.Width + 1, cache.Half2Rect.Height + 2); @@ -7721,7 +7718,7 @@ protected virtual void DrawRibbonTabTrackingLeft2007(Rectangle rect, // Create ellipse information for lightening the bottom hald cache.EllipseRect = new RectangleF(fullRect.Left, fullRect.Top - (fullRect.Width / 8), fullRect.Width, fullRect.Height * 1.25f); - var ellipsePath = new GraphicsPath(); + GraphicsPath ellipsePath = new GraphicsPath(); // Cannot draw a path that contains a zero sized element if (cache.EllipseRect is { Width: > 0, Height: > 0 }) { @@ -7730,14 +7727,14 @@ protected virtual void DrawRibbonTabTrackingLeft2007(Rectangle rect, { CenterColor = Color.FromArgb(48, Color.White) }; - var centerPoint = new PointF(cache.EllipseRect.Left + (cache.EllipseRect.Width / 2), + PointF centerPoint = new PointF(cache.EllipseRect.Left + (cache.EllipseRect.Width / 2), cache.EllipseRect.Top + (cache.EllipseRect.Height / 2)); cache.EllipseBrush.CenterPoint = centerPoint; cache.EllipseBrush.SurroundColors = new[] { Color.Transparent }; } - var vertRectF = new RectangleF(rect.Left + 2, rect.Top - 1, rect.Width - 2, rect.Height + 2); - var horzRectF = new RectangleF(rect.Left, rect.Top + 1, rect.Width, rect.Height - 2); + RectangleF vertRectF = new RectangleF(rect.Left + 2, rect.Top - 1, rect.Width - 2, rect.Height + 2); + RectangleF horzRectF = new RectangleF(rect.Left, rect.Top + 1, rect.Width, rect.Height - 2); cache.OutsideBrush = new LinearGradientBrush(vertRectF, Color.Transparent, _whiten128, 180f) { Blend = _ribbonOutBlend @@ -7779,7 +7776,7 @@ protected virtual void DrawRibbonTabTrackingRight2007(Rectangle rect, MementoRibbonTabTracking2007 cache) { // Create path for a curved border around the tab - var outsidePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); outsidePath.AddLine(rect.Left + 1, rect.Bottom - 2, rect.Right - 2.5f, rect.Bottom - 2); outsidePath.AddLine(rect.Right - 2.5f, rect.Bottom - 2, rect.Right - 1, rect.Bottom - 4); outsidePath.AddLine(rect.Right - 1, rect.Bottom - 4, rect.Right - 1, rect.Top + 3); @@ -7787,7 +7784,7 @@ protected virtual void DrawRibbonTabTrackingRight2007(Rectangle rect, outsidePath.AddLine(rect.Right - 2.5f, rect.Top + 1, rect.Left + 1, rect.Top + 1); // Create path for the top hightlight line - var topPath = new GraphicsPath(); + GraphicsPath topPath = new GraphicsPath(); topPath.AddLine(rect.Right - 3, rect.Bottom - 4, rect.Right - 2, rect.Bottom - 5); topPath.AddLine(rect.Right - 2, rect.Bottom - 5, rect.Right - 2, rect.Top + 4); topPath.AddLine(rect.Right - 2, rect.Top + 4, rect.Right - 3, rect.Top + 3); @@ -7798,9 +7795,9 @@ protected virtual void DrawRibbonTabTrackingRight2007(Rectangle rect, var half2 = full - half1; cache.Half1Rect = new Rectangle(rect.Right - 2 - half1, rect.Top + 3, half1, rect.Height - 6); cache.Half2Rect = new Rectangle(rect.Right - 2 - half1 - half2, rect.Top + 3, half2, rect.Height - 6); - var fullRect = new Rectangle(rect.Right - 2 - half1 - half2, rect.Top + 3, half1 + half2, + Rectangle fullRect = new Rectangle(rect.Right - 2 - half1 - half2, rect.Top + 3, half1 + half2, rect.Height - 6); - var half1RectF = new RectangleF(cache.Half1Rect.Left - 0.5f, cache.Half1Rect.Top - 1f, + RectangleF half1RectF = new RectangleF(cache.Half1Rect.Left - 0.5f, cache.Half1Rect.Top - 1f, cache.Half1Rect.Width + 1, cache.Half1Rect.Height + 2); cache.Half2RectF = new RectangleF(cache.Half2Rect.Left - 0.5f, cache.Half2Rect.Top - 1f, cache.Half2Rect.Width + 1, cache.Half2Rect.Height + 2); @@ -7818,7 +7815,7 @@ protected virtual void DrawRibbonTabTrackingRight2007(Rectangle rect, // Create ellipse information for lightening the bottom hald cache.EllipseRect = new RectangleF(fullRect.Left, fullRect.Top - (fullRect.Width / 8), fullRect.Width, fullRect.Height * 1.25f); - var ellipsePath = new GraphicsPath(); + GraphicsPath ellipsePath = new GraphicsPath(); // Cannot draw a path that contains a zero sized element if (cache.EllipseRect is { Width: > 0, Height: > 0 }) { @@ -7827,14 +7824,14 @@ protected virtual void DrawRibbonTabTrackingRight2007(Rectangle rect, { CenterColor = Color.FromArgb(48, Color.White) }; - var centerPoint = new PointF(cache.EllipseRect.Left + (cache.EllipseRect.Width / 2), + PointF centerPoint = new PointF(cache.EllipseRect.Left + (cache.EllipseRect.Width / 2), cache.EllipseRect.Top + (cache.EllipseRect.Height / 2)); cache.EllipseBrush.CenterPoint = centerPoint; cache.EllipseBrush.SurroundColors = new[] { Color.Transparent }; } - var vertRectF = new RectangleF(rect.Left, rect.Top - 1, rect.Width - 2, rect.Height + 2); - var horzRectF = new RectangleF(rect.Left, rect.Top + 1, rect.Width, rect.Height - 2); + RectangleF vertRectF = new RectangleF(rect.Left, rect.Top - 1, rect.Width - 2, rect.Height + 2); + RectangleF horzRectF = new RectangleF(rect.Left, rect.Top + 1, rect.Width, rect.Height - 2); cache.OutsideBrush = new LinearGradientBrush(vertRectF, Color.Transparent, _whiten128, 0f) { Blend = _ribbonOutBlend @@ -7876,7 +7873,7 @@ protected virtual void DrawRibbonTabTrackingBottom2007(Rectangle rect, MementoRibbonTabTracking2007 cache) { // Create path for a curved border around the tab - var outsidePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); outsidePath.AddLine(rect.Left + 1, rect.Top + 1, rect.Left + 1, rect.Bottom - 2.5f); outsidePath.AddLine(rect.Left + 1, rect.Bottom - 2.5f, rect.Left + 3, rect.Bottom - 1); outsidePath.AddLine(rect.Left + 3, rect.Bottom - 1, rect.Right - 4, rect.Bottom - 1); @@ -7884,7 +7881,7 @@ protected virtual void DrawRibbonTabTrackingBottom2007(Rectangle rect, outsidePath.AddLine(rect.Right - 2, rect.Bottom - 2.5f, rect.Right - 2, rect.Top + 1); // Create path for the bottom hightlight line - var topPath = new GraphicsPath(); + GraphicsPath topPath = new GraphicsPath(); topPath.AddLine(rect.Left + 3, rect.Bottom - 3, rect.Left + 4, rect.Bottom - 2); topPath.AddLine(rect.Left + 4, rect.Bottom - 2, rect.Right - 5, rect.Bottom - 2); topPath.AddLine(rect.Right - 5, rect.Bottom - 2, rect.Right - 4, rect.Bottom - 3); @@ -7895,9 +7892,9 @@ protected virtual void DrawRibbonTabTrackingBottom2007(Rectangle rect, var half2 = full - half1; cache.Half1Rect = new Rectangle(rect.Left + 3, rect.Bottom - 2 - half1, rect.Width - 6, half1); cache.Half2Rect = new Rectangle(rect.Left + 3, rect.Bottom - 2 - half1 - half2, rect.Width - 6, half2); - var fullRect = new Rectangle(rect.Left + 3, rect.Bottom - 2 - half1 - half2, rect.Width - 6, + Rectangle fullRect = new Rectangle(rect.Left + 3, rect.Bottom - 2 - half1 - half2, rect.Width - 6, half1 + half2); - var half1RectF = new RectangleF(cache.Half1Rect.Left - 1, cache.Half1Rect.Top - 0.5f, + RectangleF half1RectF = new RectangleF(cache.Half1Rect.Left - 1, cache.Half1Rect.Top - 0.5f, cache.Half1Rect.Width + 2, cache.Half1Rect.Height + 1); cache.Half2RectF = new RectangleF(cache.Half2Rect.Left - 1, cache.Half2Rect.Top - 0.5f, cache.Half2Rect.Width + 2, cache.Half2Rect.Height + 1); @@ -7915,7 +7912,7 @@ protected virtual void DrawRibbonTabTrackingBottom2007(Rectangle rect, // Create ellipse information for lightening the bottom hald cache.EllipseRect = new RectangleF(fullRect.Left - (fullRect.Width / 8), fullRect.Top, fullRect.Width * 1.25f, fullRect.Height); - var ellipsePath = new GraphicsPath(); + GraphicsPath ellipsePath = new GraphicsPath(); // Cannot draw a path that contains a zero sized element if (cache.EllipseRect is { Width: > 0, Height: > 0 }) { @@ -7924,14 +7921,14 @@ protected virtual void DrawRibbonTabTrackingBottom2007(Rectangle rect, { CenterColor = Color.FromArgb(92, Color.White) }; - var centerPoint = new PointF(cache.EllipseRect.Left + (cache.EllipseRect.Width / 2), + PointF centerPoint = new PointF(cache.EllipseRect.Left + (cache.EllipseRect.Width / 2), cache.EllipseRect.Bottom - (cache.EllipseRect.Height / 2)); cache.EllipseBrush.CenterPoint = centerPoint; cache.EllipseBrush.SurroundColors = new[] { Color.Transparent }; } - var vertRectF = new RectangleF(rect.Left - 1, rect.Top, rect.Width + 2, rect.Height - 2); - var horzRectF = new RectangleF(rect.Left + 1, rect.Top, rect.Width - 2, rect.Height); + RectangleF vertRectF = new RectangleF(rect.Left - 1, rect.Top, rect.Width + 2, rect.Height - 2); + RectangleF horzRectF = new RectangleF(rect.Left + 1, rect.Top, rect.Width - 2, rect.Height); cache.OutsideBrush = new LinearGradientBrush(vertRectF, Color.Transparent, _whiten128, 270f) { Blend = _ribbonOutBlend @@ -8045,7 +8042,7 @@ protected virtual IDisposable DrawRibbonTabTracking2010(PaletteRibbonShape shape context.Graphics.FillPath(cache.OutsideBrush, cache.OutsidePath); // Draw the border - using (var aa = new AntiAlias(context.Graphics)) + using (AntiAlias aa = new AntiAlias(context.Graphics)) { context.Graphics.DrawPath(cache.OutsidePen, cache.BorderPath); } @@ -8064,9 +8061,9 @@ protected virtual void DrawRibbonTabTrackingTop2010(Rectangle rect, Color c3, Color c4, MementoRibbonTabTracking2010 cache) { - var borderPath = new GraphicsPath(); - var outsidePath = new GraphicsPath(); - var insidePath = new GraphicsPath(); + GraphicsPath borderPath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); + GraphicsPath insidePath = new GraphicsPath(); // Create path for a border pen borderPath.AddLine(rect.Left, rect.Bottom - 2, rect.Left, rect.Top + 1.75f); @@ -8111,9 +8108,9 @@ protected virtual void DrawRibbonTabTrackingBottom2010(Rectangle rect, Color c3, Color c4, MementoRibbonTabTracking2010 cache) { - var borderPath = new GraphicsPath(); - var outsidePath = new GraphicsPath(); - var insidePath = new GraphicsPath(); + GraphicsPath borderPath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); + GraphicsPath insidePath = new GraphicsPath(); // Create path for a border pen borderPath.AddLine(rect.Left, rect.Top, rect.Left, rect.Bottom - 2.75f); @@ -8157,9 +8154,9 @@ protected virtual void DrawRibbonTabTrackingLeft2010(Rectangle rect, Color c3, Color c4, MementoRibbonTabTracking2010 cache) { - var borderPath = new GraphicsPath(); - var outsidePath = new GraphicsPath(); - var insidePath = new GraphicsPath(); + GraphicsPath borderPath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); + GraphicsPath insidePath = new GraphicsPath(); // Create path for a border pen borderPath.AddLine(rect.Right - 1, rect.Top, rect.Left + 1.75f, rect.Top); @@ -8204,9 +8201,9 @@ protected virtual void DrawRibbonTabTrackingRight2010(Rectangle rect, Color c3, Color c4, MementoRibbonTabTracking2010 cache) { - var borderPath = new GraphicsPath(); - var outsidePath = new GraphicsPath(); - var insidePath = new GraphicsPath(); + GraphicsPath borderPath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); + GraphicsPath insidePath = new GraphicsPath(); // Create path for a border pen borderPath.AddLine(rect.Left, rect.Top, rect.Right - 2.75f, rect.Top); @@ -8317,7 +8314,7 @@ protected virtual IDisposable DrawRibbonTabFocus2010(PaletteRibbonShape shape, context.Graphics.FillPath(cache.OutsideBrush, cache.OutsidePath); // Draw the border - using (var aa = new AntiAlias(context.Graphics)) + using (AntiAlias aa = new AntiAlias(context.Graphics)) { context.Graphics.DrawPath(cache.OutsidePen, cache.BorderPath); } @@ -8336,9 +8333,9 @@ protected virtual void DrawRibbonTabFocusTop2010(Rectangle rect, Color c3, Color c4, MementoRibbonTabTracking2010 cache) { - var borderPath = new GraphicsPath(); - var outsidePath = new GraphicsPath(); - var insidePath = new GraphicsPath(); + GraphicsPath borderPath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); + GraphicsPath insidePath = new GraphicsPath(); // Create path for a border pen borderPath.AddLine(rect.Left, rect.Bottom - 1, rect.Left + 1, rect.Bottom - 2); @@ -8389,9 +8386,9 @@ protected virtual void DrawRibbonTabFocusBottom2010(Rectangle rect, Color c3, Color c4, MementoRibbonTabTracking2010 cache) { - var borderPath = new GraphicsPath(); - var outsidePath = new GraphicsPath(); - var insidePath = new GraphicsPath(); + GraphicsPath borderPath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); + GraphicsPath insidePath = new GraphicsPath(); // Create path for a border pen borderPath.AddLine(rect.Left, rect.Top, rect.Left + 1, rect.Top + 1); @@ -8441,9 +8438,9 @@ protected virtual void DrawRibbonTabFocusLeft2010(Rectangle rect, Color c3, Color c4, MementoRibbonTabTracking2010 cache) { - var borderPath = new GraphicsPath(); - var outsidePath = new GraphicsPath(); - var insidePath = new GraphicsPath(); + GraphicsPath borderPath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); + GraphicsPath insidePath = new GraphicsPath(); // Create path for a border pen borderPath.AddLine(rect.Right - 1, rect.Top - 1, rect.Right - 2, rect.Top); @@ -8492,9 +8489,9 @@ protected virtual void DrawRibbonTabFocusRight2010(Rectangle rect, Color c3, Color c4, MementoRibbonTabTracking2010 cache) { - var borderPath = new GraphicsPath(); - var outsidePath = new GraphicsPath(); - var insidePath = new GraphicsPath(); + GraphicsPath borderPath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); + GraphicsPath insidePath = new GraphicsPath(); // Create path for a border pen borderPath.AddLine(rect.Left, rect.Top - 1, rect.Left + 1, rect.Top); @@ -8608,7 +8605,7 @@ protected virtual IDisposable DrawRibbonTabGlowing(PaletteRibbonShape shape, } // Draw the border over the edge of the inside color - using (var aa = new AntiAlias(context.Graphics)) + using (AntiAlias aa = new AntiAlias(context.Graphics)) { context.Graphics.DrawPath(cache.OutsidePen, cache.OutsidePath); } @@ -8633,9 +8630,9 @@ protected virtual void DrawRibbonTabGlowingTop(Rectangle rect, Color c1, Color c2, Color insideColor, MementoRibbonTabGlowing cache) { - var outsidePath = new GraphicsPath(); - var topPath = new GraphicsPath(); - var ellipsePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); + GraphicsPath topPath = new GraphicsPath(); + GraphicsPath ellipsePath = new GraphicsPath(); // Create path for a curved border around the tab outsidePath.AddLine(rect.Left, rect.Bottom - 2, rect.Left, rect.Top + 1.5f); @@ -8654,7 +8651,7 @@ protected virtual void DrawRibbonTabGlowingTop(Rectangle rect, topPath.AddLine(rect.Right - 2, rect.Top + 2 + q4, rect.Right - 2, rect.Top + 2); topPath.AddLine(rect.Right - 2, rect.Top + 2, rect.Right - 3, rect.Top + 1); - var topRectF = new RectangleF(rect.Left, rect.Top, rect.Width, q4 + 5); + RectangleF topRectF = new RectangleF(rect.Left, rect.Top, rect.Width, q4 + 5); cache.TopBrush = new LinearGradientBrush(topRectF, c1, Color.Transparent, 90f); var ellipseWidth = (int)(rect.Width * 1.2f); @@ -8670,7 +8667,7 @@ protected virtual void DrawRibbonTabGlowingTop(Rectangle rect, { CenterColor = c2 }; - var centerPoint = new PointF(cache.EllipseRect.Left + (cache.EllipseRect.Width / 2), + PointF centerPoint = new PointF(cache.EllipseRect.Left + (cache.EllipseRect.Width / 2), cache.EllipseRect.Top + (cache.EllipseRect.Height / 2)); cache.EllipseBrush.CenterPoint = centerPoint; cache.EllipseBrush.SurroundColors = new[] { Color.Transparent }; @@ -8691,9 +8688,9 @@ protected virtual void DrawRibbonTabGlowingLeft(Rectangle rect, Color c1, Color c2, Color insideColor, MementoRibbonTabGlowing cache) { - var outsidePath = new GraphicsPath(); - var topPath = new GraphicsPath(); - var ellipsePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); + GraphicsPath topPath = new GraphicsPath(); + GraphicsPath ellipsePath = new GraphicsPath(); // Create path for a curved border around the tab outsidePath.AddLine(rect.Right - 2, rect.Bottom - 1, rect.Left + 1.5f, rect.Bottom - 1); @@ -8712,7 +8709,7 @@ protected virtual void DrawRibbonTabGlowingLeft(Rectangle rect, topPath.AddLine(rect.Left + 2 + q4, rect.Top + 1, rect.Left + 2, rect.Top + 2); topPath.AddLine(rect.Left + 2, rect.Top + 2, rect.Left + 1, rect.Top + 2); - var topRectF = new RectangleF(rect.Left, rect.Top, q4 + 5, rect.Height); + RectangleF topRectF = new RectangleF(rect.Left, rect.Top, q4 + 5, rect.Height); cache.TopBrush = new LinearGradientBrush(topRectF, c1, Color.Transparent, 0f); var ellipseWidth = (int)(rect.Width * 0.4f); @@ -8728,7 +8725,7 @@ protected virtual void DrawRibbonTabGlowingLeft(Rectangle rect, { CenterColor = c2 }; - var centerPoint = new PointF(cache.EllipseRect.Left + (cache.EllipseRect.Width / 2), + PointF centerPoint = new PointF(cache.EllipseRect.Left + (cache.EllipseRect.Width / 2), cache.EllipseRect.Top + (cache.EllipseRect.Height / 2)); cache.EllipseBrush.CenterPoint = centerPoint; cache.EllipseBrush.SurroundColors = new[] { Color.Transparent }; @@ -8749,9 +8746,9 @@ protected virtual void DrawRibbonTabGlowingRight(Rectangle rect, Color c1, Color c2, Color insideColor, MementoRibbonTabGlowing cache) { - var outsidePath = new GraphicsPath(); - var topPath = new GraphicsPath(); - var ellipsePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); + GraphicsPath topPath = new GraphicsPath(); + GraphicsPath ellipsePath = new GraphicsPath(); // Create path for a curved border around the tab outsidePath.AddLine(rect.Left + 1, rect.Bottom - 1, rect.Right - 2.5f, rect.Bottom - 1); @@ -8770,7 +8767,7 @@ protected virtual void DrawRibbonTabGlowingRight(Rectangle rect, topPath.AddLine(rect.Right - 2 - q4, rect.Top + 1, rect.Right - 2, rect.Top + 2); topPath.AddLine(rect.Right - 2, rect.Top + 2, rect.Right - 1, rect.Top + 2); - var topRectF = new RectangleF(rect.Right - q4 - 5, rect.Top, q4 + 5, rect.Height); + RectangleF topRectF = new RectangleF(rect.Right - q4 - 5, rect.Top, q4 + 5, rect.Height); cache.TopBrush = new LinearGradientBrush(topRectF, c1, Color.Transparent, 180f); var ellipseWidth = (int)(rect.Width * 0.4f); @@ -8786,7 +8783,7 @@ protected virtual void DrawRibbonTabGlowingRight(Rectangle rect, { CenterColor = c2 }; - var centerPoint = new PointF(cache.EllipseRect.Left + (cache.EllipseRect.Width / 2), + PointF centerPoint = new PointF(cache.EllipseRect.Left + (cache.EllipseRect.Width / 2), cache.EllipseRect.Top + (cache.EllipseRect.Height / 2)); cache.EllipseBrush.CenterPoint = centerPoint; cache.EllipseBrush.SurroundColors = new[] { Color.Transparent }; @@ -8807,9 +8804,9 @@ protected virtual void DrawRibbonTabGlowingBottom(Rectangle rect, Color c1, Color c2, Color insideColor, MementoRibbonTabGlowing cache) { - var outsidePath = new GraphicsPath(); - var topPath = new GraphicsPath(); - var ellipsePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); + GraphicsPath topPath = new GraphicsPath(); + GraphicsPath ellipsePath = new GraphicsPath(); // Create path for a curved border around the tab outsidePath.AddLine(rect.Left, rect.Top + 1, rect.Left, rect.Bottom - 2.5f); @@ -8828,7 +8825,7 @@ protected virtual void DrawRibbonTabGlowingBottom(Rectangle rect, topPath.AddLine(rect.Right - 2, rect.Bottom - 2 - q4, rect.Right - 2, rect.Bottom - 2); topPath.AddLine(rect.Right - 2, rect.Bottom - 2, rect.Right - 3, rect.Bottom - 1); - var topRectF = new RectangleF(rect.Left, rect.Bottom - 6 - q4, rect.Width, q4 + 5); + RectangleF topRectF = new RectangleF(rect.Left, rect.Bottom - 6 - q4, rect.Width, q4 + 5); cache.TopBrush = new LinearGradientBrush(topRectF, c1, Color.Transparent, 270f); var ellipseWidth = (int)(rect.Width * 1.2f); @@ -8844,7 +8841,7 @@ protected virtual void DrawRibbonTabGlowingBottom(Rectangle rect, { CenterColor = c2 }; - var centerPoint = new PointF(cache.EllipseRect.Left + (cache.EllipseRect.Width / 2), + PointF centerPoint = new PointF(cache.EllipseRect.Left + (cache.EllipseRect.Width / 2), cache.EllipseRect.Bottom - 1 - (cache.EllipseRect.Height / 2)); cache.EllipseBrush.CenterPoint = centerPoint; cache.EllipseBrush.SurroundColors = new[] { Color.Transparent }; @@ -8926,7 +8923,7 @@ protected virtual IDisposable DrawRibbonTabSelected2007(RenderContext context, context.Graphics.FillPath(cache.InsideBrush, cache.OutsidePath); // Draw the actual border - using (var aa = new AntiAlias(context.Graphics)) + using (AntiAlias aa = new AntiAlias(context.Graphics)) { context.Graphics.DrawPath(cache.OutsidePen, cache.OutsidePath); } @@ -8961,7 +8958,7 @@ protected virtual void DrawRibbonTabSelectedTop2007(Rectangle rect, Color c4, Color c5, MementoRibbonTabSelected2007 cache) { - var outsidePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); // Create path for a curved dark border around the tab outsidePath.AddLine(rect.Left, rect.Bottom - 2, rect.Left + 1, rect.Bottom - 3); @@ -8973,7 +8970,7 @@ protected virtual void DrawRibbonTabSelectedTop2007(Rectangle rect, outsidePath.AddLine(rect.Right - 2, rect.Bottom - 3, rect.Right - 1, rect.Bottom - 2); cache.CenterRect = new Rectangle(rect.Left + 4, rect.Top + 4, rect.Width - 8, rect.Height - 4); - var centerRectF = new RectangleF(cache.CenterRect.Left - 1, cache.CenterRect.Top - 1, + RectangleF centerRectF = new RectangleF(cache.CenterRect.Left - 1, cache.CenterRect.Top - 1, cache.CenterRect.Width + 2, cache.CenterRect.Height + 2); cache.CenterBrush = new LinearGradientBrush(centerRectF, c4, c5, 90f); cache.OutsidePath = outsidePath; @@ -8991,7 +8988,7 @@ protected virtual void DrawRibbonTabSelectedTopDraw2007(Rectangle rect, g.DrawLine(cache.InsidePen, rect.Left + 2, rect.Bottom - 2, rect.Right - 3, rect.Bottom - 2); g.DrawLine(cache.CenterPen, rect.Left + 3, rect.Bottom - 1, rect.Right - 4, rect.Bottom - 1); - using var aa = new AntiAlias(g); + using AntiAlias aa = new AntiAlias(g); // Draw a line on the inside of the left and right border edges g.DrawLine(cache.MiddlePen, rect.Left + 0.5f, rect.Bottom - 1, rect.Left + 2, rect.Bottom - 3); g.DrawLine(cache.MiddlePen, rect.Left + 2, rect.Bottom - 3, rect.Left + 2, rect.Top + 2); @@ -9012,7 +9009,7 @@ protected virtual void DrawRibbonTabSelectedLeft2007(Rectangle rect, Color c4, Color c5, MementoRibbonTabSelected2007 cache) { - var outsidePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); // Create path for a curved dark border around the tab outsidePath.AddLine(rect.Right - 2, rect.Bottom - 1, rect.Right - 3, rect.Bottom - 2); @@ -9024,7 +9021,7 @@ protected virtual void DrawRibbonTabSelectedLeft2007(Rectangle rect, outsidePath.AddLine(rect.Right - 3, rect.Top + 1, rect.Right - 1, rect.Top); cache.CenterRect = new Rectangle(rect.Left + 4, rect.Top + 4, rect.Width - 4, rect.Height - 8); - var centerRectF = new RectangleF(cache.CenterRect.Left - 1, cache.CenterRect.Top - 1, + RectangleF centerRectF = new RectangleF(cache.CenterRect.Left - 1, cache.CenterRect.Top - 1, cache.CenterRect.Width + 2, cache.CenterRect.Height + 2); cache.CenterBrush = new LinearGradientBrush(centerRectF, c4, c5, 0f); cache.OutsidePath = outsidePath; @@ -9042,7 +9039,7 @@ protected virtual void DrawRibbonTabSelectedLeftDraw2007(Rectangle rect, g.DrawLine(cache.InsidePen, rect.Right - 2, rect.Bottom - 3, rect.Right - 2, rect.Top + 2); g.DrawLine(cache.CenterPen, rect.Right - 1, rect.Bottom - 4, rect.Right - 1, rect.Top + 3); - using var aa = new AntiAlias(g); + using AntiAlias aa = new AntiAlias(g); // Draw a line on the inside of the left and right border edges g.DrawLine(cache.MiddlePen, rect.Right - 1, rect.Bottom - 1.5f, rect.Right - 3, rect.Bottom - 3); g.DrawLine(cache.MiddlePen, rect.Right - 3, rect.Bottom - 3, rect.Left + 2, rect.Bottom - 3); @@ -9063,7 +9060,7 @@ protected virtual void DrawRibbonTabSelectedRight2007(Rectangle rect, Color c4, Color c5, MementoRibbonTabSelected2007 cache) { - var outsidePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); // Create path for a curved dark border around the tab outsidePath.AddLine(rect.Left + 1, rect.Bottom - 1, rect.Left + 2, rect.Bottom - 2); @@ -9075,7 +9072,7 @@ protected virtual void DrawRibbonTabSelectedRight2007(Rectangle rect, outsidePath.AddLine(rect.Left + 2, rect.Top + 1, rect.Left, rect.Top); cache.CenterRect = new Rectangle(rect.Left, rect.Top + 4, rect.Width - 4, rect.Height - 8); - var centerRectF = new RectangleF(cache.CenterRect.Left - 1, cache.CenterRect.Top - 1, + RectangleF centerRectF = new RectangleF(cache.CenterRect.Left - 1, cache.CenterRect.Top - 1, cache.CenterRect.Width + 2, cache.CenterRect.Height + 2); cache.CenterBrush = new LinearGradientBrush(centerRectF, c4, c5, 180f); cache.OutsidePath = outsidePath; @@ -9093,7 +9090,7 @@ protected virtual void DrawRibbonTabSelectedRightDraw2007(Rectangle rect, g.DrawLine(cache.InsidePen, rect.Left + 1, rect.Bottom - 3, rect.Left + 1, rect.Top + 2); g.DrawLine(cache.CenterPen, rect.Left, rect.Bottom - 4, rect.Left, rect.Top + 3); - using var aa = new AntiAlias(g); + using AntiAlias aa = new AntiAlias(g); // Draw a line on the inside of the left and right border edges g.DrawLine(cache.MiddlePen, rect.Left, rect.Bottom - 1.5f, rect.Left + 2, rect.Bottom - 3); g.DrawLine(cache.MiddlePen, rect.Left + 2, rect.Bottom - 3, rect.Right - 3, rect.Bottom - 3); @@ -9114,7 +9111,7 @@ protected virtual void DrawRibbonTabSelectedBottom2007(Rectangle rect, Color c4, Color c5, MementoRibbonTabSelected2007 cache) { - var outsidePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); // Create path for a curved dark border around the tab outsidePath.AddLine(rect.Left, rect.Top + 1, rect.Left + 1, rect.Top + 2); @@ -9126,7 +9123,7 @@ protected virtual void DrawRibbonTabSelectedBottom2007(Rectangle rect, outsidePath.AddLine(rect.Right - 2, rect.Top + 2, rect.Right - 1, rect.Top + 1); cache.CenterRect = new Rectangle(rect.Left + 4, rect.Top, rect.Width - 8, rect.Height - 4); - var centerRectF = new RectangleF(cache.CenterRect.Left - 1, cache.CenterRect.Top - 1, + RectangleF centerRectF = new RectangleF(cache.CenterRect.Left - 1, cache.CenterRect.Top - 1, cache.CenterRect.Width + 2, cache.CenterRect.Height + 2); cache.CenterBrush = new LinearGradientBrush(centerRectF, c4, c5, 270f); cache.OutsidePath = outsidePath; @@ -9144,7 +9141,7 @@ protected virtual void DrawRibbonTabSelectedBottomDraw2007(Rectangle rect, g.DrawLine(cache.InsidePen, rect.Left + 2, rect.Top + 1, rect.Right - 3, rect.Top + 1); g.DrawLine(cache.CenterPen, rect.Left + 3, rect.Top, rect.Right - 4, rect.Top); - using var aa = new AntiAlias(g); + using AntiAlias aa = new AntiAlias(g); // Draw a line on the inside of the left and right border edges g.DrawLine(cache.MiddlePen, rect.Left + 0.5f, rect.Top, rect.Left + 2, rect.Top + 2); g.DrawLine(cache.MiddlePen, rect.Left + 2, rect.Top + 2, rect.Left + 2, rect.Bottom - 3); @@ -9238,7 +9235,7 @@ protected virtual IDisposable DrawRibbonTabSelected2010(RenderContext context, context.Graphics.FillPath(cache.InsideBrush, cache.InsidePath); } - using (var aa = new AntiAlias(context.Graphics)) + using (AntiAlias aa = new AntiAlias(context.Graphics)) { context.Graphics.DrawPath(cache.OutsidePen, cache.OutsidePath); } @@ -9270,8 +9267,8 @@ protected virtual void DrawRibbonTabSelectedTop2010(Rectangle rect, Color c2, Color c3, Color c5, MementoRibbonTabSelected2010 cache) { - var outsidePath = new GraphicsPath(); - var insidePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); + GraphicsPath insidePath = new GraphicsPath(); // Create path for a curved dark border around the tab outsidePath.AddLine(rect.Left, rect.Bottom - 2, rect.Left + 1, rect.Bottom - 3); @@ -9282,7 +9279,7 @@ protected virtual void DrawRibbonTabSelectedTop2010(Rectangle rect, outsidePath.AddLine(rect.Right - 2, rect.Top + 1, rect.Right - 2, rect.Bottom - 3); outsidePath.AddLine(rect.Right - 2, rect.Bottom - 3, rect.Right - 1, rect.Bottom - 2); - var centerRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); + RectangleF centerRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); cache.CenterBrush = new LinearGradientBrush(centerRectF, c2, c3, 90f) { Blend = _ribbonTabSelected1Blend @@ -9304,7 +9301,7 @@ protected virtual void DrawRibbonTabSelectedTop2010(Rectangle rect, insidePath.AddLine(rect.Right - 2, rect.Top + 1, rect.Right - 2, rect.Bottom - 3); insidePath.AddLine(rect.Right - 2, rect.Bottom - 3, rect.Right - 1, rect.Bottom - 2); - var insideRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); + RectangleF insideRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); cache.InsideBrush = new LinearGradientBrush(insideRectF, Color.FromArgb(32, c5), Color.Transparent, 90f) { Blend = _ribbonTabSelected2Blend @@ -9323,7 +9320,7 @@ protected virtual void DrawRibbonTabSelectedTopDraw2010(Rectangle rect, g.DrawLine(cache.CenterPen, rect.Left + 2, rect.Bottom - 2, rect.Right - 3, rect.Bottom - 2); g.DrawLine(cache.CenterPen, rect.Left + 1, rect.Bottom - 1, rect.Right - 2, rect.Bottom - 1); - using var aa = new AntiAlias(g); + using AntiAlias aa = new AntiAlias(g); // Draw shadow lines on the outside of the left and right edges g.DrawLine(_mediumShadowPen, rect.Left, rect.Bottom - 3, rect.Left, rect.Top + 2); g.DrawLine(_mediumShadowPen, rect.Right - 1, rect.Bottom - 3, rect.Right - 1, rect.Top + 2); @@ -9336,8 +9333,8 @@ protected virtual void DrawRibbonTabSelectedLeft2010(Rectangle rect, Color c2, Color c3, Color c5, MementoRibbonTabSelected2010 cache) { - var outsidePath = new GraphicsPath(); - var insidePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); + GraphicsPath insidePath = new GraphicsPath(); // Create path for a curved dark border around the tab outsidePath.AddLine(rect.Right - 2, rect.Bottom - 1, rect.Right - 2, rect.Bottom - 2); @@ -9348,7 +9345,7 @@ protected virtual void DrawRibbonTabSelectedLeft2010(Rectangle rect, outsidePath.AddLine(rect.Left + 1, rect.Top + 1, rect.Right - 2, rect.Top + 1); outsidePath.AddLine(rect.Right - 2, rect.Top + 1, rect.Right - 2, rect.Top); - var centerRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); + RectangleF centerRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); cache.CenterBrush = new LinearGradientBrush(centerRectF, c2, c3, 0f) { Blend = _ribbonTabSelected1Blend @@ -9370,7 +9367,7 @@ protected virtual void DrawRibbonTabSelectedLeft2010(Rectangle rect, insidePath.AddLine(rect.Left + 1, rect.Top + 1, rect.Right - 2, rect.Top + 1); insidePath.AddLine(rect.Right - 2, rect.Top + 1, rect.Right - 2, rect.Top); - var insideRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); + RectangleF insideRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); cache.InsideBrush = new LinearGradientBrush(insideRectF, Color.FromArgb(32, c5), Color.Transparent, 0f) { Blend = _ribbonTabSelected2Blend @@ -9389,7 +9386,7 @@ protected virtual void DrawRibbonTabSelectedLeftDraw2010(Rectangle rect, g.DrawLine(cache.CenterPen, rect.Right - 2, rect.Bottom - 3, rect.Right - 2, rect.Top + 2); g.DrawLine(cache.CenterPen, rect.Right - 1, rect.Bottom - 2, rect.Right - 1, rect.Top + 1); - using var aa = new AntiAlias(g); + using AntiAlias aa = new AntiAlias(g); // Draw shadow lines on the outside of the top and bottom edges g.DrawLine(_mediumShadowPen, rect.Right - 3, rect.Bottom - 1, rect.Left + 3, rect.Bottom - 1); g.DrawLine(_mediumShadowPen, rect.Right - 3, rect.Top, rect.Left + 3, rect.Top); @@ -9402,8 +9399,8 @@ protected virtual void DrawRibbonTabSelectedRight2010(Rectangle rect, Color c2, Color c3, Color c5, MementoRibbonTabSelected2010 cache) { - var outsidePath = new GraphicsPath(); - var insidePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); + GraphicsPath insidePath = new GraphicsPath(); // Create path for a curved dark border around the tab outsidePath.AddLine(rect.Left + 1, rect.Bottom - 1, rect.Left + 1, rect.Bottom - 2); @@ -9414,7 +9411,7 @@ protected virtual void DrawRibbonTabSelectedRight2010(Rectangle rect, outsidePath.AddLine(rect.Right - 2, rect.Top + 1, rect.Left + 1, rect.Top + 1); outsidePath.AddLine(rect.Left + 1, rect.Top + 1, rect.Left + 1, rect.Top); - var centerRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); + RectangleF centerRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); cache.CenterBrush = new LinearGradientBrush(centerRectF, c2, c3, 180f) { Blend = _ribbonTabSelected1Blend @@ -9435,7 +9432,7 @@ protected virtual void DrawRibbonTabSelectedRight2010(Rectangle rect, insidePath.AddLine(rect.Right - 2, rect.Top + 1, rect.Left + 1, rect.Top + 1); insidePath.AddLine(rect.Left + 1, rect.Top + 1, rect.Left + 1, rect.Top); - var insideRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); + RectangleF insideRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); cache.InsideBrush = new LinearGradientBrush(insideRectF, Color.FromArgb(32, c5), Color.Transparent, 180f) { Blend = _ribbonTabSelected2Blend @@ -9455,7 +9452,7 @@ protected virtual void DrawRibbonTabSelectedRightDraw2010(Rectangle rect, g.DrawLine(cache.CenterPen, rect.Left + 1, rect.Bottom - 3, rect.Left + 1, rect.Top + 2); g.DrawLine(cache.CenterPen, rect.Left, rect.Bottom - 2, rect.Left, rect.Top + 1); - using var aa = new AntiAlias(g); + using AntiAlias aa = new AntiAlias(g); // Draw shadow lines on the outside of the top and bottom edges g.DrawLine(_mediumShadowPen, rect.Left + 2, rect.Bottom - 1, rect.Right - 4, rect.Bottom - 1); g.DrawLine(_mediumShadowPen, rect.Left + 2, rect.Top, rect.Right - 4, rect.Top); @@ -9468,8 +9465,8 @@ protected virtual void DrawRibbonTabSelectedBottom2010(Rectangle rect, Color c2, Color c3, Color c5, MementoRibbonTabSelected2010 cache) { - var outsidePath = new GraphicsPath(); - var insidePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); + GraphicsPath insidePath = new GraphicsPath(); // Create path for a curved dark border around the tab outsidePath.AddLine(rect.Left, rect.Top + 1, rect.Left + 1, rect.Top + 1); @@ -9480,7 +9477,7 @@ protected virtual void DrawRibbonTabSelectedBottom2010(Rectangle rect, outsidePath.AddLine(rect.Right - 2, rect.Bottom - 3, rect.Right - 2, rect.Top + 1); outsidePath.AddLine(rect.Right - 2, rect.Top + 1, rect.Right - 1, rect.Top + 1); - var centerRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); + RectangleF centerRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); cache.CenterBrush = new LinearGradientBrush(centerRectF, c2, c3, 270f) { Blend = _ribbonTabSelected1Blend @@ -9501,7 +9498,7 @@ protected virtual void DrawRibbonTabSelectedBottom2010(Rectangle rect, insidePath.AddLine(rect.Right - 2, rect.Bottom - 3, rect.Right - 2, rect.Top + 1); insidePath.AddLine(rect.Right - 2, rect.Top + 1, rect.Right - 1, rect.Top + 1); - var insideRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); + RectangleF insideRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); cache.InsideBrush = new LinearGradientBrush(insideRectF, Color.FromArgb(32, c5), Color.Transparent, 270f) { Blend = _ribbonTabSelected2Blend @@ -9520,7 +9517,7 @@ protected virtual void DrawRibbonTabSelectedBottomDraw2010(Rectangle rect, g.DrawLine(cache.CenterPen, rect.Left + 2, rect.Top + 1, rect.Right - 3, rect.Top + 1); g.DrawLine(cache.CenterPen, rect.Left + 1, rect.Top, rect.Right - 2, rect.Top); - using var aa = new AntiAlias(g); + using AntiAlias aa = new AntiAlias(g); // Draw shadow lines on the outside of the left and right edges g.DrawLine(_mediumShadowPen, rect.Left, rect.Top + 2, rect.Left, rect.Bottom - 4); g.DrawLine(_mediumShadowPen, rect.Right - 1, rect.Top + 2, rect.Right - 1, rect.Bottom - 4); @@ -9594,7 +9591,7 @@ protected virtual IDisposable DrawRibbonTabContextSelected(PaletteRibbonShape sh context.Graphics.FillRectangle(cache.InsideBrush, cache.InteriorRect); // Draw the actual border - using (var aa = new AntiAlias(context.Graphics)) + using (AntiAlias aa = new AntiAlias(context.Graphics)) { context.Graphics.DrawPath(cache.OutsidePen, cache.OutsidePath); } @@ -9626,7 +9623,7 @@ protected virtual void DrawRibbonTabContextSelectedTop(Rectangle rect, Color c2, MementoRibbonTabContextSelected cache) { - var outsidePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); // Create path for a curved dark border around the tab outsidePath.AddLine(rect.Left, rect.Bottom - 2, rect.Left + 1, rect.Bottom - 3); @@ -9637,9 +9634,9 @@ protected virtual void DrawRibbonTabContextSelectedTop(Rectangle rect, outsidePath.AddLine(rect.Right - 2, rect.Top + 1.5f, rect.Right - 2, rect.Bottom - 3); outsidePath.AddLine(rect.Right - 2, rect.Bottom - 3, rect.Right - 1, rect.Bottom - 2); - var leftBrush = + LinearGradientBrush leftBrush = new LinearGradientBrush(rect, Color.FromArgb(125, c2), Color.FromArgb(67, c2), 90f); - var rightBrush = + LinearGradientBrush rightBrush = new LinearGradientBrush(rect, Color.FromArgb(16, c2), Color.FromArgb(67, c2), 90f); cache.LeftPen = new Pen(leftBrush); cache.RightPen = new Pen(rightBrush); @@ -9683,7 +9680,7 @@ protected virtual void DrawRibbonTabContextSelectedLeft(Rectangle rect, Color c2, MementoRibbonTabContextSelected cache) { - var outsidePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); // Create path for a curved dark border around the tab outsidePath.AddLine(rect.Right - 2, rect.Bottom - 1, rect.Right - 3, rect.Bottom - 2); @@ -9694,9 +9691,9 @@ protected virtual void DrawRibbonTabContextSelectedLeft(Rectangle rect, outsidePath.AddLine(rect.Left + 1.5f, rect.Top + 1, rect.Right - 3, rect.Top + 1); outsidePath.AddLine(rect.Right - 3, rect.Top + 1, rect.Right - 2, rect.Top); - var leftBrush = + LinearGradientBrush leftBrush = new LinearGradientBrush(rect, Color.FromArgb(125, c2), Color.FromArgb(67, c2), 0f); - var rightBrush = + LinearGradientBrush rightBrush = new LinearGradientBrush(rect, Color.FromArgb(16, c2), Color.FromArgb(67, c2), 0f); cache.LeftPen = new Pen(leftBrush); cache.RightPen = new Pen(rightBrush); @@ -9740,7 +9737,7 @@ protected virtual void DrawRibbonTabContextSelectedRight(Rectangle rect, Color c2, MementoRibbonTabContextSelected cache) { - var outsidePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); // Create path for a curved dark border around the tab outsidePath.AddLine(rect.Left + 1, rect.Bottom - 1, rect.Left + 2, rect.Bottom - 2); @@ -9751,9 +9748,9 @@ protected virtual void DrawRibbonTabContextSelectedRight(Rectangle rect, outsidePath.AddLine(rect.Right - 2.5f, rect.Top + 1, rect.Left + 2, rect.Top + 1); outsidePath.AddLine(rect.Left + 2, rect.Top + 1, rect.Left + 1, rect.Top); - var leftBrush = + LinearGradientBrush leftBrush = new LinearGradientBrush(rect, Color.FromArgb(125, c2), Color.FromArgb(67, c2), 180f); - var rightBrush = + LinearGradientBrush rightBrush = new LinearGradientBrush(rect, Color.FromArgb(16, c2), Color.FromArgb(67, c2), 180f); cache.LeftPen = new Pen(leftBrush); cache.RightPen = new Pen(rightBrush); @@ -9797,7 +9794,7 @@ protected virtual void DrawRibbonTabContextSelectedBottom(Rectangle rect, Color c2, MementoRibbonTabContextSelected cache) { - var outsidePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); // Create path for a curved dark border around the tab outsidePath.AddLine(rect.Left, rect.Top + 1, rect.Left + 1, rect.Top + 2); @@ -9808,9 +9805,9 @@ protected virtual void DrawRibbonTabContextSelectedBottom(Rectangle rect, outsidePath.AddLine(rect.Right - 2, rect.Bottom - 2.5f, rect.Right - 2, rect.Top + 2); outsidePath.AddLine(rect.Right - 2, rect.Top + 2, rect.Right - 1, rect.Top + 1); - var leftBrush = + LinearGradientBrush leftBrush = new LinearGradientBrush(rect, Color.FromArgb(125, c2), Color.FromArgb(67, c2), 270f); - var rightBrush = + LinearGradientBrush rightBrush = new LinearGradientBrush(rect, Color.FromArgb(16, c2), Color.FromArgb(67, c2), 270f); cache.LeftPen = new Pen(leftBrush); cache.RightPen = new Pen(rightBrush); @@ -9941,8 +9938,8 @@ protected virtual void DrawRibbonTabHighlightTop(Rectangle rect, Color c4, Color c5, MementoRibbonTabHighlight cache) { - var hF = new RectangleF(rect.Left - 2, rect.Top - 1, rect.Width + 4, 6); - var vF = new RectangleF(rect.Left - 2, rect.Top + 1, rect.Width + 4, rect.Height - 1); + RectangleF hF = new RectangleF(rect.Left - 2, rect.Top - 1, rect.Width + 4, 6); + RectangleF vF = new RectangleF(rect.Left - 2, rect.Top + 1, rect.Width + 4, rect.Height - 1); cache.TopBorderBrush = new LinearGradientBrush(hF, Color.FromArgb(48, c5), Color.FromArgb(64, c5), 90f); cache.BorderVertBrush = new LinearGradientBrush(vF, c5, c4, 90f); cache.OutsideVertBrush = new LinearGradientBrush(vF, Color.FromArgb(48, c5), c5, 90f); @@ -9990,8 +9987,8 @@ protected virtual void DrawRibbonTabHighlightLeft(Rectangle rect, Color c4, Color c5, MementoRibbonTabHighlight cache) { - var hF = new RectangleF(rect.Left - 1, rect.Top - 2, 6, rect.Height - 4); - var vF = new RectangleF(rect.Left + 1, rect.Top - 2, rect.Width - 1, rect.Height - 4); + RectangleF hF = new RectangleF(rect.Left - 1, rect.Top - 2, 6, rect.Height - 4); + RectangleF vF = new RectangleF(rect.Left + 1, rect.Top - 2, rect.Width - 1, rect.Height - 4); cache.TopBorderBrush = new LinearGradientBrush(hF, Color.FromArgb(48, c5), Color.FromArgb(64, c5), 0f); cache.BorderVertBrush = new LinearGradientBrush(vF, c5, c4, 0f); cache.OutsideVertBrush = new LinearGradientBrush(vF, Color.FromArgb(48, c5), c5, 0f); @@ -10039,8 +10036,8 @@ protected virtual void DrawRibbonTabHighlightRight(Rectangle rect, Color c4, Color c5, MementoRibbonTabHighlight cache) { - var hF = new RectangleF(rect.Right - 6, rect.Top - 2, 6, rect.Height - 4); - var vF = new RectangleF(rect.Left, rect.Top - 2, rect.Width - 1, rect.Height - 4); + RectangleF hF = new RectangleF(rect.Right - 6, rect.Top - 2, 6, rect.Height - 4); + RectangleF vF = new RectangleF(rect.Left, rect.Top - 2, rect.Width - 1, rect.Height - 4); cache.TopBorderBrush = new LinearGradientBrush(hF, Color.FromArgb(48, c5), Color.FromArgb(64, c5), 180f); cache.BorderVertBrush = new LinearGradientBrush(vF, c5, c4, 180f); cache.OutsideVertBrush = new LinearGradientBrush(vF, Color.FromArgb(48, c5), c5, 180f); @@ -10088,8 +10085,8 @@ protected virtual void DrawRibbonTabHighlightBottom(Rectangle rect, Color c4, Color c5, MementoRibbonTabHighlight cache) { - var hF = new RectangleF(rect.Left - 2, rect.Bottom - 6, rect.Width + 4, 6); - var vF = new RectangleF(rect.Left - 2, rect.Top, rect.Width + 4, rect.Height - 1); + RectangleF hF = new RectangleF(rect.Left - 2, rect.Bottom - 6, rect.Width + 4, 6); + RectangleF vF = new RectangleF(rect.Left - 2, rect.Top, rect.Width + 4, rect.Height - 1); cache.TopBorderBrush = new LinearGradientBrush(hF, Color.FromArgb(48, c5), Color.FromArgb(64, c5), 270f); cache.BorderVertBrush = new LinearGradientBrush(vF, c5, c4, 270f); cache.OutsideVertBrush = new LinearGradientBrush(vF, Color.FromArgb(48, c5), c5, 270f); @@ -10167,16 +10164,16 @@ protected virtual IDisposable DrawRibbonTabContext(RenderContext context, // Dispose of existing values cache.Dispose(); - var borderRect = new Rectangle(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2); + Rectangle borderRect = new Rectangle(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2); cache.FillRect = new Rectangle(rect.X + 1, rect.Y, rect.Width - 2, rect.Height - 1); - var borderBrush = new LinearGradientBrush(borderRect, c1, Color.Transparent, 270f) + LinearGradientBrush borderBrush = new LinearGradientBrush(borderRect, c1, Color.Transparent, 270f) { Blend = _ribbonGroup5Blend }; cache.BorderPen = new Pen(borderBrush); - var underlineBrush = + LinearGradientBrush underlineBrush = new LinearGradientBrush(borderRect, Color.Transparent, Color.FromArgb(200, c2), 0f) { Blend = _ribbonGroup7Blend @@ -10273,7 +10270,7 @@ protected virtual IDisposable DrawRibbonAppButton(PaletteRibbonShape shape, cache.BrushLower = new LinearGradientBrush(cache.RectLower, Color.Transparent, Color.Transparent, LinearGradientMode.Horizontal); } - using var aa = new AntiAlias(context.Graphics); + using AntiAlias aa = new AntiAlias(context.Graphics); DrawRibbonAppButtonBorder1(context.Graphics, cache); DrawRibbonAppButtonUpperHalf(context.Graphics, cache, state, topDark, bottomDark, topLight, topMedium, trackBorderAsPressed); DrawRibbonAppButtonLowerHalf(context.Graphics, cache, state, bottomDark, bottomLight, bottomMedium); @@ -10322,7 +10319,7 @@ protected virtual void DrawRibbonAppButtonUpperHalf(Graphics? g, Color[] colorsUpperHalf = { topDark, topMedium, topLight, topLight, topMedium, topDark }; float[] posUpperHalf = { 0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0f }; - var blendUpperHalf = new ColorBlend + ColorBlend blendUpperHalf = new ColorBlend { Colors = colorsUpperHalf, Positions = posUpperHalf @@ -10347,7 +10344,7 @@ protected virtual void DrawRibbonAppButtonUpperHalf(Graphics? g, c2 = topDark; } - using var brushUpper2 = + using LinearGradientBrush brushUpper2 = new LinearGradientBrush(memento.Rect, c1, c2, LinearGradientMode.Vertical); g.FillPie(brushUpper2, memento.Rect.X, memento.Rect.Y, memento.Rect.Width, memento.Rect.Height, 180, 180); } @@ -10368,7 +10365,7 @@ protected virtual void DrawRibbonAppButtonLowerHalf(Graphics? g, ? new[] { 0.0f, 0.3f, 0.5f, 0.5f, 0.7f, 1.0f } : new[] { 0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0f }; - var blendLowerHalf = new ColorBlend + ColorBlend blendLowerHalf = new ColorBlend { Colors = colorsLowerHalf, Positions = posLowerHalf @@ -10387,7 +10384,7 @@ protected virtual void DrawRibbonAppButtonGlowCenter(Graphics? g, Color topLight, Color bottomLight) { - using var brushBottomGlow = new LinearGradientBrush(memento.RectBottomGlow, + using LinearGradientBrush brushBottomGlow = new LinearGradientBrush(memento.RectBottomGlow, Color.FromArgb(50, Color.White), Color.FromArgb(30, Color.White), LinearGradientMode.Vertical); RectangleF rectBottomGlow = memento.RectBottomGlow; rectBottomGlow.X = memento.Rect.X + ((memento.Rect.Width - rectBottomGlow.Width) / 2); @@ -10405,9 +10402,9 @@ protected virtual void DrawRibbonAppButtonGlowCenter(Graphics? g, rectBottomGlow.X = memento.Rect.X + ((memento.Rect.Width - rectBottomGlow.Width) / 2); rectBottomGlow.Y = memento.Rect.Y + (memento.Rect.Height - rectBottomGlow.Height); - using var path = new GraphicsPath(); + using GraphicsPath path = new GraphicsPath(); path.AddEllipse(rectBottomGlow); - using var pathGradient = new PathGradientBrush(path); + using PathGradientBrush pathGradient = new PathGradientBrush(path); pathGradient.CenterColor = topLight; pathGradient.SurroundColors = new[] { Color.FromArgb(100, bottomLight) }; g.FillEllipse(pathGradient, rectBottomGlow); @@ -10433,7 +10430,7 @@ protected virtual void DrawRibbonAppButtonGlowUpperBottom(Graphics? g, mediumTransparency = 200; } - using var brushUpperGlow = new LinearGradientBrush(memento.RectUpperGlow, Color.Transparent, + using LinearGradientBrush brushUpperGlow = new LinearGradientBrush(memento.RectUpperGlow, Color.Transparent, Color.Transparent, LinearGradientMode.Horizontal); Color[] colorsUpperGlow = { Color.FromArgb(180, bottomDark), Color.FromArgb(mediumTransparency, bottomMedium), @@ -10444,7 +10441,7 @@ protected virtual void DrawRibbonAppButtonGlowUpperBottom(Graphics? g, float[] posUpperGlow = { 0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0f }; - var blendUpperGlow = new ColorBlend + ColorBlend blendUpperGlow = new ColorBlend { Colors = colorsUpperGlow, Positions = posUpperGlow @@ -10487,12 +10484,12 @@ protected virtual void DrawRibbonAppButtonBorder2(Graphics? g, borderGlowColor = _whiten120; } - using (var p = new Pen(borderGlowColor)) + using (Pen p = new Pen(borderGlowColor)) { g.DrawEllipse(p, memento.BorderMain1); } - using (var p = new Pen(Color.FromArgb(100, 52, 59, 64))) + using (Pen p = new Pen(Color.FromArgb(100, 52, 59, 64))) { g.DrawEllipse(p, memento.Rect); } @@ -10500,12 +10497,12 @@ protected virtual void DrawRibbonAppButtonBorder2(Graphics? g, if (pressed) { borderGlowColor = _whiten60; - using var p = new Pen(borderGlowColor); + using Pen p = new Pen(borderGlowColor); g.DrawEllipse(p, memento.BorderMain3); } borderGlowColor = pressed ? _whiten50 : _whiten80; - using (var p = new Pen(borderGlowColor)) + using (Pen p = new Pen(borderGlowColor)) { g.DrawArc(p, memento.BorderMain2, 180, 180); } @@ -10513,13 +10510,13 @@ protected virtual void DrawRibbonAppButtonBorder2(Graphics? g, if (!pressed) { borderGlowColor = _whiten30; - using var p = new Pen(borderGlowColor); + using Pen p = new Pen(borderGlowColor); g.DrawArc(p, memento.BorderMain4, 180, 180); } if (tracking && !pressed) { - using var p = new Pen(Color.FromArgb(100, borderGlowColor)); + using Pen p = new Pen(Color.FromArgb(100, borderGlowColor)); g.DrawEllipse(p, memento.Rect); } } @@ -10614,7 +10611,7 @@ protected virtual IDisposable DrawRibbonAppTab(PaletteRibbonShape shape, context.Graphics.FillPath(cache.BorderBrush, cache.BorderFillPath); // Draw the outside border - using (var aa = new AntiAlias(context.Graphics)) + using (AntiAlias aa = new AntiAlias(context.Graphics)) { context.Graphics.DrawPath(cache.BorderPen, cache.BorderPath); } @@ -10623,7 +10620,7 @@ protected virtual IDisposable DrawRibbonAppTab(PaletteRibbonShape shape, context.Graphics.FillPath(cache.InsideFillBrush, cache.InsideFillPath); // Draw highlight over bottom half - using (var clip = new Clipping(context.Graphics, cache.InsideFillPath)) + using (Clipping clip = new Clipping(context.Graphics, cache.InsideFillPath)) { context.Graphics.FillPath(cache.HighlightBrush, cache.HighlightPath); } @@ -10676,7 +10673,7 @@ protected virtual IDisposable DrawRibbonGroupNormal(bool showingInPopup, // Dispose of existing values cache.Dispose(); - var trackingPath = new GraphicsPath(); + GraphicsPath trackingPath = new GraphicsPath(); trackingPath.AddEllipse(new Rectangle(rect.X, rect.Y + (rect.Height / 2), rect.Width - 3, rect.Height)); cache.TrackHighlightBrush = new PathGradientBrush(trackingPath) { @@ -10757,10 +10754,10 @@ protected virtual IDisposable DrawRibbonGroupNormal(bool showingInPopup, // Dispose of existing values cache.Dispose(); - var solidPath = new GraphicsPath(); - var insidePath = new GraphicsPath(); - var outsidePath = new GraphicsPath(); - var lightPath = new GraphicsPath(); + GraphicsPath solidPath = new GraphicsPath(); + GraphicsPath insidePath = new GraphicsPath(); + GraphicsPath outsidePath = new GraphicsPath(); + GraphicsPath lightPath = new GraphicsPath(); // Create the rounded complete border solidPath.AddLine(rect.Left + 2, rect.Top, rect.Right - 4, rect.Top); @@ -10792,8 +10789,8 @@ protected virtual IDisposable DrawRibbonGroupNormal(bool showingInPopup, lightPath.AddLine(rect.Left + 1, rect.Bottom - 4, rect.Left + 1, rect.Top + 2); lightPath.AddLine(rect.Left + 1, rect.Top + 2, rect.Left + 2, rect.Top + 1); - var solidRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); - var solidBrush = new LinearGradientBrush(solidRectF, c1, c2, 90f); + RectangleF solidRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); + LinearGradientBrush solidBrush = new LinearGradientBrush(solidRectF, c1, c2, 90f); cache.SolidPen = new Pen(solidBrush); cache.BackRect = new Rectangle(rect.Left + 2, rect.Top + 1, rect.Width - 4, rect.Height - 4); @@ -10809,7 +10806,7 @@ protected virtual IDisposable DrawRibbonGroupNormal(bool showingInPopup, context.Graphics.FillRectangle(lightInside ? _whitenLightLBrush : _whitenLightBrush, cache.BackRect); } - using (var aa = new AntiAlias(context.Graphics)) + using (AntiAlias aa = new AntiAlias(context.Graphics)) { // Draw the solid border context.Graphics.DrawPath(cache.SolidPen, cache.SolidPath); @@ -10877,7 +10874,7 @@ protected virtual IDisposable DrawRibbonGroupNormalBorderSep(bool showingInPopup // Dispose of existing values cache.Dispose(); - var rectF = new RectangleF(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2); + RectangleF rectF = new RectangleF(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2); cache.TotalBrush = new LinearGradientBrush(rectF, c2, c1, 90f); cache.InnerBrush = new LinearGradientBrush(rectF, c4, c3, 90f); @@ -10956,7 +10953,7 @@ protected virtual IDisposable DrawRibbonGroupNormalTitle(RenderContext context, // Dispose of existing values cache.Dispose(); - var titlePath = new GraphicsPath(); + GraphicsPath titlePath = new GraphicsPath(); // Create the rounded bottom edge to fit inside a group border titlePath.AddLine(rect.Left, rect.Top, rect.Right - 1, rect.Top); @@ -10966,7 +10963,7 @@ protected virtual IDisposable DrawRibbonGroupNormalTitle(RenderContext context, titlePath.AddLine(rect.Left + 2, rect.Bottom - 1, rect.Left, rect.Bottom - 3); titlePath.AddLine(rect.Left, rect.Bottom - 3, rect.Left, rect.Top); - var rectF = new RectangleF(rect.Left - 0.5f, rect.Top - 0.5f, rect.Width + 1, + RectangleF rectF = new RectangleF(rect.Left - 0.5f, rect.Top - 0.5f, rect.Width + 1, rect.Height + 1); cache.TitleBrush = new LinearGradientBrush(rectF, c1, c2, 90f); cache.TitlePath = titlePath; @@ -11019,8 +11016,8 @@ protected virtual IDisposable DrawRibbonGroupCollapsedBorder(RenderContext conte // Dispose of existing values cache.Dispose(); - var solidPath = new GraphicsPath(); - var insidePath = new GraphicsPath(); + GraphicsPath solidPath = new GraphicsPath(); + GraphicsPath insidePath = new GraphicsPath(); // Create the rounded complete border solidPath.AddLine(rect.Left + 1.25f, rect.Top, rect.Right - 2, rect.Top); @@ -11042,11 +11039,11 @@ protected virtual IDisposable DrawRibbonGroupCollapsedBorder(RenderContext conte insidePath.AddLine(rect.Left + 1, rect.Bottom - 3, rect.Left + 1, rect.Top + 2); insidePath.AddLine(rect.Left + 1, rect.Top + 2, rect.Left + 2, rect.Top + 1); - var solidRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); - var insideRectF = new RectangleF(rect.Left, rect.Top, rect.Width, rect.Height); + RectangleF solidRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); + RectangleF insideRectF = new RectangleF(rect.Left, rect.Top, rect.Width, rect.Height); - var solidBrush = new LinearGradientBrush(solidRectF, c1, c2, 90f); - var insideBrush = new LinearGradientBrush(insideRectF, c3, c4, 90f); + LinearGradientBrush solidBrush = new LinearGradientBrush(solidRectF, c1, c2, 90f); + LinearGradientBrush insideBrush = new LinearGradientBrush(insideRectF, c3, c4, 90f); cache.SolidPath = solidPath; cache.InsidePath = insidePath; @@ -11055,7 +11052,7 @@ protected virtual IDisposable DrawRibbonGroupCollapsedBorder(RenderContext conte } // Perform actual drawing using the cache values - using var aa = new AntiAlias(context.Graphics); + using AntiAlias aa = new AntiAlias(context.Graphics); context.Graphics.DrawPath(cache.SolidPen, cache.SolidPath); context.Graphics.DrawPath(cache.InsidePen, cache.InsidePath); } @@ -11100,7 +11097,7 @@ protected virtual IDisposable DrawRibbonGroupCollapsedFrameBorder(RenderContext // Dispose of existing values cache.Dispose(); - var solidPath = new GraphicsPath(); + GraphicsPath solidPath = new GraphicsPath(); // Create the rounded complete border solidPath.AddLine(rect.Left + 2, rect.Top, rect.Right - 3, rect.Top); @@ -11118,11 +11115,11 @@ protected virtual IDisposable DrawRibbonGroupCollapsedFrameBorder(RenderContext } // Perform actual drawing using the cache values - var titleRect = new Rectangle(rect.Left + 1, rect.Bottom - GROUP_FRAME_TITLE_HEIGHT, + Rectangle titleRect = new Rectangle(rect.Left + 1, rect.Bottom - GROUP_FRAME_TITLE_HEIGHT, rect.Width - 2, GROUP_FRAME_TITLE_HEIGHT - 1); context.Graphics.FillRectangle(cache.TitleBrush, titleRect); - using var aa = new AntiAlias(context.Graphics); + using AntiAlias aa = new AntiAlias(context.Graphics); context.Graphics.DrawPath(cache.SolidPen, cache.SolidPath); } @@ -11166,7 +11163,7 @@ protected virtual IDisposable DrawRibbonGroupGradientOne(RenderContext context, // Dispose of existing values cache.Dispose(); - var rectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); + RectangleF rectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2); cache.Brush = new LinearGradientBrush(rectF, c1, c2, 90f) { Blend = _ribbonGroup8Blend @@ -11221,11 +11218,11 @@ protected virtual IDisposable DrawRibbonGroupGradientTwo(RenderContext context, cache.Dispose(); var topHeight = (int)(rect.Height * percent); - var topRect = new Rectangle(rect.Left, rect.Top, rect.Width, topHeight); - var bottomRect = new Rectangle(rect.Left, topRect.Bottom, rect.Width, rect.Height - topHeight); - var topRectF = new RectangleF(topRect.Left - 1, topRect.Top - 1, topRect.Width + 2, + Rectangle topRect = new Rectangle(rect.Left, rect.Top, rect.Width, topHeight); + Rectangle bottomRect = new Rectangle(rect.Left, topRect.Bottom, rect.Width, rect.Height - topHeight); + RectangleF topRectF = new RectangleF(topRect.Left - 1, topRect.Top - 1, topRect.Width + 2, topRect.Height + 2); - var bottomRectF = new RectangleF(bottomRect.Left - 1, bottomRect.Top - 1, + RectangleF bottomRectF = new RectangleF(bottomRect.Left - 1, bottomRect.Top - 1, bottomRect.Width + 2, bottomRect.Height + 2); cache.TopBrush = new LinearGradientBrush(topRectF, c1, c2, 90f); @@ -11283,9 +11280,9 @@ protected virtual IDisposable DrawRibbonQATMinibarSingle(RenderContext context, // Dispose of existing values cache.Dispose(); - var borderPath = new GraphicsPath(); - var topRight1 = new GraphicsPath(); - var bottomLeft1 = new GraphicsPath(); + GraphicsPath borderPath = new GraphicsPath(); + GraphicsPath topRight1 = new GraphicsPath(); + GraphicsPath bottomLeft1 = new GraphicsPath(); // Find values needed for drawing the main border var left = rect.X + 1; @@ -11341,7 +11338,7 @@ protected virtual IDisposable DrawRibbonQATMinibarSingle(RenderContext context, cache.WhitenPen = new Pen(c5); } - using var aa = new AntiAlias(context.Graphics); + using AntiAlias aa = new AntiAlias(context.Graphics); if (!composition) { // Draw the light borders @@ -11409,9 +11406,9 @@ protected virtual IDisposable DrawRibbonQATMinibarDouble(RenderContext context, // Dispose of existing values cache.Dispose(); - var borderPath = new GraphicsPath(); - var topRight1 = new GraphicsPath(); - var bottomLeft1 = new GraphicsPath(); + GraphicsPath borderPath = new GraphicsPath(); + GraphicsPath topRight1 = new GraphicsPath(); + GraphicsPath bottomLeft1 = new GraphicsPath(); // Find values needed for drawing the main border var left = rect.X + 1; @@ -11468,7 +11465,7 @@ protected virtual IDisposable DrawRibbonQATMinibarDouble(RenderContext context, cache.WhitenPen = new Pen(c5); } - using var aa = new AntiAlias(context.Graphics); + using AntiAlias aa = new AntiAlias(context.Graphics); if (!composition) { // Draw the light borders @@ -11577,7 +11574,7 @@ protected virtual IDisposable DrawRibbonLinearBorder(RenderContext context, cache.LinearPen = new Pen(cache.LinearBrush); // Create the rounded complete border - var borderPath = new GraphicsPath(); + GraphicsPath borderPath = new GraphicsPath(); borderPath.AddLine(rect.Left + 2, rect.Top, rect.Right - 3, rect.Top); borderPath.AddLine(rect.Right - 3, rect.Top, rect.Right - 1, rect.Top + 2); borderPath.AddLine(rect.Right - 1, rect.Top + 2, rect.Right - 1, rect.Bottom - 3); @@ -11753,9 +11750,9 @@ protected virtual IDisposable DrawRibbonQATFullbarRound(RenderContext context, cache.InnerBrush = new LinearGradientBrush(rect, c1, c2, 90f); cache.DarkPen = new Pen(c3); - var darkPath = new GraphicsPath(); - var lightPath1 = new GraphicsPath(); - var lightPath2 = new GraphicsPath(); + GraphicsPath darkPath = new GraphicsPath(); + GraphicsPath lightPath1 = new GraphicsPath(); + GraphicsPath lightPath2 = new GraphicsPath(); // Create the dark border darkPath.AddLine(rect.Left, rect.Top + 0.75f, rect.Left + 1, rect.Top); @@ -11784,7 +11781,7 @@ protected virtual IDisposable DrawRibbonQATFullbarRound(RenderContext context, context.Graphics.FillRectangle(cache.InnerBrush, cache.InnerRect); // Draw the dark/light lines - using var aa = new AntiAlias(context.Graphics); + using AntiAlias aa = new AntiAlias(context.Graphics); context.Graphics.DrawPath(cache.DarkPen, cache.DarkPath); context.Graphics.DrawPath(_light1Pen, cache.LightPath1); context.Graphics.DrawPath(_light2Pen, cache.LightPath2); @@ -11895,7 +11892,7 @@ protected virtual IDisposable DrawRibbonQATOverflow(PaletteRibbonShape shape, // Draw a gradient for the inside of the area context.Graphics.FillRectangle(cache.BackBrush, rect); - using var aa = new AntiAlias(context.Graphics); + using AntiAlias aa = new AntiAlias(context.Graphics); if (shape == PaletteRibbonShape.Office2010) { context.Graphics.DrawPolygon(cache.BorderPen, new Point[]{ @@ -12070,10 +12067,7 @@ public void AdjustForOrientation(VisualOrientation orientation, } } - private static void SwapRectangleSizes(ref Rectangle rect) - { - (rect.Width, rect.Height) = (rect.Height, rect.Width); - } + private static void SwapRectangleSizes(ref Rectangle rect) => (rect.Width, rect.Height) = (rect.Height, rect.Width); } #endregion } diff --git a/Source/Krypton Components/Krypton.Toolkit/ShellDialogs/LocalCallWndProc.cs b/Source/Krypton Components/Krypton.Toolkit/ShellDialogs/LocalCallWndProc.cs index 18fba3147..a10f3a538 100644 --- a/Source/Krypton Components/Krypton.Toolkit/ShellDialogs/LocalCallWndProc.cs +++ b/Source/Krypton Components/Krypton.Toolkit/ShellDialogs/LocalCallWndProc.cs @@ -44,8 +44,8 @@ private int CwpHookProc(int code, IntPtr wParam, IntPtr lParam) return CallNextHookEx(m_hHook, code, wParam, lParam); } - bool actioned = false; - CWPRETSTRUCT msg = (CWPRETSTRUCT)Marshal.PtrToStructure(lParam, typeof(CWPRETSTRUCT)); + var actioned = false; + var msg = (CWPRETSTRUCT)Marshal.PtrToStructure(lParam, typeof(CWPRETSTRUCT)); if (msg.hWnd == TargetWnd) { WindowMessage?.Invoke(this, msg, out actioned); diff --git a/Source/Krypton Components/Krypton.Toolkit/ShellDialogs/LocalCbtHook.cs b/Source/Krypton Components/Krypton.Toolkit/ShellDialogs/LocalCbtHook.cs index 5ae93880e..ed43a1c6e 100644 --- a/Source/Krypton Components/Krypton.Toolkit/ShellDialogs/LocalCbtHook.cs +++ b/Source/Krypton Components/Krypton.Toolkit/ShellDialogs/LocalCbtHook.cs @@ -65,9 +65,9 @@ public LocalCbtHook(HookProc func) private void CbtHookInvoked(object sender, HookEventArgs e) { - CbtHookAction hookCode = (CbtHookAction)e.HookCode; - IntPtr wParam = e.wParam; - IntPtr lParam = e.lParam; + var hookCode = (CbtHookAction)e.HookCode; + var wParam = e.wParam; + var lParam = e.lParam; switch (hookCode) { case CbtHookAction.HCBT_CREATEWND: diff --git a/Source/Krypton Components/Krypton.Toolkit/ShellDialogs/ShellBrowserDialogTFM.cs b/Source/Krypton Components/Krypton.Toolkit/ShellDialogs/ShellBrowserDialogTFM.cs index f8e8a812d..acf7147dd 100644 --- a/Source/Krypton Components/Krypton.Toolkit/ShellDialogs/ShellBrowserDialogTFM.cs +++ b/Source/Krypton Components/Krypton.Toolkit/ShellDialogs/ShellBrowserDialogTFM.cs @@ -58,7 +58,7 @@ protected override DialogResult ShowActualDialog(IWin32Window? owner) _internalOpenFileDialog.CheckPathExists = true; _internalOpenFileDialog.FileName = "Folder Selection."; var options = _ofd.GetField(@"options", BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); - int value = (int)options.GetValue(_internalOpenFileDialog); + var value = (int)options.GetValue(_internalOpenFileDialog); options.SetValue(_internalOpenFileDialog, value | (int)(FOS_.FORCEFILESYSTEM | FOS_.PICKFOLDERS)); return _internalOpenFileDialog.ShowDialog(owner); @@ -107,18 +107,12 @@ public Environment.SpecialFolder RootFolder } /// - public override void Reset() - { - _internalOpenFileDialog.Reset(); - } + public override void Reset() => _internalOpenFileDialog.Reset(); /// public override string ToString() => _internalOpenFileDialog.ToString(); /// - public void Dispose() - { - _internalOpenFileDialog.Dispose(); - } + public void Dispose() => _internalOpenFileDialog.Dispose(); } } diff --git a/Source/Krypton Components/Krypton.Toolkit/ShellDialogs/ShellDialogWrapper.cs b/Source/Krypton Components/Krypton.Toolkit/ShellDialogs/ShellDialogWrapper.cs index 5bb3c4deb..61d3bcebc 100644 --- a/Source/Krypton Components/Krypton.Toolkit/ShellDialogs/ShellDialogWrapper.cs +++ b/Source/Krypton Components/Krypton.Toolkit/ShellDialogs/ShellDialogWrapper.cs @@ -81,7 +81,7 @@ internal ShellDialogWrapper() private protected virtual void WndMessage(object sender, CWPRETSTRUCT e, out bool actioned) { - (bool handled, IntPtr retValue) = _commonDialogHandler.HookProc(e.hWnd, e.message, e.wParam, e.lParam); + (var handled, var retValue) = _commonDialogHandler.HookProc(e.hWnd, e.message, e.wParam, e.lParam); e.retValue = retValue; actioned = handled; diff --git a/Source/Krypton Components/Krypton.Toolkit/Utilities/BiDictionary.cs b/Source/Krypton Components/Krypton.Toolkit/Utilities/BiDictionary.cs index db808b7ee..13c3170c1 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Utilities/BiDictionary.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Utilities/BiDictionary.cs @@ -60,9 +60,6 @@ public void Add(TFirst first, TSecond second) return first; } - public ICollection GetAllFirsts() - { - return _firstToSecond.Keys; - } + public ICollection GetAllFirsts() => _firstToSecond.Keys; } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Utilities/GraphicsExtensions.cs b/Source/Krypton Components/Krypton.Toolkit/Utilities/GraphicsExtensions.cs index a09636957..3698814f4 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Utilities/GraphicsExtensions.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Utilities/GraphicsExtensions.cs @@ -21,7 +21,7 @@ public static class GraphicsExtensions /// public static Icon? LoadIcon(IconType type, Size size) { - IntPtr hIcon = ImageNativeMethods.LoadImage(IntPtr.Zero, $"#{(int)type}", 1, size.Width, size.Height, 0); + var hIcon = ImageNativeMethods.LoadImage(IntPtr.Zero, $"#{(int)type}", 1, size.Width, size.Height, 0); return hIcon == IntPtr.Zero ? null : Icon.FromHandle(hIcon); } diff --git a/Source/Krypton Components/Krypton.Toolkit/Utilities/RoundedRectangleF.cs b/Source/Krypton Components/Krypton.Toolkit/Utilities/RoundedRectangleF.cs index 0af2bef96..e2d056bfe 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Utilities/RoundedRectangleF.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Utilities/RoundedRectangleF.cs @@ -59,7 +59,7 @@ public RoundedRectangleF(float width, float height, float radius, float x = 0, f var diameter = radius * 2; var size = new SizeF(diameter, diameter); - RectangleF arc = new RectangleF(Rect.Location, size); + var arc = new RectangleF(Rect.Location, size); // The border is made of up a quarter of a circle arc, in each corner // top left arc diff --git a/Source/Krypton Components/Krypton.Toolkit/Values/ButtonImageStates.cs b/Source/Krypton Components/Krypton.Toolkit/Values/ButtonImageStates.cs index b97927c92..e8ee79845 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Values/ButtonImageStates.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Values/ButtonImageStates.cs @@ -65,10 +65,7 @@ public Image? ImageNormal /// /// Resets the ImageNormal property to its default value. /// - public void ResetImageNormal() - { - ImageNormal = null; - } + public void ResetImageNormal() => ImageNormal = null; #endregion #region ImageDisabled @@ -100,10 +97,7 @@ public Image? ImageDisabled /// /// Resets the ImageDisabled property to its default value. /// - public void ResetImageDisabled() - { - ImageDisabled = null; - } + public void ResetImageDisabled() => ImageDisabled = null; #endregion #region ImagePressed @@ -135,10 +129,7 @@ public Image? ImagePressed /// /// Resets the ImagePressed property to its default value. /// - public void ResetImagePressed() - { - ImagePressed = null; - } + public void ResetImagePressed() => ImagePressed = null; #endregion #region ImageTracking @@ -170,10 +161,7 @@ public Image? ImageTracking /// /// Resets the ImageTracking property to its default value. /// - public void ResetImageTracking() - { - ImageTracking = null; - } + public void ResetImageTracking() => ImageTracking = null; #endregion #region ImageCheckedNormal diff --git a/Source/Krypton Components/Krypton.Toolkit/Values/ButtonValues.cs b/Source/Krypton Components/Krypton.Toolkit/Values/ButtonValues.cs index 93ab9ae85..074bfe31d 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Values/ButtonValues.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Values/ButtonValues.cs @@ -98,10 +98,7 @@ public Image? Image /// /// Resets the Image property to its default value. /// - public void ResetImage() - { - Image = null; - } + public void ResetImage() => Image = null; #endregion #region ImageTransparentColor @@ -132,10 +129,7 @@ public Color ImageTransparentColor /// /// Resets the ImageTransparentColor property to its default value. /// - public void ResetImageTransparentColor() - { - ImageTransparentColor = Color.Empty; - } + public void ResetImageTransparentColor() => ImageTransparentColor = Color.Empty; /// /// Gets the content image transparent color. @@ -189,10 +183,7 @@ public string Text /// /// Resets the Text property to its default value. /// - public void ResetText() - { - Text = _defaultText; - } + public void ResetText() => Text = _defaultText; #endregion #region ExtraText @@ -224,10 +215,7 @@ public string ExtraText /// /// Resets the Description property to its default value. /// - public void ResetExtraText() - { - ExtraText = _defaultExtraText; - } + public void ResetExtraText() => ExtraText = _defaultExtraText; #endregion #region CreateImageStates diff --git a/Source/Krypton Components/Krypton.Toolkit/Values/CheckBoxImages.cs b/Source/Krypton Components/Krypton.Toolkit/Values/CheckBoxImages.cs index e669bdea1..179690458 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Values/CheckBoxImages.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Values/CheckBoxImages.cs @@ -115,10 +115,7 @@ public Image? Common /// /// Resets the Common property to its default value. /// - public void ResetCommon() - { - Common = null; - } + public void ResetCommon() => Common = null; #endregion #region UncheckedDisabled @@ -147,10 +144,7 @@ public Image? UncheckedDisabled /// /// Resets the UncheckedDisabled property to its default value. /// - public void ResetUncheckedDisabled() - { - UncheckedDisabled = null; - } + public void ResetUncheckedDisabled() => UncheckedDisabled = null; #endregion #region UncheckedNormal @@ -179,10 +173,7 @@ public Image? UncheckedNormal /// /// Resets the UncheckedNormal property to its default value. /// - public void ResetUncheckedNormal() - { - UncheckedNormal = null; - } + public void ResetUncheckedNormal() => UncheckedNormal = null; #endregion #region UncheckedTracking @@ -211,10 +202,7 @@ public Image? UncheckedTracking /// /// Resets the UncheckedTracking property to its default value. /// - public void ResetUncheckedTracking() - { - UncheckedTracking = null; - } + public void ResetUncheckedTracking() => UncheckedTracking = null; #endregion #region UncheckedPressed @@ -243,10 +231,7 @@ public Image? UncheckedPressed /// /// Resets the UncheckedPressed property to its default value. /// - public void ResetUncheckedPressed() - { - UncheckedPressed = null; - } + public void ResetUncheckedPressed() => UncheckedPressed = null; #endregion #region CheckedDisabled @@ -275,10 +260,7 @@ public Image? CheckedDisabled /// /// Resets the CheckedDisabled property to its default value. /// - public void ResetCheckedDisabled() - { - CheckedDisabled = null; - } + public void ResetCheckedDisabled() => CheckedDisabled = null; #endregion #region CheckedNormal @@ -307,10 +289,7 @@ public Image? CheckedNormal /// /// Resets the CheckedNormal property to its default value. /// - public void ResetCheckedNormal() - { - CheckedNormal = null; - } + public void ResetCheckedNormal() => CheckedNormal = null; #endregion #region CheckedTracking @@ -339,10 +318,7 @@ public Image? CheckedTracking /// /// Resets the CheckedTracking property to its default value. /// - public void ResetCheckedTracking() - { - CheckedTracking = null; - } + public void ResetCheckedTracking() => CheckedTracking = null; #endregion #region CheckedPressed @@ -371,10 +347,7 @@ public Image? CheckedPressed /// /// Resets the CheckedPressed property to its default value. /// - public void ResetCheckedPressed() - { - CheckedPressed = null; - } + public void ResetCheckedPressed() => CheckedPressed = null; #endregion #region IndeterminateDisabled @@ -403,10 +376,7 @@ public Image? IndeterminateDisabled /// /// Resets the IndeterminateDisabled property to its default value. /// - public void ResetIndeterminateDisabled() - { - IndeterminateDisabled = null; - } + public void ResetIndeterminateDisabled() => IndeterminateDisabled = null; #endregion #region IndeterminateNormal @@ -435,10 +405,7 @@ public Image? IndeterminateNormal /// /// Resets the IndeterminateNormal property to its default value. /// - public void ResetIndeterminateNormal() - { - IndeterminateNormal = null; - } + public void ResetIndeterminateNormal() => IndeterminateNormal = null; #endregion #region IndeterminateTracking @@ -467,10 +434,7 @@ public Image? IndeterminateTracking /// /// Resets the IndeterminateTracking property to its default value. /// - public void ResetIndeterminateTracking() - { - IndeterminateTracking = null; - } + public void ResetIndeterminateTracking() => IndeterminateTracking = null; #endregion #region IndeterminatePressed @@ -499,10 +463,7 @@ public Image? IndeterminatePressed /// /// Resets the IndeterminatePressed property to its default value. /// - public void ResetIndeterminatePressed() - { - IndeterminatePressed = null; - } + public void ResetIndeterminatePressed() => IndeterminatePressed = null; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Values/CheckButtonImageStates.cs b/Source/Krypton Components/Krypton.Toolkit/Values/CheckButtonImageStates.cs index 3291bb58f..0f230a02d 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Values/CheckButtonImageStates.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Values/CheckButtonImageStates.cs @@ -66,10 +66,7 @@ public override Image? ImageCheckedNormal /// /// Resets the ImageCheckedNormal property to its default value. /// - public void ResetImageCheckedNormal() - { - ImageCheckedNormal = null; - } + public void ResetImageCheckedNormal() => ImageCheckedNormal = null; #endregion #region ImageCheckedPressed @@ -103,10 +100,7 @@ public override Image? ImageCheckedPressed /// /// Resets the ImageCheckedPressed property to its default value. /// - public void ResetImageCheckedPressed() - { - ImageCheckedPressed = null; - } + public void ResetImageCheckedPressed() => ImageCheckedPressed = null; #endregion #region ImageCheckedTracking @@ -140,10 +134,7 @@ public override Image? ImageCheckedTracking /// /// Resets the ImageCheckedTracking property to its default value. /// - public void ResetImageCheckedTracking() - { - ImageCheckedTracking = null; - } + public void ResetImageCheckedTracking() => ImageCheckedTracking = null; #endregion #region CopyFrom diff --git a/Source/Krypton Components/Krypton.Toolkit/Values/ColorButtonValues.cs b/Source/Krypton Components/Krypton.Toolkit/Values/ColorButtonValues.cs index 69b906228..f918c6007 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Values/ColorButtonValues.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Values/ColorButtonValues.cs @@ -28,7 +28,7 @@ public class ColorButtonValues : Storage, #region Instance Fields private Image _image; private Image _sourceImage; - private Image? _compositeImage; + private Image _compositeImage; private Color _transparent; private string? _text; private string _extraText; @@ -111,10 +111,7 @@ public Image? Image /// /// Resets the Image property to its default value. /// - public void ResetImage() - { - Image = _defaultImage; - } + public void ResetImage() => Image = _defaultImage; #endregion #region ImageTransparentColor @@ -145,10 +142,7 @@ public Color ImageTransparentColor /// /// Resets the ImageTransparentColor property to its default value. /// - public void ResetImageTransparentColor() - { - ImageTransparentColor = Color.Empty; - } + public void ResetImageTransparentColor() => ImageTransparentColor = Color.Empty; /// /// Gets the content image transparent color. @@ -202,10 +196,7 @@ public string Text /// /// Resets the Text property to its default value. /// - public void ResetText() - { - Text = _defaultText; - } + public void ResetText() => Text = _defaultText; #endregion #region ExtraText @@ -237,10 +228,7 @@ public string ExtraText /// /// Resets the Description property to its default value. /// - public void ResetExtraText() - { - ExtraText = _defaultExtraText; - } + public void ResetExtraText() => ExtraText = _defaultExtraText; #endregion #region SelectedColor @@ -312,10 +300,7 @@ public int RoundedCorners /// /// Resets the Description property to its default value. /// - public void ResetRoundedCorners() - { - RoundedCorners = 0; - } + public void ResetRoundedCorners() => RoundedCorners = 0; #endregion @@ -364,7 +349,7 @@ public void ResetRoundedCorners() // Create a copy of the source image Size selectedRectSize = _selectedRect.Size; Size imageSize = image.Size; - var copyBitmap = new Bitmap(image, Math.Max(selectedRectSize.Width, imageSize.Width), + Bitmap copyBitmap = new Bitmap(image, Math.Max(selectedRectSize.Width, imageSize.Width), Math.Max(selectedRectSize.Height, imageSize.Height)); // Paint over the image with a color indicator @@ -377,13 +362,13 @@ public void ResetRoundedCorners() // Indicate the absence of a color by drawing a border around // the selected color area, thus indicating the area inside the // block is blank/empty. - using var borderPen = new Pen(_emptyBorderColor); + using Pen borderPen = new Pen(_emptyBorderColor); DrawRoundedRectangle(g, borderPen, _selectedRect, _roundedCorners); } else { // We have a valid selected color so draw a solid block of color - using var colorBrush = new SolidBrush(_selectedColor); + using SolidBrush colorBrush = new SolidBrush(_selectedColor); FillRoundedRectangle(g, colorBrush, _selectedRect, _roundedCorners); } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Values/ContextMenuImages.cs b/Source/Krypton Components/Krypton.Toolkit/Values/ContextMenuImages.cs index 110ccefb0..c1aafc91a 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Values/ContextMenuImages.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Values/ContextMenuImages.cs @@ -77,10 +77,7 @@ public Image? Checked /// /// Resets the Checked property to its default value. /// - public void ResetChecked() - { - Checked = null; - } + public void ResetChecked() => Checked = null; #endregion #region Indeterminate @@ -109,10 +106,7 @@ public Image? Indeterminate /// /// Resets the Indeterminate property to its default value. /// - public void ResetIndeterminate() - { - Indeterminate = null; - } + public void ResetIndeterminate() => Indeterminate = null; #endregion #region SubMenu @@ -141,10 +135,7 @@ public Image? SubMenu /// /// Resets the SubMenu property to its default value. /// - public void ResetSubMenu() - { - SubMenu = null; - } + public void ResetSubMenu() => SubMenu = null; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Values/DropDownButtonImages.cs b/Source/Krypton Components/Krypton.Toolkit/Values/DropDownButtonImages.cs index 5a24e0ee8..3620dd1bf 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Values/DropDownButtonImages.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Values/DropDownButtonImages.cs @@ -91,10 +91,7 @@ public Image? Common /// /// Resets the Common property to its default value. /// - public void ResetCommon() - { - Common = null; - } + public void ResetCommon() => Common = null; #endregion #region Disabled @@ -123,10 +120,7 @@ public Image? Disabled /// /// Resets the Disabled property to its default value. /// - public void ResetDisabled() - { - Disabled = null; - } + public void ResetDisabled() => Disabled = null; #endregion #region Normal @@ -155,10 +149,7 @@ public Image? Normal /// /// Resets the Normal property to its default value. /// - public void ResetNormal() - { - Normal = null; - } + public void ResetNormal() => Normal = null; #endregion #region Tracking @@ -187,10 +178,7 @@ public Image? Tracking /// /// Resets the Tracking property to its default value. /// - public void ResetTracking() - { - Tracking = null; - } + public void ResetTracking() => Tracking = null; #endregion #region Pressed @@ -219,10 +207,7 @@ public Image? Pressed /// /// Resets the Pressed property to its default value. /// - public void ResetPressed() - { - Pressed = null; - } + public void ResetPressed() => Pressed = null; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Values/GalleryButtonImages.cs b/Source/Krypton Components/Krypton.Toolkit/Values/GalleryButtonImages.cs index 8b08639d3..75685a53e 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Values/GalleryButtonImages.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Values/GalleryButtonImages.cs @@ -83,10 +83,7 @@ public Image? Common /// /// Resets the Common property to its default value. /// - public void ResetCommon() - { - Common = null; - } + public void ResetCommon() => Common = null; #endregion #region Disabled @@ -115,10 +112,7 @@ public Image? Disabled /// /// Resets the Disabled property to its default value. /// - public void ResetDisabled() - { - Disabled = null; - } + public void ResetDisabled() => Disabled = null; #endregion #region Normal @@ -147,10 +141,7 @@ public Image? Normal /// /// Resets the Normal property to its default value. /// - public void ResetNormal() - { - Normal = null; - } + public void ResetNormal() => Normal = null; #endregion #region Tracking @@ -179,10 +170,7 @@ public Image? Tracking /// /// Resets the Tracking property to its default value. /// - public void ResetTracking() - { - Tracking = null; - } + public void ResetTracking() => Tracking = null; #endregion #region Pressed @@ -211,10 +199,7 @@ public Image? Pressed /// /// Resets the Pressed property to its default value. /// - public void ResetPressed() - { - Pressed = null; - } + public void ResetPressed() => Pressed = null; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Values/HeaderValuesBase.cs b/Source/Krypton Components/Krypton.Toolkit/Values/HeaderValuesBase.cs index a627f6ecf..25e3e7e80 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Values/HeaderValuesBase.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Values/HeaderValuesBase.cs @@ -113,10 +113,7 @@ public Image? Image /// /// Resets the Image property to its default value. /// - public void ResetImage() - { - Image = GetImageDefault(); - } + public void ResetImage() => Image = GetImageDefault(); /// /// Gets the content image. @@ -155,10 +152,7 @@ public Color ImageTransparentColor /// /// Resets the ImageTransparentColor property to its default value. /// - public void ResetImageTransparentColor() - { - ImageTransparentColor = Color.Empty; - } + public void ResetImageTransparentColor() => ImageTransparentColor = Color.Empty; /// /// Gets the content image transparent color. @@ -199,10 +193,7 @@ public virtual string Heading /// /// Resets the Heading property to its default value. /// - public void ResetHeading() - { - Heading = GetHeadingDefault(); - } + public void ResetHeading() => Heading = GetHeadingDefault(); /// /// Gets the content short text. @@ -239,10 +230,7 @@ public virtual string Description /// /// Resets the Description property to its default value. /// - public void ResetDescription() - { - Description = GetDescriptionDefault(); - } + public void ResetDescription() => Description = GetDescriptionDefault(); /// /// Gets the content long text. diff --git a/Source/Krypton Components/Krypton.Toolkit/Values/LabelValues.cs b/Source/Krypton Components/Krypton.Toolkit/Values/LabelValues.cs index f560f013e..ea246e6fa 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Values/LabelValues.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Values/LabelValues.cs @@ -94,10 +94,7 @@ public Image? Image /// /// Resets the Image property to its default value. /// - public void ResetImage() - { - Image = null; - } + public void ResetImage() => Image = null; /// /// Gets the content image. @@ -136,10 +133,7 @@ public Color ImageTransparentColor /// /// Resets the ImageTransparentColor property to its default value. /// - public void ResetImageTransparentColor() - { - ImageTransparentColor = Color.Empty; - } + public void ResetImageTransparentColor() => ImageTransparentColor = Color.Empty; /// /// Gets the content image transparent color. @@ -180,10 +174,7 @@ public string Text /// /// Resets the Text property to its default value. /// - public void ResetText() - { - Text = _defaultText; - } + public void ResetText() => Text = _defaultText; /// /// Gets the content short text. @@ -221,10 +212,7 @@ public string ExtraText /// /// Resets the Description property to its default value. /// - public void ResetExtraText() - { - ExtraText = _defaultExtraText; - } + public void ResetExtraText() => ExtraText = _defaultExtraText; /// /// Gets the content long text. diff --git a/Source/Krypton Components/Krypton.Toolkit/Values/PopupPositionValues.cs b/Source/Krypton Components/Krypton.Toolkit/Values/PopupPositionValues.cs index cc9b3f10d..06dafe184 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Values/PopupPositionValues.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Values/PopupPositionValues.cs @@ -55,10 +55,7 @@ public void Reset() /// /// Resets the PlacementMode property to its default value. /// - public void ResetPlacementMode() - { - PlacementMode = PlacementMode.Bottom; - } + public void ResetPlacementMode() => PlacementMode = PlacementMode.Bottom; /// /// @@ -71,10 +68,7 @@ public void ResetPlacementMode() /// /// Resets the PlacementTarget property to its default value. /// - public void ResetPlacementTarget() - { - PlacementTarget = null; - } + public void ResetPlacementTarget() => PlacementTarget = null; /// /// @@ -87,10 +81,7 @@ public void ResetPlacementTarget() /// /// Resets the ToolTipStyle property to its default value. /// - public void ResetPlacementRectangle() - { - PlacementRectangle = new Rectangle(); - } + public void ResetPlacementRectangle() => PlacementRectangle = new Rectangle(); #region Default Values /// diff --git a/Source/Krypton Components/Krypton.Toolkit/Values/RadioButtonImages.cs b/Source/Krypton Components/Krypton.Toolkit/Values/RadioButtonImages.cs index d5a49d196..7837673ac 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Values/RadioButtonImages.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Values/RadioButtonImages.cs @@ -103,10 +103,7 @@ public Image? Common /// /// Resets the Common property to its default value. /// - public void ResetCommon() - { - Common = null; - } + public void ResetCommon() => Common = null; #endregion #region UncheckedDisabled @@ -135,10 +132,7 @@ public Image? UncheckedDisabled /// /// Resets the UncheckedDisabled property to its default value. /// - public void ResetUncheckedDisabled() - { - UncheckedDisabled = null; - } + public void ResetUncheckedDisabled() => UncheckedDisabled = null; #endregion #region UncheckedNormal @@ -167,10 +161,7 @@ public Image? UncheckedNormal /// /// Resets the UncheckedNormal property to its default value. /// - public void ResetUncheckedNormal() - { - UncheckedNormal = null; - } + public void ResetUncheckedNormal() => UncheckedNormal = null; #endregion #region UncheckedTracking @@ -199,10 +190,7 @@ public Image? UncheckedTracking /// /// Resets the UncheckedTracking property to its default value. /// - public void ResetUncheckedTracking() - { - UncheckedTracking = null; - } + public void ResetUncheckedTracking() => UncheckedTracking = null; #endregion #region UncheckedPressed @@ -231,10 +219,7 @@ public Image? UncheckedPressed /// /// Resets the UncheckedPressed property to its default value. /// - public void ResetUncheckedPressed() - { - UncheckedPressed = null; - } + public void ResetUncheckedPressed() => UncheckedPressed = null; #endregion #region CheckedDisabled @@ -263,10 +248,7 @@ public Image? CheckedDisabled /// /// Resets the CheckedDisabled property to its default value. /// - public void ResetCheckedDisabled() - { - CheckedDisabled = null; - } + public void ResetCheckedDisabled() => CheckedDisabled = null; #endregion #region CheckedNormal @@ -295,10 +277,7 @@ public Image? CheckedNormal /// /// Resets the CheckedNormal property to its default value. /// - public void ResetCheckedNormal() - { - CheckedNormal = null; - } + public void ResetCheckedNormal() => CheckedNormal = null; #endregion #region CheckedTracking @@ -327,10 +306,7 @@ public Image? CheckedTracking /// /// Resets the CheckedTracking property to its default value. /// - public void ResetCheckedTracking() - { - CheckedTracking = null; - } + public void ResetCheckedTracking() => CheckedTracking = null; #endregion #region CheckedPressed @@ -359,10 +335,7 @@ public Image? CheckedPressed /// /// Resets the CheckedPressed property to its default value. /// - public void ResetCheckedPressed() - { - CheckedPressed = null; - } + public void ResetCheckedPressed() => CheckedPressed = null; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/Values/ShadowValues.cs b/Source/Krypton Components/Krypton.Toolkit/Values/ShadowValues.cs index 20685b1d8..fc0b42d03 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Values/ShadowValues.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Values/ShadowValues.cs @@ -88,10 +88,7 @@ public bool EnableShadows /// /// - public void ResetEnableShadows() - { - EnableShadows = false; - } + public void ResetEnableShadows() => EnableShadows = false; /// @@ -114,10 +111,7 @@ public Point Offset /// /// - public void ResetOffset() - { - _offset = _defaultOffset; - } + public void ResetOffset() => _offset = _defaultOffset; /// /// @@ -139,10 +133,7 @@ public byte ExtraWidth /// /// - public void ResetExtraWidth() - { - _extraWidth = 5; - } + public void ResetExtraWidth() => _extraWidth = 5; @@ -169,10 +160,7 @@ public double BlurDistance /// /// - public void ResetBlurDistance() - { - BlurDistance = 50; - } + public void ResetBlurDistance() => BlurDistance = 50; /// @@ -196,10 +184,7 @@ public Color Colour /// /// Resets the PlacementMode property to its default value. /// - public void ResetColour() - { - Colour = SystemColors.ActiveBorder; - } + public void ResetColour() => Colour = SystemColors.ActiveBorder; /// /// @@ -224,10 +209,7 @@ public double Opacity /// /// - public void ResetOpacity() - { - _opacity = 95; - } + public void ResetOpacity() => _opacity = 95; #region Default Values diff --git a/Source/Krypton Components/Krypton.Toolkit/Values/TreeViewImages.cs b/Source/Krypton Components/Krypton.Toolkit/Values/TreeViewImages.cs index e0112e8b3..421c1d572 100644 --- a/Source/Krypton Components/Krypton.Toolkit/Values/TreeViewImages.cs +++ b/Source/Krypton Components/Krypton.Toolkit/Values/TreeViewImages.cs @@ -82,10 +82,7 @@ public Image? Plus /// /// Resets the collapse property to its default value. /// - public void ResetPlus() - { - Plus = null; - } + public void ResetPlus() => Plus = null; #endregion #region Minus @@ -114,10 +111,7 @@ public Image? Minus /// /// Resets the Minus property to its default value. /// - public void ResetMinus() - { - Minus = null; - } + public void ResetMinus() => Minus = null; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/View Base/InternalKryptonStringCollectionEditor.cs b/Source/Krypton Components/Krypton.Toolkit/View Base/InternalKryptonStringCollectionEditor.cs index 496956f73..fd087c97f 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Base/InternalKryptonStringCollectionEditor.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Base/InternalKryptonStringCollectionEditor.cs @@ -421,7 +421,7 @@ private void kbtnOk_Click(object sender, EventArgs e) { if (_useTextBox) { - foreach (string line in ktxtStringCollection.Lines) + foreach (var line in ktxtStringCollection.Lines) { List list = new List(); @@ -432,7 +432,7 @@ private void kbtnOk_Click(object sender, EventArgs e) } else if (_useRichTextBox) { - foreach (string line in krtbContents.Lines) + foreach (var line in krtbContents.Lines) { List list = new List(); diff --git a/Source/Krypton Components/Krypton.Toolkit/View Base/ViewBase.cs b/Source/Krypton Components/Krypton.Toolkit/View Base/ViewBase.cs index e33b71173..8b763a527 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Base/ViewBase.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Base/ViewBase.cs @@ -239,7 +239,7 @@ private void InitialiseFactors() { // This does mean that the app will not change it's dpi awareness until restarted ! // Do not use the control dpi, as these values are being used to target the screen - IntPtr screenDc = PI.GetDC(IntPtr.Zero); + var screenDc = PI.GetDC(IntPtr.Zero); if (screenDc != IntPtr.Zero) { _factorDpiX = PI.GetDeviceCaps(screenDc, PI.DeviceCap.LOGPIXELSX) / 96f; @@ -767,11 +767,9 @@ public virtual PaletteState FixedState /// /// Clear down the use of the fixed state /// - public virtual void ClearFixedState() - { + public virtual void ClearFixedState() => // Clear down the fixed state _fixed = false; - } /// /// Gets a value indicating if view is using a fixed state. diff --git a/Source/Krypton Components/Krypton.Toolkit/View Base/ViewComposite.cs b/Source/Krypton Components/Krypton.Toolkit/View Base/ViewComposite.cs index 0f68070f4..5ba753631 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Base/ViewComposite.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Base/ViewComposite.cs @@ -109,7 +109,7 @@ public override Size GetPreferredSize([DisallowNull] ViewLayoutContext context) Debug.Assert(context != null); // As a composite we have no preferred size ourself - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; foreach (ViewBase child in this) { diff --git a/Source/Krypton Components/Krypton.Toolkit/View Base/ViewContextMenuManager.cs b/Source/Krypton Components/Krypton.Toolkit/View Base/ViewContextMenuManager.cs index f8378e3ed..5d49c2aa8 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Base/ViewContextMenuManager.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Base/ViewContextMenuManager.cs @@ -462,7 +462,7 @@ private void FindKeyboardTargets(ViewBase parent, TargetList targets) { // Best match found so far IContextMenuTarget? topLeftTarget = null; - Rectangle topLeftRect = Rectangle.Empty; + var topLeftRect = Rectangle.Empty; // Search all targets, looking for a better match than the current best foreach (IContextMenuTarget target in targets) @@ -496,7 +496,7 @@ private void FindKeyboardTargets(ViewBase parent, TargetList targets) { // Best match found so far IContextMenuTarget? topRightTarget = null; - Rectangle topRightRect = Rectangle.Empty; + var topRightRect = Rectangle.Empty; // Search all targets, looking for a better match than the current best foreach (IContextMenuTarget target in targets) @@ -530,7 +530,7 @@ private void FindKeyboardTargets(ViewBase parent, TargetList targets) { // Best match found so far IContextMenuTarget? bottomLeftTarget = null; - Rectangle bottomLeftRect = Rectangle.Empty; + var bottomLeftRect = Rectangle.Empty; // Search all targets, looking for a better match than the current best foreach (IContextMenuTarget target in targets) @@ -588,7 +588,7 @@ private void FindKeyboardTargets(ViewBase parent, TargetList targets) // Best match found so far IContextMenuTarget? nextTarget = null; - Rectangle nextRect = Rectangle.Empty; + var nextRect = Rectangle.Empty; // Search all targets, looking for a better match than the current best foreach (IContextMenuTarget target in targets) @@ -650,7 +650,7 @@ private void FindKeyboardTargets(ViewBase parent, TargetList targets) // Best match found so far IContextMenuTarget? nextTarget = null; - Rectangle nextRect = Rectangle.Empty; + var nextRect = Rectangle.Empty; // Search all targets, looking for a better match than the current best foreach (IContextMenuTarget target in targets) @@ -713,7 +713,7 @@ private void FindKeyboardTargets(ViewBase parent, TargetList targets) // Best match found so far IContextMenuTarget? nextTarget = null; - Rectangle nextRect = Rectangle.Empty; + var nextRect = Rectangle.Empty; // Search all targets, looking for a better match than the current best foreach (IContextMenuTarget target in targets) @@ -785,7 +785,7 @@ private void FindKeyboardTargets(ViewBase parent, TargetList targets) // Best match found so far IContextMenuTarget? nextTarget = null; - Rectangle nextRect = Rectangle.Empty; + var nextRect = Rectangle.Empty; // Search all targets, looking for a better match than the current best foreach (IContextMenuTarget target in targets) diff --git a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawBorderEdge.cs b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawBorderEdge.cs index c22864960..88a960add 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawBorderEdge.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawBorderEdge.cs @@ -93,7 +93,7 @@ public override Size GetPreferredSize([DisallowNull] ViewLayoutContext context) Debug.Assert(context != null); // We have no preferred size by default - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Apply the border width in appropriate orientation if (Orientation == Orientation.Horizontal) diff --git a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawButton.cs b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawButton.cs index d0f96d919..89fad315a 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawButton.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawButton.cs @@ -684,8 +684,8 @@ private void UpdateDropDown() _drawOuterSeparator.Visible = !_splitter & _dropDown; _drawCanvas.Splitter = _splitter & _dropDown; - ViewDockStyle dockStyle = ViewDockStyle.Right; - Orientation splitOrientation = System.Windows.Forms.Orientation.Vertical; + var dockStyle = ViewDockStyle.Right; + var splitOrientation = System.Windows.Forms.Orientation.Vertical; switch (_dropDownPosition) { case VisualOrientation.Top: diff --git a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawContent.cs b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawContent.cs index 343080525..a17280045 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawContent.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawContent.cs @@ -229,7 +229,7 @@ public Rectangle ImageRectangle([DisallowNull] ViewContext context) throw new ArgumentNullException(nameof(context)); } - Rectangle imageRect = Rectangle.Empty; + var imageRect = Rectangle.Empty; // If we have some content to investigate if (_paletteContent.GetContentDraw(State) == InheritBool.True) @@ -258,7 +258,7 @@ public Rectangle ShortTextRect([DisallowNull] ViewContext context) throw new ArgumentNullException(nameof(context)); } - Rectangle textRect = Rectangle.Empty; + var textRect = Rectangle.Empty; // If we have some content to investigate if (_paletteContent.GetContentDraw(State) == InheritBool.True) @@ -287,7 +287,7 @@ public Rectangle LongTextRect([DisallowNull] ViewContext context) throw new ArgumentNullException(nameof(context)); } - Rectangle textRect = Rectangle.Empty; + var textRect = Rectangle.Empty; // If we have some content to investigate if (_paletteContent.GetContentDraw(State) == InheritBool.True) @@ -317,7 +317,7 @@ public override Size GetPreferredSize([DisallowNull] ViewLayoutContext context) } // By default we take up no space at all - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // If we have some content to encompass if (_paletteContent.GetContentDraw(State) == InheritBool.True) diff --git a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawDateTimeText.cs b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawDateTimeText.cs index ceb980592..e321f055d 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawDateTimeText.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawDateTimeText.cs @@ -56,7 +56,7 @@ public FormatHandler(KryptonDateTimePicker dateTimePicker, /// User readable name of the instance. public override string ToString() { - var ret = new StringBuilder(); + StringBuilder ret = new StringBuilder(); foreach (FormatFragment fmt in _fragments) { ret.Append(fmt.GetDisplay(DateTime)); @@ -110,10 +110,7 @@ public string ActiveFragment /// /// Clear the active fragment. /// - public void ClearActiveFragment() - { - _activeFragment = -1; - } + public void ClearActiveFragment() => _activeFragment = -1; /// /// Gets and sets the date time currently used by the handler. @@ -405,8 +402,8 @@ public void InputDigit(char digit) // Rotate around the end of the fragments if (!HasActiveFragment) { - // Use event to show that we are overflowing - var cea = new CancelEventArgs(); + // Use evnet to show that we are overflowing + CancelEventArgs cea = new CancelEventArgs(); _timeText.OnAutoShiftOverflow(cea); // Event might be cancelled so check we want to overflow @@ -451,8 +448,8 @@ public void InputDigit(char digit) // Rotate around the end of the fragments if (!HasActiveFragment) { - // Use event to show that we are overflowing - var cea = new CancelEventArgs(); + // Use evnet to show that we are overflowing + CancelEventArgs cea = new CancelEventArgs(); _timeText.OnAutoShiftOverflow(cea); // Event might be cancelled so check we want to overflow @@ -549,7 +546,7 @@ public void Render(RenderContext context, Font font, Rectangle rect, totalWidth = rect.Width; } - var drawText = new Rectangle(rect.X + lastTotalWidth, rect.Y, + Rectangle drawText = new Rectangle(rect.X + lastTotalWidth, rect.Y, totalWidth - lastTotalWidth, rect.Height); if (drawText.Width > 0) { @@ -567,7 +564,7 @@ public void Render(RenderContext context, Font font, Rectangle rect, } else { - using (var fillBrush = new SolidBrush(foreColor)) + using (SolidBrush fillBrush = new SolidBrush(foreColor)) { context.Graphics.FillRectangle(fillBrush, drawText); } @@ -648,7 +645,7 @@ private void MeasureFragments(Graphics? g, Font font, DateTime dt) } // Update format with details of the ranges to measure - var measureFormat = new StringFormat(StringFormatFlags.FitBlackBox); + StringFormat measureFormat = new StringFormat(StringFormatFlags.FitBlackBox); measureFormat.SetMeasurableCharacterRanges(charRanges); // Perform measuring using the output of the last fragment (last frag must be the whole output string) @@ -663,7 +660,7 @@ private void MeasureFragments(Graphics? g, Font font, DateTime dt) private FormatFragmentList ParseFormatToFragments(string format) { - var fragList = new FormatFragmentList(); + FormatFragmentList fragList = new FormatFragmentList(); // Grab the string used for formatting var length = format.Length; @@ -1645,7 +1642,7 @@ public override void Render(RenderContext context) _formatHandler.DateTime = _dateTimePicker.Value; // Ask the format handler to perform actual rendering of the text - using var clipped = new Clipping(context.Graphics, ClientRectangle); + using Clipping clipped = new Clipping(context.Graphics, ClientRectangle); _formatHandler.Render(context, GetFont(), ClientRectangle, GetTextColor(), GetBackColor(), _dateTimePicker.Checked); diff --git a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawDocker.cs b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawDocker.cs index 6adc97815..ea4eb8256 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawDocker.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawDocker.cs @@ -306,13 +306,13 @@ public Size GetNonChildSize([DisallowNull] ViewLayoutContext context) Rectangle displayRect = context.DisplayRectangle; // Border size that is not applied to preferred size - Size borderSize = Size.Empty; + var borderSize = Size.Empty; // Accumulate the size that must be provided by docking edges and then filler - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Track the minimize size needed to satisfy the docking edges only - Size minimumSize = Size.Empty; + var minimumSize = Size.Empty; if (!IgnoreAllBorderAndPadding) { @@ -365,13 +365,13 @@ public override Size GetPreferredSize([DisallowNull] ViewLayoutContext context) Rectangle displayRect = context.DisplayRectangle; // Border size that is not applied to preferred size - Size borderSize = Size.Empty; + var borderSize = Size.Empty; // Accumulate the size that must be provided by docking edges and then filler - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Track the minimize size needed to satisfy the docking edges only - Size minimumSize = Size.Empty; + var minimumSize = Size.Empty; if (!IgnoreAllBorderAndPadding) { @@ -397,11 +397,11 @@ public override Size GetPreferredSize([DisallowNull] ViewLayoutContext context) } } - PaletteDrawBorders leftEdges = PaletteDrawBorders.All; - PaletteDrawBorders rightEdges = PaletteDrawBorders.All; - PaletteDrawBorders topEdges = PaletteDrawBorders.All; - PaletteDrawBorders bottomEdges = PaletteDrawBorders.All; - PaletteDrawBorders fillEdges = PaletteDrawBorders.All; + var leftEdges = PaletteDrawBorders.All; + var rightEdges = PaletteDrawBorders.All; + var topEdges = PaletteDrawBorders.All; + var bottomEdges = PaletteDrawBorders.All; + var fillEdges = PaletteDrawBorders.All; // Check for edge docking children foreach (ViewBase child in Reverse()) @@ -531,11 +531,11 @@ public override void Layout([DisallowNull] ViewLayoutContext context) context.DisplayRectangle = fillerRect; // By default all the children need to draw all their borders - PaletteDrawBorders leftEdges = PaletteDrawBorders.All; - PaletteDrawBorders rightEdges = PaletteDrawBorders.All; - PaletteDrawBorders topEdges = PaletteDrawBorders.All; - PaletteDrawBorders bottomEdges = PaletteDrawBorders.All; - PaletteDrawBorders fillEdges = PaletteDrawBorders.All; + var leftEdges = PaletteDrawBorders.All; + var rightEdges = PaletteDrawBorders.All; + var topEdges = PaletteDrawBorders.All; + var bottomEdges = PaletteDrawBorders.All; + var fillEdges = PaletteDrawBorders.All; // Position all except the filler foreach (ViewBase child in Reverse()) @@ -579,7 +579,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) } Rectangle borderRect = ClientRectangle; - Padding padding = Padding.Empty; + var padding = Padding.Empty; if (!IgnoreAllBorderAndPadding) { @@ -661,7 +661,7 @@ private void UpdateChildBorders(ViewBase child, if (RemoveChildBorders) { // Check if the view is a canvas - ViewDrawCanvas childCanvas = child as ViewDrawCanvas; + var childCanvas = child as ViewDrawCanvas; // Docking edge determines calculation switch (CalculateDock(GetDock(child), context.Control)) diff --git a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawGroupBoxDocker.cs b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawGroupBoxDocker.cs index b28b5e08e..b2e5db2fa 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawGroupBoxDocker.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawGroupBoxDocker.cs @@ -89,7 +89,7 @@ public override void RenderBefore([DisallowNull] RenderContext context) if (this[0].Visible) { // The first and only child is the caption content - ViewDrawContent caption = (ViewDrawContent)this[0]; + var caption = (ViewDrawContent)this[0]; // Cache the origina client rectangle before we modify it _cacheClientRect = ClientRectangle; @@ -163,7 +163,7 @@ public override void RenderAfter([DisallowNull] RenderContext context) public override void RenderBorder(RenderContext context) { // The first and only child is the caption content - ViewDrawContent caption = (ViewDrawContent)this[0]; + var caption = (ViewDrawContent)this[0]; // Remember current clipping region so we can put it back later Region clipRegion = context.Graphics.Clip.Clone(); diff --git a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawMenuColorBlock.cs b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawMenuColorBlock.cs index c73a6bce4..7dec51a8c 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawMenuColorBlock.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawMenuColorBlock.cs @@ -211,8 +211,8 @@ public override void RenderAfter([DisallowNull] RenderContext context) } // If not in normal state, then need to adorn display - Color outside = Color.Empty; - Color inside = Color.Empty; + var outside = Color.Empty; + var inside = Color.Empty; // Is this element selected? var selected = (KryptonContextMenuColorColumns.SelectedColor != null) && KryptonContextMenuColorColumns.SelectedColor.Equals(Color); @@ -253,10 +253,7 @@ public override void RenderAfter([DisallowNull] RenderContext context) #endregion #region Private - private void OnClick(object sender, EventArgs e) - { - KryptonContextMenuColorColumns.SelectedColor = Color; - } + private void OnClick(object sender, EventArgs e) => KryptonContextMenuColorColumns.SelectedColor = Color; #endregion } } diff --git a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawMenuMonthCalendar.cs b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawMenuMonthCalendar.cs index bbe846f4c..8982f5e64 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawMenuMonthCalendar.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawMenuMonthCalendar.cs @@ -117,7 +117,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) /// Render instance. public IRenderer GetRenderer() { - VisualContextMenu contextMenu = (VisualContextMenu)_provider.ProviderViewManager.Control; + var contextMenu = (VisualContextMenu)_provider.ProviderViewManager.Control; return contextMenu.Renderer; } @@ -128,7 +128,7 @@ public GetToolStripRenderer GetToolStripDelegate { get { - VisualContextMenu contextMenu = (VisualContextMenu)_provider.ProviderViewManager.Control; + var contextMenu = (VisualContextMenu)_provider.ProviderViewManager.Control; return contextMenu.CreateToolStripRenderer; } } diff --git a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawMonthDayNames.cs b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawMonthDayNames.cs index 3503d2bee..7619cebb1 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawMonthDayNames.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawMonthDayNames.cs @@ -77,7 +77,7 @@ public override Size GetPreferredSize([DisallowNull] ViewLayoutContext context) { Debug.Assert(context != null); - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Width is 7 days times the width of a day name preferredSize.Width = _months.SizeDays.Width * 7; diff --git a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawMonthDays.cs b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawMonthDays.cs index 60091f80b..1e2b415b3 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawMonthDays.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Draw/ViewDrawMonthDays.cs @@ -262,7 +262,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) } var skip = false; - PaletteState paletteState = PaletteState.Normal; + var paletteState = PaletteState.Normal; IPaletteTriple paletteTriple = _calendar.OverrideNormal; // If the display date is not within the allowed range, do not draw it @@ -391,7 +391,7 @@ public override void RenderBefore([DisallowNull] RenderContext context) if (_dayMementos[index] != null) { var skip = false; - PaletteState paletteState = PaletteState.Normal; + var paletteState = PaletteState.Normal; IPaletteTriple paletteTriple = _calendar.OverrideNormal; // If the display date is not within the allowed range, do not draw it diff --git a/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutCrumbs.cs b/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutCrumbs.cs index 4aac7d144..74e3fa5e7 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutCrumbs.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutCrumbs.cs @@ -93,9 +93,9 @@ public override Size GetPreferredSize(ViewLayoutContext context) SyncBreadCrumbs(); // We need to update the redirector for drawing each crumb - PaletteRedirectBreadCrumb redirect = _kryptonBreadCrumb.GetRedirector() as PaletteRedirectBreadCrumb; + var redirect = _kryptonBreadCrumb.GetRedirector() as PaletteRedirectBreadCrumb; - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; for(var i=1; i 0) @@ -242,7 +242,7 @@ public void SyncChildren() for (var i = 0; i < _imageIndexCount; i++) { var imageIndex = i + _imageIndexStart; - ViewDrawMenuImageSelectItem item = (ViewDrawMenuImageSelectItem)this[i]; + var item = (ViewDrawMenuImageSelectItem)this[i]; item.ImageList = _imageList; item.ImageIndex = imageIndex; item.Checked = _selectedIndex == imageIndex; diff --git a/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutMetricSpacer.cs b/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutMetricSpacer.cs index ff7971be7..a78ce2d6d 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutMetricSpacer.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutMetricSpacer.cs @@ -53,10 +53,7 @@ public override string ToString() => /// Updates the metrics source and metric to use. /// /// Source for aquiring metrics. - public void SetMetrics(IPaletteMetric paletteMetric) - { - _paletteMetric = paletteMetric; - } + public void SetMetrics(IPaletteMetric paletteMetric) => _paletteMetric = paletteMetric; /// /// Updates the metrics source and metric to use. diff --git a/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutMonths.cs b/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutMonths.cs index f0fba3f4b..bc5ce73e6 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutMonths.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutMonths.cs @@ -332,7 +332,7 @@ public DateTime DayNearPoint(Point pt) } } - ViewDrawMonth target = (ViewDrawMonth)this[ptCol + (ptRow * cols) + 1]; + var target = (ViewDrawMonth)this[ptCol + (ptRow * cols) + 1]; return target.ViewDrawMonthDays.DayNearPoint(pt); } @@ -511,7 +511,7 @@ public override Size GetPreferredSize([DisallowNull] ViewLayoutContext context) SyncData(context); SyncMonths(); - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; // Is there a today header to be measured? if (_drawHeader.Visible) @@ -801,7 +801,7 @@ private void OnShowToolTip(object sender, ToolTipEventArgs e) IContentValues? sourceContent = null; var toolTipStyle = LabelStyle.ToolTip; - bool shadow = true; + var shadow = true; // Find the button spec associated with the tooltip request ButtonSpec buttonSpec = ButtonManager.ButtonSpecFromView(e.Target); @@ -854,7 +854,7 @@ private void OnCancelToolTip(object sender, EventArgs e) => private void OnVisualPopupToolTipDisposed(object sender, EventArgs e) { // Unhook events from the specific instance that generated event - VisualPopupToolTip popupToolTip = (VisualPopupToolTip)sender; + var popupToolTip = (VisualPopupToolTip)sender; popupToolTip.Disposed -= OnVisualPopupToolTipDisposed; // Not showing a popup page any more diff --git a/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutStack.cs b/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutStack.cs index ae4c8787c..dafd22fe0 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutStack.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutStack.cs @@ -66,7 +66,7 @@ public override Size GetPreferredSize([DisallowNull] ViewLayoutContext context) Debug.Assert(context != null); // Accumulate the stacked size - Size preferredSize = Size.Empty; + var preferredSize = Size.Empty; foreach (ViewBase child in this) { diff --git a/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutViewport.cs b/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutViewport.cs index 6935d0f44..5cf763364 100644 --- a/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutViewport.cs +++ b/Source/Krypton Components/Krypton.Toolkit/View Layout/ViewLayoutViewport.cs @@ -27,7 +27,7 @@ public class ViewLayoutViewport : ViewComposite #region Instance Fields private readonly System.Windows.Forms.Timer _animationTimer; - private IPaletteMetric? _paletteMetrics; + private IPaletteMetric _paletteMetrics; private PaletteMetricPadding _metricPadding; private PaletteMetricInt _metricOvers; private RightToLeft _rightToLeft; @@ -117,10 +117,7 @@ public override string ToString() => /// Updates the metrics source and metric to use. /// /// Source for aquiring metrics. - public void SetMetrics(IPaletteMetric paletteMetric) - { - _paletteMetrics = paletteMetric; - } + public void SetMetrics(IPaletteMetric paletteMetric) => _paletteMetrics = paletteMetric; /// /// Updates the metrics source and metric to use. @@ -542,7 +539,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) childOffsetY = CalculateAlignedOffset(AlignmentRTL, positionRectangle.Y, positionRectangle.Height, _offset.Y, _extent.Height, _limit.Y); } - var childOffset = new Point(childOffsetX, childOffsetY); + Point childOffset = new Point(childOffsetX, childOffsetY); // Ask each child to layout in turn foreach (ViewBase child in this) @@ -554,7 +551,7 @@ public override void Layout([DisallowNull] ViewLayoutContext context) context.DisplayRectangle = positionRectangle; // Ask the child how much space they would like - var childSize = child.GetPreferredSize(context); + Size childSize = child.GetPreferredSize(context); // Do we need to fill any remainder space? if (FillSpace) @@ -605,7 +602,7 @@ public override void Render(RenderContext context) } // New clipping region is at most our own client size - using var combineRegion = new Region(clipRectangle); + using Region combineRegion = new Region(clipRectangle); // Remember the current clipping region Region clipRegion = context.Graphics.Clip.Clone(); diff --git a/Source/Krypton Components/Krypton.Workspace/Controls Workspace/KryptonWorkspace.cs b/Source/Krypton Components/Krypton.Workspace/Controls Workspace/KryptonWorkspace.cs index ee0a6f39f..6455eef79 100644 --- a/Source/Krypton Components/Krypton.Workspace/Controls Workspace/KryptonWorkspace.cs +++ b/Source/Krypton Components/Krypton.Workspace/Controls Workspace/KryptonWorkspace.cs @@ -132,28 +132,28 @@ internal class ControlList : List { } /// [Category(@"Workspace")] [Description(@"Occurs when a new KryptonWorkspaceCell instance is about to be added to the workspace.")] - public event EventHandler WorkspaceCellAdding; + public event EventHandler? WorkspaceCellAdding; /// /// Occurs when an existing KryptonWorkspaceCell instance has been removed from the workspace. /// [Category(@"Workspace")] [Description(@"Occurs when an existing KryptonWorkspaceCell instance has been removed from the workspace.")] - public event EventHandler WorkspaceCellRemoved; + public event EventHandler? WorkspaceCellRemoved; /// /// Occurs when the active cell value has changed. /// [Category(@"Workspace")] [Description(@"Occurs when the active cell value has changed.")] - public event EventHandler ActiveCellChanged; + public event EventHandler? ActiveCellChanged; /// /// Occurs when the active page value has changed. /// [Category(@"Workspace")] [Description(@"Occurs when the active page value has changed.")] - public event EventHandler ActivePageChanged; + public event EventHandler? ActivePageChanged; /// /// Occurs when the maximized cell value has changed. @@ -167,63 +167,63 @@ internal class ControlList : List { } /// [Category(@"Workspace")] [Description(@"Occurs when workspace layout information is saving.")] - public event EventHandler GlobalSaving; + public event EventHandler? GlobalSaving; /// /// Occurs when the workspace information is loading. /// [Category(@"Workspace")] [Description(@"Occurs when workspace layout information is loading.")] - public event EventHandler GlobalLoading; + public event EventHandler? GlobalLoading; /// /// Occurs when the workspace cell page information is saving. /// [Category(@"Workspace")] [Description(@"Occurs when workspace cell page information is saving.")] - public event EventHandler PageSaving; + public event EventHandler? PageSaving; /// /// Occurs when the workspace cell page information is loading. /// [Category(@"Workspace")] [Description(@"Occurs when the workspace cell page information is loading.")] - public event EventHandler PageLoading; + public event EventHandler? PageLoading; /// /// Occurs when the workspace cell page is loading but there is no existing matching page. /// [Category(@"Workspace")] [Description(@"Occurs when the workspace cell page is loading but there is no existing matching page.")] - public event EventHandler RecreateLoadingPage; + public event EventHandler? RecreateLoadingPage; /// /// Occurs when the loading process have completed and there are unmatched pages. /// [Category(@"Workspace")] [Description(@"Occurs when the loading process have completed and there are unmatched pages.")] - public event EventHandler PagesUnmatched; + public event EventHandler? PagesUnmatched; /// /// Occurs just before a page drag operation is started. /// [Category(@"Workspace")] [Description(@"Occurs just before a page drag operation is started.")] - public event EventHandler BeforePageDrag; + public event EventHandler? BeforePageDrag; /// /// Occurs after a page drag operation has finished/aborted. /// [Category(@"Workspace")] [Description(@"Occurs after a page drag operation has finished/aborted.")] - public event EventHandler AfterPageDrag; + public event EventHandler? AfterPageDrag; /// /// Occurs when a page is being dropped. /// [Category(@"Workspace")] [Description(@"Occurs when a page is being dropped.")] - public event EventHandler PageDrop; + public event EventHandler? PageDrop; #endregion #region Identity @@ -960,7 +960,7 @@ public int CellVisibleCount /// /// Unique name to search for. /// Cell containing unique name;otherwise null. - public KryptonWorkspaceCell? CellForUniqueName(string uniqueName) + public KryptonWorkspaceCell? CellForUniqueName(string? uniqueName) { // Do we have a valid string to search for? if (!string.IsNullOrEmpty(uniqueName)) @@ -1012,36 +1012,24 @@ public int CellVisibleCount /// /// Set the visible state of all the pages in the workspace to hidden. /// - public void HideAllPages() - { - UpdateAllPagesVisible(false, null); - } + public void HideAllPages() => UpdateAllPagesVisible(false, null); /// /// Set the visible state of all the pages in the workspace to hidden. /// /// Pages of this type are excluded from being updated. - public void HideAllPages(Type excludeType) - { - UpdateAllPagesVisible(false, excludeType); - } + public void HideAllPages(Type excludeType) => UpdateAllPagesVisible(false, excludeType); /// /// Set the visible state of all the pages in the workspace to showing. /// - public void ShowAllPages() - { - UpdateAllPagesVisible(true, null); - } + public void ShowAllPages() => UpdateAllPagesVisible(true, null); /// /// Set the visible state of all the pages in the workspace to showing. /// /// Pages of this type are excluded from being updated. - public void ShowAllPages(Type excludeType) - { - UpdateAllPagesVisible(true, excludeType); - } + public void ShowAllPages(Type excludeType) => UpdateAllPagesVisible(true, excludeType); /// /// Can the provided page be closed using the same logic as the close button on the cell. @@ -1175,7 +1163,7 @@ public void MovePageNext(KryptonPage page, bool selectPage) // If the cell that the page was moved from had the focus then set focus to follow the page if (selectPage && nextCell.AllowTabSelect && hadFocus) { - CellForPage(page).Select(); + CellForPage(page)?.Select(); } } } @@ -1221,7 +1209,7 @@ public void MovePagePrevious(KryptonPage page, bool selectPage) // If the cell that the page was moved from had the focus then set focus to follow the page if (selectPage && previousCell.AllowTabSelect && hadFocus) { - CellForPage(page).Select(); + CellForPage(page)?.Select(); } } } @@ -1229,10 +1217,7 @@ public void MovePagePrevious(KryptonPage page, bool selectPage) /// /// Re-balance the star sized items by setting them all to the same 50*,50* value. /// - public void ApplyRebalance() - { - ApplyResizing(Root, @"50*", @"50*", true, false); - } + public void ApplyRebalance() => ApplyResizing(Root, @"50*", @"50*", true, false); /// /// Apply new sizing values to each cell and sequence in the workspace hierarchy. @@ -1305,10 +1290,7 @@ public void ApplyResizing(KryptonWorkspaceSequence sequence, /// /// Move all pages into a new single cell that occupies the entire client area. /// - public void ApplySingleCell() - { - ApplySingleCell(true); - } + public void ApplySingleCell() => ApplySingleCell(true); /// /// Move all pages into a new single cell that occupies the entire client area. @@ -1374,19 +1356,13 @@ public void ApplySingleCell(bool createCellIfNoPages) /// /// Arrange existing cells into a square like grid. /// - public void ApplyGridCells() - { - ApplyGridCells(true); - } + public void ApplyGridCells() => ApplyGridCells(true); /// /// Arrange existing cells into a square like grid. /// /// Create new cells to fill blank areas of grid. - public void ApplyGridCells(bool createCellIfEmpty) - { - ApplyGridCells(createCellIfEmpty, Orientation.Vertical); - } + public void ApplyGridCells(bool createCellIfEmpty) => ApplyGridCells(createCellIfEmpty, Orientation.Vertical); /// /// Arrange existing cells into a square like grid. @@ -1511,19 +1487,13 @@ public void ApplyGridCells(bool createCellIfEmpty, /// /// Move each page into its own cell and arrange then in a square like grid. /// - public void ApplyGridPages() - { - ApplyGridPages(true); - } + public void ApplyGridPages() => ApplyGridPages(true); /// /// Move each page into its own cell and arrange then in a square like grid. /// /// If there are no pages found should a new root cell be created. - public void ApplyGridPages(bool createCellIfNoPages) - { - ApplyGridPages(createCellIfNoPages, Orientation.Vertical); - } + public void ApplyGridPages(bool createCellIfNoPages) => ApplyGridPages(createCellIfNoPages, Orientation.Vertical); /// /// Move each page into its own cell and arrange then in a square like grid. @@ -1775,10 +1745,7 @@ public byte[] SaveLayoutToArray(Encoding encoding) /// Saves workspace layout information into a named file using Unicode Encoding. /// /// Name of file to save to. - public void SaveLayoutToFile(string filename) - { - SaveLayoutToFile(filename, Encoding.Unicode); - } + public void SaveLayoutToFile(string filename) => SaveLayoutToFile(filename, Encoding.Unicode); /// /// Saves workspace layout information into a named file. @@ -1836,7 +1803,7 @@ public void SaveLayoutToXml(XmlWriter xmlWriter) xmlWriter.WriteAttributeString(@"V", @"1"); // Remember which page was the active one - xmlWriter.WriteAttributeString(@"A", ActivePage != null ? ActivePage.UniqueName : @"(null)"); + xmlWriter.WriteAttributeString(@"A", ActivePage?.UniqueName ?? @"(null)"); // Give event handlers chance to embed custom data xmlWriter.WriteStartElement(@"CGD"); @@ -1909,10 +1876,7 @@ public void LoadLayoutFromStream(Stream stream) /// Loads workspace layout information using the provided xml reader. /// /// Xml reader object. - public void LoadLayoutFromXml(XmlReader xmlReader) - { - LoadLayoutFromXml(xmlReader, CopyToPageCollection()); - } + public void LoadLayoutFromXml(XmlReader xmlReader) => LoadLayoutFromXml(xmlReader, CopyToPageCollection()); /// /// Loads workspace layout information using the provided xml reader. @@ -2268,64 +2232,43 @@ public virtual void WritePageElement(XmlWriter xmlWriter, KryptonPage page) /// Raises the GlobalSaving event. /// /// Event data. - public virtual void OnGlobalSaving(XmlSavingEventArgs e) - { - GlobalSaving?.Invoke(this, e); - } + public virtual void OnGlobalSaving(XmlSavingEventArgs e) => GlobalSaving?.Invoke(this, e); /// /// Raises the GlobalLoading event. /// /// Event data. - public virtual void OnGlobalLoading(XmlLoadingEventArgs e) - { - GlobalLoading?.Invoke(this, e); - } + public virtual void OnGlobalLoading(XmlLoadingEventArgs e) => GlobalLoading?.Invoke(this, e); /// /// Raises the PageSaving event. /// /// Event data. - public virtual void OnPageSaving(PageSavingEventArgs e) - { - PageSaving?.Invoke(this, e); - } + public virtual void OnPageSaving(PageSavingEventArgs e) => PageSaving?.Invoke(this, e); /// /// Raises the PageLoading event. /// /// Event data. - public virtual void OnPageLoading(PageLoadingEventArgs e) - { - PageLoading?.Invoke(this, e); - } + public virtual void OnPageLoading(PageLoadingEventArgs e) => PageLoading?.Invoke(this, e); /// /// Raises the RecreateLoadingPage event. /// /// Event data. - public virtual void OnRecreateLoadingPage(RecreateLoadingPageEventArgs e) - { - RecreateLoadingPage?.Invoke(this, e); - } + public virtual void OnRecreateLoadingPage(RecreateLoadingPageEventArgs e) => RecreateLoadingPage?.Invoke(this, e); /// /// Raises the PagesUnmatched event. /// /// Event data. - public virtual void OnPagesUnmatched(PagesUnmatchedEventArgs e) - { - PagesUnmatched?.Invoke(this, e); - } + public virtual void OnPagesUnmatched(PagesUnmatchedEventArgs e) => PagesUnmatched?.Invoke(this, e); /// /// Internal design time method. /// [EditorBrowsable(EditorBrowsableState.Never)] - public void SuspendWorkspaceLayout() - { - _suspendWorkspace++; - } + public void SuspendWorkspaceLayout() => _suspendWorkspace++; /// /// Internal design time method. @@ -2345,10 +2288,7 @@ public void ResumeWorkspaceLayout() /// [Browsable(false)] [EditorBrowsable(EditorBrowsableState.Never)] - public virtual void DebugOutput() - { - Root.DebugOutput(1); - } + public virtual void DebugOutput() => Root.DebugOutput(1); #endregion #region Protected @@ -2357,10 +2297,7 @@ public virtual void DebugOutput() /// /// Source of the event. /// Arguments associated with the event. - protected void OnChildrenPropertyChanged(object sender, PropertyChangedEventArgs e) - { - PerformNeedPaint(true); - } + protected void OnChildrenPropertyChanged(object sender, PropertyChangedEventArgs e) => PerformNeedPaint(true); /// /// Request to toggle the maximized state. @@ -2702,19 +2639,13 @@ protected override void WndProc(ref Message m) /// Raises the CellCountChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnCellCountChanged(EventArgs e) - { - CellCountChanged?.Invoke(this, e); - } + protected virtual void OnCellCountChanged(EventArgs e) => CellCountChanged?.Invoke(this, e); /// /// Raises the CellVisibleCountChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnCellVisibleCountChanged(EventArgs e) - { - CellVisibleCountChanged?.Invoke(this, e); - } + protected virtual void OnCellVisibleCountChanged(EventArgs e) => CellVisibleCountChanged?.Invoke(this, e); /// /// Raises the WorkspaceCellAdding event. @@ -2742,10 +2673,7 @@ protected virtual void OnWorkspaceCellRemoved(WorkspaceCellEventArgs e) /// Raises the ActiveCellChanged event. /// /// An ActiveCellChangedEventArgs containing the event data. - protected virtual void OnActiveCellChanged(ActiveCellChangedEventArgs e) - { - ActiveCellChanged?.Invoke(this, e); - } + protected virtual void OnActiveCellChanged(ActiveCellChangedEventArgs e) => ActiveCellChanged?.Invoke(this, e); /// /// Raises the ActivePageChanged event. @@ -2764,37 +2692,25 @@ protected virtual void OnActivePageChanged(ActivePageChangedEventArgs e) /// Raises the MaximizedCellChanged event. /// /// An EventArgs containing the event data. - protected virtual void OnMaximizedCellChanged(EventArgs e) - { - MaximizedCellChanged?.Invoke(this, e); - } + protected virtual void OnMaximizedCellChanged(EventArgs e) => MaximizedCellChanged?.Invoke(this, e); /// /// Raises the BeforePageDrag event. /// /// A PageDragCancelEventArgs containing event details. - protected virtual void OnBeforePageDrag(PageDragCancelEventArgs de) - { - BeforePageDrag?.Invoke(this, de); - } + protected virtual void OnBeforePageDrag(PageDragCancelEventArgs de) => BeforePageDrag?.Invoke(this, de); /// /// Raises the AfterPageDrag event. /// /// A PageDragEndEventArgs containing event details. - protected virtual void OnAfterPageDrag(PageDragEndEventArgs e) - { - AfterPageDrag?.Invoke(this, e); - } + protected virtual void OnAfterPageDrag(PageDragEndEventArgs e) => AfterPageDrag?.Invoke(this, e); /// /// Raises the PageDrop event. /// /// A v containing event details. - protected internal virtual void OnPageDrop(PageDropEventArgs e) - { - PageDrop?.Invoke(this, e); - } + protected internal virtual void OnPageDrop(PageDropEventArgs e) => PageDrop?.Invoke(this, e); /// /// Initialize a new cell. @@ -2889,7 +2805,7 @@ internal void SeparatorMoved(ViewDrawWorkspaceSeparator separator, Point splitter) { // Get the sequence that contains the items moved - KryptonWorkspaceSequence parentSequence = (KryptonWorkspaceSequence)separator.WorkspaceItem.WorkspaceParent; + var parentSequence = (KryptonWorkspaceSequence)separator.WorkspaceItem.WorkspaceParent; SeparatorToItems(separator, out IWorkspaceItem after, out IWorkspaceItem? before); // At design time we can get null references @@ -3580,7 +3496,7 @@ private static void SeparatorToItems(ViewDrawWorkspaceSeparator separator, after = separator.WorkspaceItem; // Workspace item before the separator (to the left or above) - KryptonWorkspaceSequence beforeSequence = (KryptonWorkspaceSequence)after.WorkspaceParent; + var beforeSequence = (KryptonWorkspaceSequence)after.WorkspaceParent; // Previous items might be invisible and so search till we find the visible one we expect before = null; @@ -3809,7 +3725,7 @@ private void SetActiveCellRaw(KryptonWorkspaceCell newCell) private void OnCellEnter(object sender, EventArgs e) { - KryptonWorkspaceCell cell = (KryptonWorkspaceCell)sender; + var cell = (KryptonWorkspaceCell)sender; ActiveCell = cell; } @@ -3818,7 +3734,7 @@ private void OnCellSelectedPageChanged(object sender, EventArgs e) if (!IsActivePageChangedEventSuspended) { // If change occurred on the active cell - KryptonWorkspaceCell cell = (KryptonWorkspaceCell)sender; + var cell = (KryptonWorkspaceCell)sender; if (cell == ActiveCell) { if (cell.SelectedPage != ActivePage) @@ -3911,7 +3827,7 @@ private void OnCellShowContextMenu(object sender, ShowContextMenuArgs e) private void OnCellClosedContextMenu(object sender, ToolStripDropDownClosedEventArgs e) { // Unhook from context menu - KryptonContextMenu contextMenu = (KryptonContextMenu)sender; + var contextMenu = (KryptonContextMenu)sender; contextMenu.Closed -= OnCellClosedContextMenu; // Remove our menu items as we only want them to be inside the currently showing context menu @@ -3931,7 +3847,7 @@ private void OnCellCtrlTabWrap(object sender, CtrlTabCancelEventArgs e) e.Cancel = true; // Remember the starting cell for the search - KryptonWorkspaceCell? cell = sender as KryptonWorkspaceCell; + var cell = sender as KryptonWorkspaceCell; KryptonWorkspaceCell? next = cell; // There should always be a cell sending this event, but just in case! @@ -3999,25 +3915,13 @@ private void OnPageMovePrevious(object sender, EventArgs e) ClearContextMenuCache(); } - private void OnPageSplitVert(object sender, EventArgs e) - { - PageSplitDirection(_menuCell, _menuPage, Orientation.Vertical); - } + private void OnPageSplitVert(object sender, EventArgs e) => PageSplitDirection(_menuCell, _menuPage, Orientation.Vertical); - private void OnPageSplitHorz(object sender, EventArgs e) - { - PageSplitDirection(_menuCell, _menuPage, Orientation.Horizontal); - } + private void OnPageSplitHorz(object sender, EventArgs e) => PageSplitDirection(_menuCell, _menuPage, Orientation.Horizontal); - private void OnPageMaximizeRestore(object sender, EventArgs e) - { - MaximizedCell = MaximizedCell != null ? null : _menuCell; - } + private void OnPageMaximizeRestore(object sender, EventArgs e) => MaximizedCell = MaximizedCell != null ? null : _menuCell; - private void OnPageRebalance(object sender, EventArgs e) - { - ApplyRebalance(); - } + private void OnPageRebalance(object sender, EventArgs e) => ApplyRebalance(); private void PageSplitDirection(KryptonWorkspaceCell cell, KryptonPage page, @@ -4084,24 +3988,15 @@ private void ClearContextMenuCache() _menuCell = null; } - private void SuspendActivePageChangedEvent() - { - _suspendActivePageChangedEvent++; - } + private void SuspendActivePageChangedEvent() => _suspendActivePageChangedEvent++; - private void ResumeActivePageChangedEvent() - { - _suspendActivePageChangedEvent--; - } + private void ResumeActivePageChangedEvent() => _suspendActivePageChangedEvent--; private bool IsActivePageChangedEventSuspended => (_suspendActivePageChangedEvent > 0); - private Control? GetActiverPageControlWithFocus() - { - return ActivePage != null - ? GetControlWithFocus(ActivePage) + private Control? GetActiverPageControlWithFocus() => ActivePage != null + ? GetControlWithFocus(ActivePage) : null; - } private Control? GetControlWithFocus(Control control) { diff --git a/Source/Krypton Components/Krypton.Workspace/Controls Workspace/KryptonWorkspaceCell.cs b/Source/Krypton Components/Krypton.Workspace/Controls Workspace/KryptonWorkspaceCell.cs index 0cb2e63a5..2a5c4545a 100644 --- a/Source/Krypton Components/Krypton.Workspace/Controls Workspace/KryptonWorkspaceCell.cs +++ b/Source/Krypton Components/Krypton.Workspace/Controls Workspace/KryptonWorkspaceCell.cs @@ -28,7 +28,7 @@ public class KryptonWorkspaceCell : KryptonNavigator, { #region Instance Fields - private IWorkspaceItem _parent; + private IWorkspaceItem? _parent; private bool _disposeOnRemove; private bool _events; //seb @@ -40,7 +40,7 @@ public class KryptonWorkspaceCell : KryptonNavigator, /// /// Occurs after a change has occurred to the collection. /// - public event PropertyChangedEventHandler PropertyChanged; + public event PropertyChangedEventHandler? PropertyChanged; /// /// Occurs when the user clicks the maximize/restore button. @@ -109,7 +109,7 @@ protected override void Dispose(bool disposing) // Must remove from parent workspace manually because the control collection is readonly if (Parent != null) { - KryptonReadOnlyControls controls = (KryptonReadOnlyControls)Parent.Controls; + var controls = (KryptonReadOnlyControls)Parent.Controls; controls.RemoveInternal(this); } @@ -291,7 +291,7 @@ public override Size MaximumSize [Browsable(false)] [EditorBrowsable(EditorBrowsableState.Never)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public IWorkspaceItem WorkspaceParent + public IWorkspaceItem? WorkspaceParent { get => _parent; @@ -596,7 +596,7 @@ protected override void SetVisibleCore(bool value) /// /// Gets the child panel used for displaying actual pages. /// - protected internal KryptonGroupPanel CellChildPanel => ChildPanel; + protected internal KryptonGroupPanel? CellChildPanel => ChildPanel; /// /// Called by the designer to hit test a point. @@ -610,17 +610,14 @@ protected override void SetVisibleCore(bool value) /// /// Point to be tested. /// Component associated with point or null. - protected internal Component CellDesignerComponentFromPoint(Point pt) => DesignerComponentFromPoint(pt); + protected internal Component? CellDesignerComponentFromPoint(Point pt) => DesignerComponentFromPoint(pt); /// /// Called by the designer to indicate that the mouse has left the control. /// - protected internal void CellDesignerMouseLeave() - { + protected internal void CellDesignerMouseLeave() => // ReSharper disable RedundantBaseQualifier - base.DesignerMouseLeave(); - // ReSharper restore RedundantBaseQualifier - } + base.DesignerMouseLeave();// ReSharper restore RedundantBaseQualifier /// /// Raises the PropertyChanged event. diff --git a/Source/Krypton Components/Krypton.Workspace/Controls Workspace/KryptonWorkspaceCollection.cs b/Source/Krypton Components/Krypton.Workspace/Controls Workspace/KryptonWorkspaceCollection.cs index a02989e8d..b3165220b 100644 --- a/Source/Krypton Components/Krypton.Workspace/Controls Workspace/KryptonWorkspaceCollection.cs +++ b/Source/Krypton Components/Krypton.Workspace/Controls Workspace/KryptonWorkspaceCollection.cs @@ -30,7 +30,7 @@ public class KryptonWorkspaceCollection : TypedRestrictCollection /// /// Occurs after a change has occurred to the collection. /// - public event PropertyChangedEventHandler PropertyChanged; + public event PropertyChangedEventHandler? PropertyChanged; /// /// Occurs when the user clicks the maximize/restore button. @@ -182,38 +182,26 @@ protected override void OnCleared(EventArgs e) /// /// Source of the event. /// Event arguments associated with the event. - protected void OnChildPropertyChanged(object sender, PropertyChangedEventArgs e) - { - OnPropertyChanged(e); - } + protected void OnChildPropertyChanged(object sender, PropertyChangedEventArgs e) => OnPropertyChanged(e); /// /// Handle a maximize/restore request from a child item. /// /// Source of the event. /// Event arguments associated with the event. - protected void OnChildMaximizeRestoreClicked(object sender, EventArgs e) - { - MaximizeRestoreClicked?.Invoke(sender, e); - } + protected void OnChildMaximizeRestoreClicked(object sender, EventArgs e) => MaximizeRestoreClicked?.Invoke(sender, e); /// /// Raises the PropertyChanged event. /// /// Name of the property that has changed. - protected virtual void OnPropertyChanged(string property) - { - OnPropertyChanged(new PropertyChangedEventArgs(property)); - } + protected virtual void OnPropertyChanged(string property) => OnPropertyChanged(new PropertyChangedEventArgs(property)); /// /// Raises the PropertyChanged event. /// /// Event arguments associated with the event. - protected virtual void OnPropertyChanged(PropertyChangedEventArgs e) - { - PropertyChanged?.Invoke(this, e); - } + protected virtual void OnPropertyChanged(PropertyChangedEventArgs e) => PropertyChanged?.Invoke(this, e); #endregion } } diff --git a/Source/Krypton Components/Krypton.Workspace/Controls Workspace/KryptonWorkspaceSequence.cs b/Source/Krypton Components/Krypton.Workspace/Controls Workspace/KryptonWorkspaceSequence.cs index 9581d6d41..e6d7f6b16 100644 --- a/Source/Krypton Components/Krypton.Workspace/Controls Workspace/KryptonWorkspaceSequence.cs +++ b/Source/Krypton Components/Krypton.Workspace/Controls Workspace/KryptonWorkspaceSequence.cs @@ -37,7 +37,7 @@ public class KryptonWorkspaceSequence : Component, /// Occurs after a change has occurred to the workspace. /// [Browsable(false)] - public event PropertyChangedEventHandler PropertyChanged; + public event PropertyChangedEventHandler? PropertyChanged; /// /// Occurs when the user clicks the maximize/restore button. @@ -65,8 +65,8 @@ public KryptonWorkspaceSequence(Orientation orientation) // Create the child collection for holding items Children = new KryptonWorkspaceCollection(this); - Children.PropertyChanged += OnChildrenPropertyChanged!; - Children.MaximizeRestoreClicked += OnChildrenMaximizeRestoreClicked!; + Children.PropertyChanged += OnChildrenPropertyChanged; + Children.MaximizeRestoreClicked += OnChildrenMaximizeRestoreClicked; // Default properties _setVisible = true; @@ -90,7 +90,7 @@ protected override void Dispose(bool disposing) Children[i].Dispose(); } - Children.PropertyChanged -= OnChildrenPropertyChanged!; + Children.PropertyChanged -= OnChildrenPropertyChanged; Children.Clear(); } } @@ -210,10 +210,7 @@ public string UniqueName /// /// Resets the UniqueName property to its default value. /// - public void ResetUniqueName() - { - UniqueName = CommonHelper.UniqueString; - } + public void ResetUniqueName() => UniqueName = CommonHelper.UniqueString; /// /// Perform any compacting actions allowed by the flags. @@ -265,7 +262,7 @@ public Size WorkspacePreferredSize { get { - Size totalSize = Size.Empty; + var totalSize = Size.Empty; // Search all the children to find the largest preferred size in each direction if (Children != null) @@ -319,7 +316,7 @@ public Size WorkspaceMinSize { get { - Size minSize = Size.Empty; + var minSize = Size.Empty; // Search all the children to find the largest minimum/fixed size if (Children != null) @@ -616,38 +613,26 @@ public void DebugOutput(int indent) /// /// Source of the event. /// Event arguments associated with the event. - protected void OnChildrenPropertyChanged(object sender, PropertyChangedEventArgs e) - { - OnPropertyChanged(e); - } + protected void OnChildrenPropertyChanged(object sender, PropertyChangedEventArgs e) => OnPropertyChanged(e); /// /// Handle a maximize/restore request from a child item. /// /// Source of the event. /// Event arguments associated with the event. - protected void OnChildrenMaximizeRestoreClicked(object sender, EventArgs e) - { - MaximizeRestoreClicked(sender, e); - } + protected void OnChildrenMaximizeRestoreClicked(object sender, EventArgs e) => MaximizeRestoreClicked?.Invoke(sender, e); /// /// Raises the PropertyChanged event. /// /// Name of property that has changed. - protected virtual void OnPropertyChanged(string property) - { - OnPropertyChanged(new PropertyChangedEventArgs(property)); - } + protected virtual void OnPropertyChanged(string property) => OnPropertyChanged(new PropertyChangedEventArgs(property)); /// /// Raises the PropertyChanged event. /// /// A PropertyChangedEventArgs containing the event data. - protected virtual void OnPropertyChanged(PropertyChangedEventArgs e) - { - PropertyChanged(this, e); - } + protected virtual void OnPropertyChanged(PropertyChangedEventArgs e) => PropertyChanged?.Invoke(this, e); #endregion #region Implementation diff --git a/Source/Krypton Components/Krypton.Workspace/Controls Workspace/KryptonWorkspaceSequenceConverter.cs b/Source/Krypton Components/Krypton.Workspace/Controls Workspace/KryptonWorkspaceSequenceConverter.cs index a9ecc5352..ca4f50c8a 100644 --- a/Source/Krypton Components/Krypton.Workspace/Controls Workspace/KryptonWorkspaceSequenceConverter.cs +++ b/Source/Krypton Components/Krypton.Workspace/Controls Workspace/KryptonWorkspaceSequenceConverter.cs @@ -51,7 +51,7 @@ public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destina // Can always convert to a string representation if (destinationType == typeof(string)) { - KryptonWorkspaceSequence? sequence = value as KryptonWorkspaceSequence; + var sequence = value as KryptonWorkspaceSequence; return sequence?.ToString(); } diff --git a/Source/Krypton Components/Krypton.Workspace/Dragging/DragTargetWorkspace.cs b/Source/Krypton Components/Krypton.Workspace/Dragging/DragTargetWorkspace.cs index 55fba83a2..b78f7bd98 100644 --- a/Source/Krypton Components/Krypton.Workspace/Dragging/DragTargetWorkspace.cs +++ b/Source/Krypton Components/Krypton.Workspace/Dragging/DragTargetWorkspace.cs @@ -84,7 +84,7 @@ protected override void Dispose(bool disposing) var e = new PageDropEventArgs(page); workspace.OnPageDrop(e); - if (e is { Cancel: false, Page: { } }) + if (e is { Cancel: false, Page: not null }) { target.Pages.Add(e.Page); ret = e.Page; diff --git a/Source/Krypton Components/Krypton.Workspace/General/CellPageNotify.cs b/Source/Krypton Components/Krypton.Workspace/General/CellPageNotify.cs index 2d822f84a..ec67acf09 100644 --- a/Source/Krypton Components/Krypton.Workspace/General/CellPageNotify.cs +++ b/Source/Krypton Components/Krypton.Workspace/General/CellPageNotify.cs @@ -37,20 +37,14 @@ public class CellPageNotify : IDragPageNotify /// Source of the page drag; should never be null. /// Navigator instance associated with source; can be null. /// Event arguments indicating list of pages being dragged. - public void PageDragStart(object sender, KryptonNavigator? navigator, PageDragCancelEventArgs e) - { - _workspace.InternalPageDragStart(sender, navigator, e); - } + public void PageDragStart(object sender, KryptonNavigator? navigator, PageDragCancelEventArgs e) => _workspace.InternalPageDragStart(sender, navigator, e); /// /// Occurs when the mouse moves during the drag operation. /// /// Source of the page drag; can be null. /// Event arguments containing the new screen point of the mouse. - public void PageDragMove(object sender, PointEventArgs e) - { - _workspace.InternalPageDragMove(sender as KryptonNavigator, e); - } + public void PageDragMove(object sender, PointEventArgs e) => _workspace.InternalPageDragMove(sender as KryptonNavigator, e); /// /// Occurs when drag operation completes with pages being dropped. @@ -64,10 +58,7 @@ public void PageDragMove(object sender, PointEventArgs e) /// Occurs when dragging pages has been cancelled. /// /// Source of the page drag; can be null. - public void PageDragQuit(object sender) - { - _workspace.InternalPageDragQuit(sender as KryptonNavigator); - } + public void PageDragQuit(object sender) => _workspace.InternalPageDragQuit(sender as KryptonNavigator); #endregion } } diff --git a/Source/Krypton Components/Krypton.Workspace/General/Definitions.cs b/Source/Krypton Components/Krypton.Workspace/General/Definitions.cs index 063bc099e..d1c37fc50 100644 --- a/Source/Krypton Components/Krypton.Workspace/General/Definitions.cs +++ b/Source/Krypton Components/Krypton.Workspace/General/Definitions.cs @@ -58,9 +58,9 @@ public enum CompactFlags public interface IWorkspaceItem { /// - /// Occures when a property changes that affects workspace layout. + /// Occurs when a property changes that affects workspace layout. /// - event PropertyChangedEventHandler PropertyChanged; + event PropertyChangedEventHandler? PropertyChanged; /// /// Occurs when the user clicks the maximize/restore button. diff --git a/Source/Krypton Components/Krypton.Workspace/Palette/WorkspacePageMenu.cs b/Source/Krypton Components/Krypton.Workspace/Palette/WorkspacePageMenu.cs index 1be29b5d7..1a792a420 100644 --- a/Source/Krypton Components/Krypton.Workspace/Palette/WorkspacePageMenu.cs +++ b/Source/Krypton Components/Krypton.Workspace/Palette/WorkspacePageMenu.cs @@ -106,10 +106,7 @@ public WorkspaceMenus(KryptonWorkspace workspace) /// /// Resets the TextClose property to its default value. /// - public void ResetTextClose() - { - TextClose = DEFAULT_TEXT_CLOSE; - } + public void ResetTextClose() => TextClose = DEFAULT_TEXT_CLOSE; #endregion #region TextCloseAllButThis @@ -126,10 +123,7 @@ public void ResetTextClose() /// /// Resets the TextCloseAllButThis property to its default value. /// - public void ResetTextCloseAllButThis() - { - TextCloseAllButThis = DEFAULT_TEXT_CLOSE_ALL_BUT_THIS; - } + public void ResetTextCloseAllButThis() => TextCloseAllButThis = DEFAULT_TEXT_CLOSE_ALL_BUT_THIS; #endregion #region TextMoveNext @@ -146,10 +140,7 @@ public void ResetTextCloseAllButThis() /// /// Resets the TextMoveNext property to its default value. /// - public void ResetTextMoveNext() - { - TextMoveNext = DEFAULT_TEXT_MOVE_NEXT; - } + public void ResetTextMoveNext() => TextMoveNext = DEFAULT_TEXT_MOVE_NEXT; #endregion #region TextMovePrevious @@ -166,10 +157,7 @@ public void ResetTextMoveNext() /// /// Resets the TextMovePrevious property to its default value. /// - public void ResetTextMovePrevious() - { - TextMovePrevious = DEFAULT_TEXT_MOVE_PREVIOUS; - } + public void ResetTextMovePrevious() => TextMovePrevious = DEFAULT_TEXT_MOVE_PREVIOUS; #endregion #region TextSplitVertical @@ -186,10 +174,7 @@ public void ResetTextMovePrevious() /// /// Resets the TextSplitVertical property to its default value. /// - public void ResetTextSplitVertical() - { - TextSplitVertical = DEFAULT_TEXT_SPLIT_VERTICAL; - } + public void ResetTextSplitVertical() => TextSplitVertical = DEFAULT_TEXT_SPLIT_VERTICAL; #endregion #region TextSplitHorizontal @@ -206,10 +191,7 @@ public void ResetTextSplitVertical() /// /// Resets the TextSplitHorizontal property to its default value. /// - public void ResetTextSplitHorizontal() - { - TextSplitHorizontal = DEFAULT_TEXT_SPLIT_HORIZONTAL; - } + public void ResetTextSplitHorizontal() => TextSplitHorizontal = DEFAULT_TEXT_SPLIT_HORIZONTAL; #endregion #region TextRebalance @@ -226,10 +208,7 @@ public void ResetTextSplitHorizontal() /// /// Resets the TextRebalance property to its default value. /// - public void ResetTextRebalance() - { - TextRebalance = DEFAULT_TEXT_REBALANCE; - } + public void ResetTextRebalance() => TextRebalance = DEFAULT_TEXT_REBALANCE; #endregion #region TextMaximize @@ -246,10 +225,7 @@ public void ResetTextRebalance() /// /// Resets the TextMaximize property to its default value. /// - public void ResetTextMaximize() - { - TextMaximize = DEFAULT_TEXT_MAXIMIZE; - } + public void ResetTextMaximize() => TextMaximize = DEFAULT_TEXT_MAXIMIZE; #endregion #region TextRestore @@ -266,10 +242,7 @@ public void ResetTextMaximize() /// /// Resets the TextRestore property to its default value. /// - public void ResetTextRestore() - { - TextRestore = DEFAULT_TEXT_RESTORE; - } + public void ResetTextRestore() => TextRestore = DEFAULT_TEXT_RESTORE; #endregion #region ShortcutClose @@ -290,10 +263,7 @@ public void ResetTextRestore() /// /// Resets the ShortcutClose property to its default value. /// - public void ResetShortcutClose() - { - ShortcutClose = DEFAULT_SHORTCUT_CLOSE; - } + public void ResetShortcutClose() => ShortcutClose = DEFAULT_SHORTCUT_CLOSE; #endregion #region ShortcutCloseAllButThis @@ -314,10 +284,7 @@ public void ResetShortcutClose() /// /// Resets the ShortcutCloseAllButThis property to its default value. /// - public void ResetShortcutCloseAllButThis() - { - ShortcutCloseAllButThis = DEFAULT_SHORTCUT_CLOSE_ALL_BUT_THIS; - } + public void ResetShortcutCloseAllButThis() => ShortcutCloseAllButThis = DEFAULT_SHORTCUT_CLOSE_ALL_BUT_THIS; #endregion #region ShortcutMoveNext @@ -338,10 +305,7 @@ public void ResetShortcutCloseAllButThis() /// /// Resets the ShortcutMoveNext property to its default value. /// - public void ResetShortcutMoveNext() - { - ShortcutMoveNext = DEFAULT_SHORTCUT_MOVE_NEXT; - } + public void ResetShortcutMoveNext() => ShortcutMoveNext = DEFAULT_SHORTCUT_MOVE_NEXT; #endregion #region ShortcutMovePrevious @@ -362,10 +326,7 @@ public void ResetShortcutMoveNext() /// /// Resets the ShortcutMovePrevious property to its default value. /// - public void ResetShortcutMovePrevious() - { - ShortcutMovePrevious = DEFAULT_SHORTCUT_MOVE_PREVIOUS; - } + public void ResetShortcutMovePrevious() => ShortcutMovePrevious = DEFAULT_SHORTCUT_MOVE_PREVIOUS; #endregion #region ShortcutSplitVertical @@ -386,10 +347,7 @@ public void ResetShortcutMovePrevious() /// /// Resets the ShortcutSplitVertical property to its default value. /// - public void ResetShortcutSplitVertical() - { - ShortcutSplitVertical = DEFAULT_SHORTCUT_SPLIT_VERTICAL; - } + public void ResetShortcutSplitVertical() => ShortcutSplitVertical = DEFAULT_SHORTCUT_SPLIT_VERTICAL; #endregion #region ShortcutSplitHorizontal @@ -410,10 +368,7 @@ public void ResetShortcutSplitVertical() /// /// Resets the ShortcutSplitHorizontal property to its default value. /// - public void ResetShortcutSplitHorizontal() - { - ShortcutSplitHorizontal = DEFAULT_SHORTCUT_SPLIT_HORIZONTAL; - } + public void ResetShortcutSplitHorizontal() => ShortcutSplitHorizontal = DEFAULT_SHORTCUT_SPLIT_HORIZONTAL; #endregion #region ShortcutRebalance @@ -434,10 +389,7 @@ public void ResetShortcutSplitHorizontal() /// /// Resets the ShortcutRebalance property to its default value. /// - public void ResetShortcutRebalance() - { - ShortcutRebalance = DEFAULT_SHORTCUT_REBALANCE; - } + public void ResetShortcutRebalance() => ShortcutRebalance = DEFAULT_SHORTCUT_REBALANCE; #endregion #region ShortcutMaximizeRestore @@ -458,10 +410,7 @@ public void ResetShortcutRebalance() /// /// Resets the ShortcutMaximizeRestore property to its default value. /// - public void ResetShortcutMaximizeRestore() - { - ShortcutMaximizeRestore = DEFAULT_SHORTCUT_MAXIMIZE_RESTORE; - } + public void ResetShortcutMaximizeRestore() => ShortcutMaximizeRestore = DEFAULT_SHORTCUT_MAXIMIZE_RESTORE; #endregion #region ShowContextMenu diff --git a/Source/Krypton Components/Krypton.Workspace/View Draw/ViewDrawWorkspaceSeparator.cs b/Source/Krypton Components/Krypton.Workspace/View Draw/ViewDrawWorkspaceSeparator.cs index 83eb2912b..44d3317c8 100644 --- a/Source/Krypton Components/Krypton.Workspace/View Draw/ViewDrawWorkspaceSeparator.cs +++ b/Source/Krypton Components/Krypton.Workspace/View Draw/ViewDrawWorkspaceSeparator.cs @@ -97,10 +97,7 @@ public bool SeparatorMoving(Point mouse, Point splitter) => /// /// Current mouse position in client area. /// Current position of the splitter. - public void SeparatorMoved(Point mouse, Point splitter) - { - _workspace.SeparatorMoved(this, mouse, splitter); - } + public void SeparatorMoved(Point mouse, Point splitter) => _workspace.SeparatorMoved(this, mouse, splitter); /// /// Indicates the separator has not been moved. diff --git a/Source/Krypton Components/Krypton.Workspace/Workspace/KryptonWorkspaceCellDesigner.cs b/Source/Krypton Components/Krypton.Workspace/Workspace/KryptonWorkspaceCellDesigner.cs index 6a1bf5210..69edc9f76 100644 --- a/Source/Krypton Components/Krypton.Workspace/Workspace/KryptonWorkspaceCellDesigner.cs +++ b/Source/Krypton Components/Krypton.Workspace/Workspace/KryptonWorkspaceCellDesigner.cs @@ -34,9 +34,9 @@ protected override void OnComponentRemoving(object sender, ComponentEventArgs e) if (e.Component == Navigator) { // If this workspace cell is inside a parent - KryptonWorkspaceCell cell = (KryptonWorkspaceCell)Navigator; + var cell = (KryptonWorkspaceCell)Navigator; // Cell an only be inside a workspace sequence - KryptonWorkspaceSequence sequence = (KryptonWorkspaceSequence)cell.WorkspaceParent; + var sequence = (KryptonWorkspaceSequence)cell.WorkspaceParent; // Remove the cell from the parent sequence?.Children.Remove(cell); } diff --git a/Source/Krypton Components/Krypton.Workspace/Workspace/KryptonWorkspaceCollectionEditor.cs b/Source/Krypton Components/Krypton.Workspace/Workspace/KryptonWorkspaceCollectionEditor.cs index e8722785f..a5cf184d5 100644 --- a/Source/Krypton Components/Krypton.Workspace/Workspace/KryptonWorkspaceCollectionEditor.cs +++ b/Source/Krypton Components/Krypton.Workspace/Workspace/KryptonWorkspaceCollectionEditor.cs @@ -715,20 +715,11 @@ public MenuTreeNode(Component item) #endregion #region Implementation - private void OnPageTextChanged(object sender, EventArgs e) - { - Text = $"Page ({PageItem.Text})"; - } + private void OnPageTextChanged(object sender, EventArgs e) => Text = $"Page ({PageItem.Text})"; - private void OnCellPropertyChanged(object sender, PropertyChangedEventArgs e) - { - Text = $"Cell ({CellItem.StarSize})"; - } + private void OnCellPropertyChanged(object sender, PropertyChangedEventArgs e) => Text = $"Cell ({CellItem.StarSize})"; - private void OnSequencePropertyChanged(object sender, PropertyChangedEventArgs e) - { - Text = $"{SequenceItem.Orientation} ({SequenceItem.StarSize})"; - } + private void OnSequencePropertyChanged(object sender, PropertyChangedEventArgs e) => Text = $"{SequenceItem.Orientation} ({SequenceItem.StarSize})"; #endregion } @@ -1096,13 +1087,13 @@ private void buttonOK_Click(object sender, EventArgs e) private void buttonMoveUp_Click(object sender, EventArgs e) { // If we have a selected node - MenuTreeNode node = (MenuTreeNode)_treeView.SelectedNode; + var node = (MenuTreeNode)_treeView.SelectedNode; if (node != null) { NodeToType(node, out var isNodePage, out var isNodeCell, out var isNodeSequence); // Find the previous node compatible as target for the selected node - MenuTreeNode previousNode = (MenuTreeNode)PreviousNode(node); + var previousNode = (MenuTreeNode)PreviousNode(node); if (previousNode != null) { NodeToType(previousNode, out var isPreviousPage, out var isPreviousCell, out var isPreviousSequence); @@ -1111,7 +1102,7 @@ private void buttonMoveUp_Click(object sender, EventArgs e) if (isNodePage) { // Remove page from parent cell - MenuTreeNode parentNode = (MenuTreeNode)node.Parent; + var parentNode = (MenuTreeNode)node.Parent; parentNode.CellItem.Pages.Remove(node.PageItem); parentNode.Nodes.Remove(node); @@ -1119,7 +1110,7 @@ private void buttonMoveUp_Click(object sender, EventArgs e) if (isPreviousPage) { // Add page to the parent cell of target page - MenuTreeNode previousParent = (MenuTreeNode)previousNode.Parent; + var previousParent = (MenuTreeNode)previousNode.Parent; var pageIndex = previousParent.CellItem.Pages.IndexOf(previousNode.PageItem); // If the current and previous nodes are inside different cells @@ -1149,7 +1140,7 @@ private void buttonMoveUp_Click(object sender, EventArgs e) var contained = ContainsNode(previousNode, node); // Remove cell from parent collection - MenuTreeNode parentNode = (MenuTreeNode)node.Parent; + var parentNode = (MenuTreeNode)node.Parent; TreeNodeCollection parentCollection = (node.Parent == null ? _treeView.Nodes : node.Parent.Nodes); parentNode?.SequenceItem.Children.Remove(node.CellItem); parentCollection.Remove(node); @@ -1158,7 +1149,7 @@ private void buttonMoveUp_Click(object sender, EventArgs e) if (isPreviousCell || contained) { // Add cell to the parent sequence of target cell - MenuTreeNode previousParent = (MenuTreeNode)previousNode.Parent; + var previousParent = (MenuTreeNode)previousNode.Parent; parentCollection = (previousNode.Parent == null ? _treeView.Nodes : previousNode.Parent.Nodes); var pageIndex = parentCollection.IndexOf(previousNode); @@ -1189,7 +1180,7 @@ private void buttonMoveUp_Click(object sender, EventArgs e) var contained = ContainsNode(previousNode, node); // Remove sequence from parent collection - MenuTreeNode parentNode = (MenuTreeNode)node.Parent; + var parentNode = (MenuTreeNode)node.Parent; TreeNodeCollection parentCollection = (node.Parent == null ? _treeView.Nodes : node.Parent.Nodes); parentNode?.SequenceItem.Children.Remove(node.SequenceItem); parentCollection.Remove(node); @@ -1198,7 +1189,7 @@ private void buttonMoveUp_Click(object sender, EventArgs e) if (isPreviousCell || contained) { // Add sequence to the parent sequence of target cell - MenuTreeNode previousParent = (MenuTreeNode)previousNode.Parent; + var previousParent = (MenuTreeNode)previousNode.Parent; parentCollection = (previousNode.Parent == null ? _treeView.Nodes : previousNode.Parent.Nodes); var pageIndex = parentCollection.IndexOf(previousNode); @@ -1236,13 +1227,13 @@ private void buttonMoveUp_Click(object sender, EventArgs e) private void buttonMoveDown_Click(object sender, EventArgs e) { // If we have a selected node - MenuTreeNode node = (MenuTreeNode)_treeView.SelectedNode; + var node = (MenuTreeNode)_treeView.SelectedNode; if (node != null) { NodeToType(node, out var isNodePage, out var isNodeCell, out var isNodeSequence); // Find the next node compatible as target for the selected node - MenuTreeNode nextNode = (MenuTreeNode)NextNode(node); + var nextNode = (MenuTreeNode)NextNode(node); if (nextNode != null) { NodeToType(nextNode, out var isNextPage, out var isNextCell, out var isNextSequence); @@ -1251,7 +1242,7 @@ private void buttonMoveDown_Click(object sender, EventArgs e) if (isNodePage) { // Remove page from parent cell - MenuTreeNode parentNode = (MenuTreeNode)node.Parent; + var parentNode = (MenuTreeNode)node.Parent; parentNode.CellItem.Pages.Remove(node.PageItem); parentNode.Nodes.Remove(node); @@ -1259,7 +1250,7 @@ private void buttonMoveDown_Click(object sender, EventArgs e) if (isNextPage) { // Add page to the parent cell of target page - MenuTreeNode previousParent = (MenuTreeNode)nextNode.Parent; + var previousParent = (MenuTreeNode)nextNode.Parent; var pageIndex = previousParent.CellItem.Pages.IndexOf(nextNode.PageItem); previousParent.CellItem.Pages.Insert(pageIndex + 1, node.PageItem); previousParent.Nodes.Insert(pageIndex + 1, node); @@ -1278,7 +1269,7 @@ private void buttonMoveDown_Click(object sender, EventArgs e) var contained = ContainsNode(nextNode, node); // Remove cell from parent collection - MenuTreeNode parentNode = (MenuTreeNode)node.Parent; + var parentNode = (MenuTreeNode)node.Parent; TreeNodeCollection parentCollection = (node.Parent == null ? _treeView.Nodes : node.Parent.Nodes); parentNode?.SequenceItem.Children.Remove(node.CellItem); parentCollection.Remove(node); @@ -1287,7 +1278,7 @@ private void buttonMoveDown_Click(object sender, EventArgs e) if (isNextCell || contained) { // Add cell to the parent sequence of target cell - MenuTreeNode previousParent = (MenuTreeNode)nextNode.Parent; + var previousParent = (MenuTreeNode)nextNode.Parent; parentCollection = (nextNode.Parent == null ? _treeView.Nodes : nextNode.Parent.Nodes); var pageIndex = parentCollection.IndexOf(nextNode); previousParent?.SequenceItem.Children.Insert(pageIndex + 1, node.CellItem); @@ -1307,7 +1298,7 @@ private void buttonMoveDown_Click(object sender, EventArgs e) var contained = ContainsNode(nextNode, node); // Remove sequence from parent collection - MenuTreeNode parentNode = (MenuTreeNode)node.Parent; + var parentNode = (MenuTreeNode)node.Parent; TreeNodeCollection parentCollection = (node.Parent == null ? _treeView.Nodes : node.Parent.Nodes); parentNode?.SequenceItem.Children.Remove(node.SequenceItem); parentCollection.Remove(node); @@ -1316,7 +1307,7 @@ private void buttonMoveDown_Click(object sender, EventArgs e) if (isNextCell || contained) { // Add sequence to the parent sequence of target cell - MenuTreeNode previousParent = (MenuTreeNode)nextNode.Parent; + var previousParent = (MenuTreeNode)nextNode.Parent; parentCollection = (nextNode.Parent == null ? _treeView.Nodes : nextNode.Parent.Nodes); var pageIndex = parentCollection.IndexOf(nextNode); previousParent?.SequenceItem.Children.Insert(pageIndex + 1, node.SequenceItem); @@ -1343,10 +1334,10 @@ private void buttonMoveDown_Click(object sender, EventArgs e) private void buttonAddPage_Click(object sender, EventArgs e) { // Create new page and menu node for the page - KryptonPage page = (KryptonPage)CreateInstance(typeof(KryptonPage)); + var page = (KryptonPage)CreateInstance(typeof(KryptonPage)); TreeNode newNode = new MenuTreeNode(page); - MenuTreeNode selectedNode = (MenuTreeNode)_treeView.SelectedNode; + var selectedNode = (MenuTreeNode)_treeView.SelectedNode; if (selectedNode.CellItem != null) { // Selected node is a cell, so append page to end of cells page collection @@ -1356,7 +1347,7 @@ private void buttonAddPage_Click(object sender, EventArgs e) else if (selectedNode.PageItem != null) { // Selected node is a page, so insert after this page - MenuTreeNode selectedParentNode = (MenuTreeNode)selectedNode.Parent; + var selectedParentNode = (MenuTreeNode)selectedNode.Parent; var selectedIndex = selectedParentNode.Nodes.IndexOf(selectedNode); selectedParentNode.CellItem.Pages.Insert(selectedIndex + 1, page); selectedParentNode.Nodes.Insert(selectedIndex + 1, newNode); @@ -1373,7 +1364,7 @@ private void buttonAddPage_Click(object sender, EventArgs e) private void buttonAddCell_Click(object sender, EventArgs e) { // Create new cell and menu node for the cell and two nodes for the child pages - KryptonWorkspaceCell cell = (KryptonWorkspaceCell)CreateInstance(typeof(KryptonWorkspaceCell)); + var cell = (KryptonWorkspaceCell)CreateInstance(typeof(KryptonWorkspaceCell)); TreeNode newNode = new MenuTreeNode(cell); // Add each page inside the new cell as a child of the new node @@ -1383,7 +1374,7 @@ private void buttonAddCell_Click(object sender, EventArgs e) } newNode.Expand(); - MenuTreeNode selectedNode = (MenuTreeNode)_treeView.SelectedNode; + var selectedNode = (MenuTreeNode)_treeView.SelectedNode; if (selectedNode == null) { // Nothing is selected, so add to the root @@ -1405,7 +1396,7 @@ private void buttonAddCell_Click(object sender, EventArgs e) else { // Selected node is a cell, so insert after this cell - MenuTreeNode selectedParentNode = (MenuTreeNode)selectedNode.Parent; + var selectedParentNode = (MenuTreeNode)selectedNode.Parent; var selectedIndex = selectedParentNode.Nodes.IndexOf(selectedNode); selectedParentNode.SequenceItem.Children.Insert(selectedIndex + 1, cell); selectedParentNode.Nodes.Insert(selectedIndex + 1, newNode); @@ -1423,10 +1414,10 @@ private void buttonAddCell_Click(object sender, EventArgs e) private void buttonAddSequence_Click(object sender, EventArgs e) { // Create new sequence and menu node for the sequence - KryptonWorkspaceSequence sequence = (KryptonWorkspaceSequence)CreateInstance(typeof(KryptonWorkspaceSequence)); + var sequence = (KryptonWorkspaceSequence)CreateInstance(typeof(KryptonWorkspaceSequence)); TreeNode newNode = new MenuTreeNode(sequence); - MenuTreeNode selectedNode = (MenuTreeNode)_treeView.SelectedNode; + var selectedNode = (MenuTreeNode)_treeView.SelectedNode; if (selectedNode == null) { // Nothing is selected, so add to the root @@ -1442,7 +1433,7 @@ private void buttonAddSequence_Click(object sender, EventArgs e) else { // Selected node is a cell, so insert after this cell - MenuTreeNode selectedParentNode = (MenuTreeNode)selectedNode.Parent; + var selectedParentNode = (MenuTreeNode)selectedNode.Parent; var selectedIndex = selectedParentNode.Nodes.IndexOf(selectedNode); selectedParentNode.SequenceItem.Children.Insert(selectedIndex + 1, sequence); selectedParentNode.Nodes.Insert(selectedIndex + 1, newNode); @@ -1467,7 +1458,7 @@ private void buttonDelete_Click(object sender, EventArgs e) { if (_treeView.SelectedNode != null) { - MenuTreeNode treeNode = (MenuTreeNode)_treeView.SelectedNode; + var treeNode = (MenuTreeNode)_treeView.SelectedNode; if (treeNode.Parent == null) { @@ -1477,7 +1468,7 @@ private void buttonDelete_Click(object sender, EventArgs e) else { // Remove from parent node collection - MenuTreeNode parentNode = (MenuTreeNode)treeNode.Parent; + var parentNode = (MenuTreeNode)treeNode.Parent; treeNode.Parent.Nodes.Remove(treeNode); // Remove item from parent container @@ -1504,10 +1495,7 @@ private void treeView_AfterSelect(object sender, TreeViewEventArgs e) UpdatePropertyGrid(); } - private void NodeToType(TreeNode node, out bool isPage, out bool isCell, out bool isSequence) - { - NodeToType((MenuTreeNode)node, out isPage, out isCell, out isSequence); - } + private void NodeToType(TreeNode node, out bool isPage, out bool isCell, out bool isSequence) => NodeToType((MenuTreeNode)node, out isPage, out isCell, out isSequence); private static void NodeToType(MenuTreeNode node, out bool isPage, out bool isCell, out bool isSequence) { @@ -1679,7 +1667,7 @@ private static void SeparatorToItems(ViewDrawWorkspaceSeparator separator, after = separator.WorkspaceItem; // Workspace item before the separator (to the left or above) - KryptonWorkspaceSequence beforeSequence = (KryptonWorkspaceSequence)after.WorkspaceParent; + var beforeSequence = (KryptonWorkspaceSequence)after.WorkspaceParent; // Previous items might be invisible and so search till we find the visible one we expect before = null; @@ -1833,7 +1821,7 @@ private void SynchronizeCollections(DictItemBase before, } } - IComponentChangeService? changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService)); + var changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService)); if (changeService != null) { // Mark components as changed when not added or removed @@ -1869,7 +1857,7 @@ public KryptonWorkspace Workspace { get { - KryptonWorkspaceSequence sequence = (KryptonWorkspaceSequence)Context.Instance; + var sequence = (KryptonWorkspaceSequence)Context.Instance; return sequence.WorkspaceControl; } } diff --git a/Source/Krypton Components/Krypton.Workspace/Workspace/KryptonWorkspaceDesigner.cs b/Source/Krypton Components/Krypton.Workspace/Workspace/KryptonWorkspaceDesigner.cs index fe7582072..2322b7c96 100644 --- a/Source/Krypton Components/Krypton.Workspace/Workspace/KryptonWorkspaceDesigner.cs +++ b/Source/Krypton Components/Krypton.Workspace/Workspace/KryptonWorkspaceDesigner.cs @@ -108,28 +108,19 @@ protected override void Dispose(bool disposing) /// Called when a drag-and-drop operation enters the control designer view. /// /// A DragEventArgs that provides data for the event. - protected override void OnDragEnter(DragEventArgs de) - { - de.Effect = DragDropEffects.None; - } + protected override void OnDragEnter(DragEventArgs de) => de.Effect = DragDropEffects.None; /// /// Called when a drag-and-drop object is dragged over the control designer view. /// /// A DragEventArgs that provides data for the event. - protected override void OnDragOver(DragEventArgs de) - { - de.Effect = DragDropEffects.None; - } + protected override void OnDragOver(DragEventArgs de) => de.Effect = DragDropEffects.None; /// /// Called when a drag-and-drop object is dropped onto the control designer view. /// /// A DragEventArgs that provides data for the event. - protected override void OnDragDrop(DragEventArgs de) - { - de.Effect = DragDropEffects.None; - } + protected override void OnDragDrop(DragEventArgs de) => de.Effect = DragDropEffects.None; #endregion #region Implementation @@ -143,18 +134,18 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) _workspace.SuspendLayout(); // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // We need to remove all children from the workspace for (var i = _workspace.Root.Children.Count - 1; i >= 0; i--) { - Component comp = _workspace.Root.Children[i] as Component; + var comp = _workspace.Root.Children[i] as Component; // If the component is a control... if (comp is Control control) { // We need to manually remove it from the workspace controls collection - KryptonReadOnlyControls readOnlyControls = (KryptonReadOnlyControls)_workspace.Controls; + var readOnlyControls = (KryptonReadOnlyControls)_workspace.Controls; readOnlyControls.RemoveInternal(control); } diff --git a/Source/Krypton Components/Krypton.Workspace/Workspace/KryptonWorkspaceSequenceDesigner.cs b/Source/Krypton Components/Krypton.Workspace/Workspace/KryptonWorkspaceSequenceDesigner.cs index f09e4f7a0..82551b700 100644 --- a/Source/Krypton Components/Krypton.Workspace/Workspace/KryptonWorkspaceSequenceDesigner.cs +++ b/Source/Krypton Components/Krypton.Workspace/Workspace/KryptonWorkspaceSequenceDesigner.cs @@ -97,7 +97,7 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) if (e.Component == _sequence) { // Need access to host in order to delete a component - IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); + var host = (IDesignerHost)GetService(typeof(IDesignerHost)); // Climb the workspace item tree to get the top most sequence KryptonWorkspace workspace = null; @@ -116,13 +116,13 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e) // We need to remove all children from the sequence for (var j = _sequence.Children.Count - 1; j >= 0; j--) { - Component comp = _sequence.Children[j] as Component; + var comp = _sequence.Children[j] as Component; // If the component is a control... if ((comp is Control control) && (workspace != null)) { // We need to manually remove it from the workspace controls collection - KryptonReadOnlyControls readOnlyControls = (KryptonReadOnlyControls)workspace.Controls; + var readOnlyControls = (KryptonReadOnlyControls)workspace.Controls; readOnlyControls.RemoveInternal(control); } diff --git a/Source/Krypton Components/TestForm/Form1.cs b/Source/Krypton Components/TestForm/Form1.cs index 342c7502a..0e68ca78a 100644 --- a/Source/Krypton Components/TestForm/Form1.cs +++ b/Source/Krypton Components/TestForm/Form1.cs @@ -14,145 +14,65 @@ public Form1() InitializeComponent(); } - private void AddEvent(string message) - { - kryptonListBox1.Items.Add(message); - } - - private void textBox1_Validated(object sender, System.EventArgs e) - { - AddEvent(nameof(textBox1_Validated)); - } - - private void kryptonTextBox1_Validated(object sender, System.EventArgs e) - { - AddEvent(nameof(kryptonTextBox1_Validated)); - - } - - private void kryptonTextBox1_DoubleClick(object sender, System.EventArgs e) - { - AddEvent(nameof(kryptonTextBox1_DoubleClick)); - - } - - private void kryptonTextBox1_MouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e) - { - AddEvent(nameof(kryptonTextBox1_MouseDoubleClick)); - - } - - private void kryptonTextBox1_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) - { - AddEvent(nameof(kryptonTextBox1_MouseClick)); - - } - - private void kryptonTextBox1_Click(object sender, System.EventArgs e) - { - AddEvent(nameof(kryptonTextBox1_Click)); - - } - - private void textBox1_MouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e) - { - AddEvent(nameof(textBox1_MouseDoubleClick)); - - } + private void AddEvent(string message) => kryptonListBox1.Items.Add(message); - private void textBox1_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) - { - AddEvent(nameof(textBox1_MouseClick)); + private void textBox1_Validated(object sender, System.EventArgs e) => AddEvent(nameof(textBox1_Validated)); - } + private void kryptonTextBox1_Validated(object sender, System.EventArgs e) => AddEvent(nameof(kryptonTextBox1_Validated)); - private void textBox1_DoubleClick(object sender, System.EventArgs e) - { - AddEvent(nameof(textBox1_DoubleClick)); + private void kryptonTextBox1_DoubleClick(object sender, System.EventArgs e) => AddEvent(nameof(kryptonTextBox1_DoubleClick)); - } + private void kryptonTextBox1_MouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e) => AddEvent(nameof(kryptonTextBox1_MouseDoubleClick)); - private void textBox1_Click(object sender, System.EventArgs e) - { - AddEvent(nameof(textBox1_Click)); + private void kryptonTextBox1_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) => AddEvent(nameof(kryptonTextBox1_MouseClick)); - } + private void kryptonTextBox1_Click(object sender, System.EventArgs e) => AddEvent(nameof(kryptonTextBox1_Click)); - private void textBox1_Validating(object sender, CancelEventArgs e) - { - AddEvent(nameof(textBox1_Validating)); - } + private void textBox1_MouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e) => AddEvent(nameof(textBox1_MouseDoubleClick)); - private void kryptonTextBox1_Validating(object sender, CancelEventArgs e) - { - AddEvent(nameof(kryptonTextBox1_Validating)); - } + private void textBox1_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) => AddEvent(nameof(textBox1_MouseClick)); - private void textBox1_PreviewKeyDown(object sender, System.Windows.Forms.PreviewKeyDownEventArgs e) - { - AddEvent(nameof(textBox1_PreviewKeyDown)); - } + private void textBox1_DoubleClick(object sender, System.EventArgs e) => AddEvent(nameof(textBox1_DoubleClick)); - private void kryptonTextBox1_PreviewKeyDown(object sender, System.Windows.Forms.PreviewKeyDownEventArgs e) - { - AddEvent(nameof(kryptonTextBox1_PreviewKeyDown)); - } + private void textBox1_Click(object sender, System.EventArgs e) => AddEvent(nameof(textBox1_Click)); - private void kryptonTextBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) - { - AddEvent(nameof(kryptonTextBox1_KeyDown)); - } + private void textBox1_Validating(object sender, CancelEventArgs e) => AddEvent(nameof(textBox1_Validating)); - private void kryptonTextBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) - { - AddEvent(nameof(kryptonTextBox1_KeyPress)); + private void kryptonTextBox1_Validating(object sender, CancelEventArgs e) => AddEvent(nameof(kryptonTextBox1_Validating)); - } + private void textBox1_PreviewKeyDown(object sender, System.Windows.Forms.PreviewKeyDownEventArgs e) => AddEvent(nameof(textBox1_PreviewKeyDown)); - private void kryptonTextBox1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) - { - AddEvent(nameof(kryptonTextBox1_KeyUp)); + private void kryptonTextBox1_PreviewKeyDown(object sender, System.Windows.Forms.PreviewKeyDownEventArgs e) => AddEvent(nameof(kryptonTextBox1_PreviewKeyDown)); - } - - private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) - { - AddEvent(nameof(textBox1_KeyDown)); + private void kryptonTextBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) => AddEvent(nameof(kryptonTextBox1_KeyDown)); - } + private void kryptonTextBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) => AddEvent(nameof(kryptonTextBox1_KeyPress)); - private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) - { - AddEvent(nameof(textBox1_KeyPress)); + private void kryptonTextBox1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) => AddEvent(nameof(kryptonTextBox1_KeyUp)); - } + private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) => AddEvent(nameof(textBox1_KeyDown)); - private void textBox1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) - { - AddEvent(nameof(textBox1_KeyUp)); + private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) => AddEvent(nameof(textBox1_KeyPress)); - } + private void textBox1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) => AddEvent(nameof(textBox1_KeyUp)); private void kryptonButton1_Click(object sender, System.EventArgs e) { - Form2 form2 = new Form2(); + var form2 = new Form2(); form2.ShowDialog(); } private void kryptonButton2_Click(object sender, System.EventArgs e) { - Form3 form3 = new Form3(); + var form3 = new Form3(); form3.ShowDialog(); } - private void kbtnTestMessagebox_Click(object sender, System.EventArgs e) - { - KryptonMessageBox.Show(@"This is a test!", @"Testing", KryptonMessageBoxButtons.OK, + private void kbtnTestMessagebox_Click(object sender, System.EventArgs e) => KryptonMessageBox.Show(@"This is a test!", @"Testing", KryptonMessageBoxButtons.OK, KryptonMessageBoxIcon.Information, contentAreaType: MessageBoxContentAreaType.LinkLabel, linkAreaCommand: kcmdMessageboxTest); - } private void kcmdMessageboxTest_Execute(object sender, System.EventArgs e) { diff --git a/Source/Krypton Components/TestForm/Program.cs b/Source/Krypton Components/TestForm/Program.cs index 5cec55207..a29e5d57c 100644 --- a/Source/Krypton Components/TestForm/Program.cs +++ b/Source/Krypton Components/TestForm/Program.cs @@ -9,11 +9,9 @@ internal static class Program /// The main entry point for the application. /// [STAThread] - static void Main() - { + static void Main() => // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. Application.Run(new Form1()); - } } } \ No newline at end of file