lolp1 / Overlay.NET

An easy-to-use overlay library written in C# by Jacob Kemple.
730 stars 87 forks source link

Redrawing the WPF overlay #8

Closed mattukdev closed 5 years ago

mattukdev commented 7 years ago

I am trying to create an overlay using WPF and a simple bitmap image. I am able to draw the bitmap image and have done so by using the examples in both the Draw event and the SetUp(); function.

However, I want to be able to update this image and redraw it on the overlay.

I have tried to execute SetUp(); with a new image but cannot seem to get rid of the old image. I have tried using the OverlayWindow.Remove(); but that doesn't seem to work either. I have tried removing the condition so SetUp(); is triggered every PreTick but that doesn't seem to work either.

Draw seems to only be triggered upon the initial draw but never again.

How can I redraw the overlay with a new image?

Here is my current SetUp();

OverlayWPF2.txt

Thanks for all your hard work on this @lolp1 , it works very well.

lolp1 commented 7 years ago

Have you tried just storing a reference to the Rectangle and changing the 'Fill' with the new value? You may also try actually removing the item from the Children property in the overlay window and adding the new one on a new frame. Inefficient but should work.

larsbloch commented 6 years ago

I have the same issue. The overlay.Update is called many times, but the redraw function is only called once (or actually a couple of times) in the beginning. I tried changing "click me" to datetime.now.seconds.tostring() but it just stays the same.

lolp1 commented 5 years ago

Fixing this soon as well as the ability to get events.