richardinwpb
Member
- Joined
- May 19, 2021
- Messages
- 10
- Programming Experience
- 10+
This is regarding a WinForms application written in c# using .Net 4.7.2.
I have a form that has a Top/Down splitter panel. The lower split panel contains Left/Right splitter panel. The Right split panel contains two panels, only one of which is visible at any given time: one contains a flowpanel containing image thumbnails and the other (which I will call the "imagepanel") contains a picturebox with Docking set to full. Right-clicking on a thumbnail hides the flowpanel and displays the imagepanel with the selected thumbnail shown in full in the picturebox. Right-clicking on the PictureBox hides the imagepanel and displays the flowpanel.
When I right-click on a thumbnail for the very first time after running my application, the MouseMove event for the picturebox fires as expected. I have a test label elsewhere that displays the coordinates of the cursor that demonstrates that the MouseMove event is firing. When I right-click on the Picturebox to go back to the flow panel and click on another thumbnail (or the same thumbnail), the MouseMove event never fires again unless I physically left-click on the picturebox.
I have tried setting Focus to the picturebox with PictureBox1.Focus();
I have tried selecting the picturebox with PictureBox1.Select();
I have tried simulating a left mouse-click. I know the simulated mouse click works because when I simulate the left mouse click over a button, it fires the Click event for the button. When I simulate the mouse click over the picturebox, it has no effect.
When I write this.ActiveControl.Name to the console in a variety of places, I always get the name of the Top/Down splitter panel, including the Click event of the PictureBox.
Why am I losing MouseMove events over the picturebox without having to click on it again ? I don't want my users to have to add this extra step.
I have tried creating just a simple application with minimal code to attempt to reproduce the issue, but, of course, I couldn't reproduce the issue.
I have a form that has a Top/Down splitter panel. The lower split panel contains Left/Right splitter panel. The Right split panel contains two panels, only one of which is visible at any given time: one contains a flowpanel containing image thumbnails and the other (which I will call the "imagepanel") contains a picturebox with Docking set to full. Right-clicking on a thumbnail hides the flowpanel and displays the imagepanel with the selected thumbnail shown in full in the picturebox. Right-clicking on the PictureBox hides the imagepanel and displays the flowpanel.
When I right-click on a thumbnail for the very first time after running my application, the MouseMove event for the picturebox fires as expected. I have a test label elsewhere that displays the coordinates of the cursor that demonstrates that the MouseMove event is firing. When I right-click on the Picturebox to go back to the flow panel and click on another thumbnail (or the same thumbnail), the MouseMove event never fires again unless I physically left-click on the picturebox.
I have tried setting Focus to the picturebox with PictureBox1.Focus();
I have tried selecting the picturebox with PictureBox1.Select();
I have tried simulating a left mouse-click. I know the simulated mouse click works because when I simulate the left mouse click over a button, it fires the Click event for the button. When I simulate the mouse click over the picturebox, it has no effect.
When I write this.ActiveControl.Name to the console in a variety of places, I always get the name of the Top/Down splitter panel, including the Click event of the PictureBox.
Why am I losing MouseMove events over the picturebox without having to click on it again ? I don't want my users to have to add this extra step.
I have tried creating just a simple application with minimal code to attempt to reproduce the issue, but, of course, I couldn't reproduce the issue.