Rewrite deprecated WinForms MainMenu/MenuItem/ToolBar classes for .NET 8 compatibility#1926
Closed
Copilot wants to merge 1 commit into
Closed
Rewrite deprecated WinForms MainMenu/MenuItem/ToolBar classes for .NET 8 compatibility#1926Copilot wants to merge 1 commit into
Copilot wants to merge 1 commit into
Conversation
…NET 8 compatibility Agent-Logs-Url: https://github.com/X-Sharp/XSharpPublic/sessions/7c8c5d6c-0b83-4522-ba7c-9f3497d3af4d Co-authored-by: RobertvanderHulst <14240939+RobertvanderHulst@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
RobertvanderHulst
May 10, 2026 20:14
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the removed/deprecated
System.Windows.Formsclasses (MainMenu,MenuItem,ContextMenu,ToolBar,ToolBarButton) with their modernToolStrip-based equivalents so the GUI SDK compiles and runs on .NET 8+.Changes
WinForm/MenuToolbar.prg(core rewrite)VOMenunow inheritsMenuStrip(wasMainMenu)VOMenuItemnow inheritsToolStripMenuItem(wasMenuItem)CloneMenu()reconstructs a deep copy with all handlers preservedRemoveFromParent()removes fromDropDownItemsor top-levelItemsSetShortCut(LONG)setsShortcutKeysVOToolBarnow inheritsToolStrip(wasToolBar)ButtonSizeproperty maps toImageScalingSizeGetButton()searchesItemscollectionVOToolBarButtonnow inheritsToolStripButton(wasToolBarButton)Pushedmaps toChecked;Rectanglemaps toBoundsVOSeparatorwrapsToolStripSeparatorAsContextMenuStrip()replacesAsContextMenu()— builds aContextMenuStripfrom cloned itemsMenu/Accelerator.prgAcceleratorKey.Shortcutnow returnsSystem.Windows.Forms.Keys(theShortcutenum was removed in .NET 5+)Menu/Menu.prgAppendItem/InsertItem: useItemsinstead ofMenuItems; separators createToolStripSeparatordirectlyDeleteItem: usesRemoveFromParent()helperGetSubMenu: usesCloneMenu()on the new APISetShortCuts/__ClearShortCuts: iterateToolStripItemCollectionusingShortcutKeys/Keys.None__CreateMenuItem: wiresMouseEnter(wasSelect) andDropDownOpened(wasPopup)ShowShortcutKeysreplacesShowShortcutGetMenuItemCount/GetSubMenuupdatedMenu/ToolBar.prgOnControlCreated: usesShowItemToolTips,GripStyle.Hidden, andItemClickedeventItemClickedreplacesButtonClickas the click handlerAppendItem/InsertItem: separators useVOSeparator, buttons useItems.Add/InsertDeleteItem: usesItems.IndexOf+Items.RemoveAtButtonStylesetter: iteratesItems.OfType<VOToolBarButton>()Flatassign: usesToolStripRenderModeinstead ofToolBarAppearanceButtonCount: usesItems.Count__CreateButtonand__GetButtonreturn typedVOToolBarButtonResourceReader/ResourceMenu.prgAddItemsTo: uses aList<OBJECT>stack; dispatches toItems.AddorDropDownItems.Addbased on current context typeWindows/Window.prgMenusetter: addsVOMenutoForm.Controlsand setsForm.MainMenuStripContextMenuproperty: setsForm.ContextMenuStripContextMenuShow: showsForm.ContextMenuStripWindows/ChildAppWindow.prgMenusetter: replaces deprecatedMdiList/MergeTypewithForm.MdiWindowListItemWindows/ShellWindow.prgMenusetter: replacesMenuItem.MdiListwithForm.MdiWindowListItemWindows/Application Window.prgActivate: replacesoShell:Form.Menuassignment withToolStripManager.Merge()for MDI menu mergingControls/Control.prgContextMenuproperty: setsControl.ContextMenuStripinstead ofControl.ContextMenu