Rectangle click event

Hello,
I have 35 rectangles like this one over one image on one display:

Display1.Overlays.Add(new RectOverlay("0", false, Color.Yellow, false, false, new Rect(new Point2D(0, 0), new Size2D(xLeft1, yDisplay1))));

I am trying to click on one of them and show that rectangle only and its image portion on other display.
The only tutorial with some rectangle click event is Image Manager\Cvb.net\Display but unfortunately it didn’t respond my question.
Any suggestion?
Thank you very much

Hi @George

the first idea that comes to my mind is to change the Overlays collection and create a new one that only consists of the one clicked rect.

Keep all the other ones in a backingstore for when the user wants to display all the overlays again, you can simply call Overlays = new ObservableCollection(overlaysBackup)

Second idea (probably the better one):
Set the IsVisible or IsEnabled property of all Overlays to false that are not the desired overlay.

Changes in the selected item or the whole Overlays collection will be handled as described here:

https://forum.commonvisionblox.com/t/wpf-mvvm-cvb-display-with-overlays-fixed-and-resizeble/956

Cheers
Chris


Rectangles have to be visible all the time, Chris.
So I am not sure how to show a selected rectangle on another display by clicking on it or by calling it.
I am going to read the info you suggested, thank you Chris.

I’ve read all the info (by the way I am using Forms, not WPF) and not a single clue about how to create a subimage from one of my ROI to showing it on another display.

Hi Geroge,

basically the subimage is Created using the Map() function.

1 Like