https://bugs.winehq.org/show_bug.cgi?id=56911
Bug ID: 56911 Summary: System.Windows.Forms: ContextMenuStrip -> SourceControl property is null Product: Mono Version: main Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: System.Windows.Forms Assignee: wine-bugs@winehq.org Reporter: maxmueller485@web.de CC: madewokherd@gmail.com Distribution: ---
Created attachment 76732 --> https://bugs.winehq.org/attachment.cgi?id=76732 A small sample project containing nothing else but a cs source file, a csproj file and the sln file for this project
Hello,
I've stumbled over an issue in your current System.Windows.Forms implementation which did not affect the official version of Mono from the Mono Project.
The problem affects the ContextMenuStrip class which usually has a SourceControl property.
In WinForms there is a PictureBox widget which can have a context menu (ContextMenuStrip) with its elements (ToolStripMenuItem).
The property SourceControl would normally provide you with information about the element that actually owns this context menu (useful if you have multiple PictureBoxes) - it actually did until upstream version 6.12.0.200 (the final release I could get from Mono's official repository for Ubuntu).
Now when I take the mono implementation from your repository and compile it locally to run my project, the SourceControl will always be null which is really annoying.
To better understand my problem, I've attached a zip compressed archive of a sample project I created to demonstrate the issue.
The program consists of a small WinForms window with a single PictureBox in it. Right-click on the picture box will open up a ContextMenuStrip with a single ToolStripMenuItem in it ("Get underlying control"). When you click on this item, the method ToolStripMenuItem_Click will be executed and runs GetUnderlyingControl to determine the type of the control.
On Windows .NET Framework and the old Mono implementations, the behavior is consistent (MessageBox shows "Underlying Control: pictureBox").
In your current Mono build, the MessageBox will show "No underlying control found"