I am developing an assistive technology application (in C #) that overlays information on top of the current open window. It detects and marks interactive elements.
To do this, I am currently creating a transparent transparent window without a frame with TopMost set to "true" and drawing labels. This means that before the current application there is always a window on which I can draw labels.
The problem is that this window does not cover the right-click menu - only other windows. When the user right-clicks, a context menu is drawn above the overlay.
I need to be able to mark items in the context menu, but I cannot draw on top of it with the current implementation. Does anyone know of a solution?
Edit: this is the appropriate code for drawing an overlay. I set the form parameters in the form designer, not in the code explication, so I'm not sure how much this will help. I deleted the code that is not related to the drawing, or to the form itself:
public partial class OverlayForm : Form { public OverlayForm() { } protected override void OnPaint(PaintEventArgs eventArgs) { base.OnPaint(eventArgs); Graphics graphics = eventArgs.Graphics; Brush brush = new SolidBrush(this.labelColor); foreach (ClickableElement element in this.elements) { Region currentRegion = element.region; graphics.FillRegion(brush, currentRegion); } } }
source share