winforms icon indicating copy to clipboard operation
winforms copied to clipboard

Use MouseWheel scrolling in ToolStripDropDownMenu

Open toehead2001 opened this issue 9 months ago • 5 comments

Fixes #13302

Proposed changes

  • Add an OnMouseWheel override on ToolStripDropDownMenu to handle scrolling the menu items.

Customer Impact

  • Allow users to scroll a ToolStripDropDownMenu with the Mouse Wheel.

Regression?

  • No

Risk

  • Could potentially cause an issue if an application already has an override/event for handling MouseWheel on an ToolStripDropDownMenu.
  • Maybe need to add a property to make this opt-in or opt-out.

Test methodology

  • Manually tested through the user interface of scratch project.
Microsoft Reviewers: Open in CodeFlow

toehead2001 avatar Apr 14 '25 06:04 toehead2001

Error: src\System.Windows.Forms\System\Windows\Forms\Controls\ToolStrips\ToolStripDropDownMenu.cs#L847

src\System.Windows.Forms\System\Windows\Forms\Controls\ToolStrips\ToolStripDropDownMenu.cs(847,29): error RS0016: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'override System.Windows.Forms.ToolStripDropDownMenu.OnMouseWheel(System.Windows.Forms.MouseEventArgs! e) -> void' is not part of the declared public API (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)

Tanya-Solyanik avatar Apr 15 '25 00:04 Tanya-Solyanik

Codecov Report

Attention: Patch coverage is 0% with 22 lines in your changes missing coverage. Please review.

Project coverage is 76.89944%. Comparing base (7c04597) to head (be95b05).

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #13303         +/-   ##
===================================================
- Coverage   76.90689%   76.89944%   -0.00746%     
===================================================
  Files           3260        3260                 
  Lines         643088      643110         +22     
  Branches       47601       47605          +4     
===================================================
- Hits          494579      494548         -31     
- Misses        144845      144893         +48     
- Partials        3664        3669          +5     
Flag Coverage Δ
Debug 76.89944% <0.00000%> (-0.00746%) :arrow_down:
integration 18.97564% <0.00000%> (-0.01227%) :arrow_down:
production 51.56089% <0.00000%> (-0.01472%) :arrow_down:
test 97.42152% <ø> (ø)
unit 48.95130% <0.00000%> (-0.00826%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Apr 15 '25 00:04 codecov[bot]

System.Windows.Forms.Tests.ClipboardTests.SetDataObject_InvokeObjectBoolNotIComDataObject_GetReturnsExpected(data: "data", copy: True)

Error message Expected object to be "data", but found "".

Stack trace at FluentAssertions.Execution.LateBoundTestFramework.Throw(String message) at FluentAssertions.Execution.DefaultAssertionStrategy.HandleFailure(String message) at FluentAssertions.Execution.AssertionChain.FailWith(Func1 getFailureReason) at FluentAssertions.Primitives.ObjectAssertions2.Be(TSubject expected, String because, Object[] becauseArgs) at System.Windows.Forms.Tests.ClipboardTests.SetDataObject_InvokeObjectBoolNotIComDataObject_GetReturnsExpected(Object data, Boolean copy) in /_/src/test/unit/System.Windows.Forms/System/Windows/Forms/ClipboardTests.cs:line 307 at InvokeStub_ClipboardTests.SetDataObject_InvokeObjectBoolNotIComDataObject_GetReturnsExpected(Object, Span`1) at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

Tanya-Solyanik avatar Apr 16 '25 19:04 Tanya-Solyanik

That error looks unrelated to the code changes in this PR.

toehead2001 avatar Apr 16 '25 19:04 toehead2001

That error looks unrelated to the code changes in this PR.

@toehead2001 - I'm adding these errors for our internal tracking. ClipboardTests is a known flaky set of tests because they read from a machine-wide resource, we ignore any non-recurring failures there.

Tanya-Solyanik avatar Apr 16 '25 21:04 Tanya-Solyanik