Search code examples
c#clicktransparentinteraction

Complete interaction through a form using C#


I am making an overlay program with C# that will have an overlay for games. I am currently using a borderless form with a transparent background and a picture box to draw pictures to the screen, but I can't click the window behind the form. I have set the form to be always on top so that I can play games and the UI stays, but every time the mouse goes over the form in the game if I click the focused window switches to my form, preventing game interaction.

I have tried using functions to just draw images to the screen without using forms, but I cannot work out how to do that.

All I want is things like an external menu/crosshair and such, for use in minecraft. As for the menu, I could make my own media controls and such, and the crosshair would be useful because I hate the default crosshair. I could draw shapes to the screen, but if I don't use pictures the crosshair might look tacky.


Solution

  • A possible solution is a per pixel alpha blending window.

    Here is a good starting point: Per Pixel Alpha Blend in C#

    The example source code should give you the idea.

    Hope this helps