Reputation: 35
I've been working on an application in Visual Studio and I've stumbled on a problem for an annotation feature I wish to implement. Basically, I would like to be able to use my mouse to draw on the screen. I checked some other questions here initially and thought to make a transparent window to draw on, but making the window fully transparent caused my mouse clicks to trigger other windows, which won't work.
I then tried to set an extremely low opacity for the window with a white background, which caused the screen to be slightly shaded, which was fine. However, doing this for the whole window caused the line I drew to also have an extremely low opacity and thus remain basically invisible.
Is there a way to solve this problem using the transparent window, or will I have to do something like take a screenshot and make a window-sized picture for the user to draw on? This seems less elegant of a solution and for other features in my application, I would like to avoid this if possible, but if that appears to be the only way, some help in the implementation would be really appreciated.
Thank you! Kevin
Upvotes: 3
Views: 1086
Reputation: 128136
Don't set the Window's Opacity but instead use a Background with low opacity, e.g. #01FFFFFF:
<Window ... Background="#01FFFFFF">
...
</Window>
Alternatively you could explicitly create a SolidColorBrush as Background and set its Opacity to a small value:
<Window ...>
<Window.Background>
<SolidColorBrush Color="White" Opacity="0.01"/>
</Window.Background>
...
</Window>
Upvotes: 3