zaafar / ClickableTransparentOverlay

A library for creating transparent overlay using windows API & ImGui.NET
Apache License 2.0
87 stars 33 forks source link

Moving Overlay window to different screen #55

Closed Th3C0D3R closed 7 months ago

Th3C0D3R commented 7 months ago

In the current NuGet Package, the overlay window only displays on the "primary" screen. In the current source code it seams that something is implemented so the overlay window can be moved: grafik

I build the source repo and added it to my project. I am trying to set those properties to the new Position and Size depending on the selected screen Bounds: grafik

the overlay window disappears from the main screen but not appear on the selected screen (I set the ImGui window to the same coordinates relative to the old screen)

on main screen: grafik

after moving to the other screen (without any debugging): grafik

set Position and Size: grafik

to clarify: I have 3 Monitors, the selected monitor is on the right so X is 1920 and Y is 0 whichis the upper left corner of the right monitor

Th3C0D3R commented 7 months ago

grafik Inside the Overlay.cs if one change the 800, 600, 0, 0,

to
800, 600, 1920, (for my screen) 0,

will show the overlay on the other screen.

zaafar commented 7 months ago

Can you compile and execute Examples -> Multithreadedoverlay?

in there can you change “Set Position” to your monitor on the right hand side and press resize button?

does it work for you?

Th3C0D3R commented 7 months ago

ok I found out what the problem is.

Can you compile and execute Examples -> Multithreadedoverlay?

in there can you change “Set Position” to your monitor on the right hand side and press resize button?

does it work for you?

I have and it cuts at the screen end.

the solution is: you have to unmaximize the win32 window: grafik

that worked.

//edit: why maximizing the window in first place? doing "normal" and then setting the size to screensize should be fine too

zaafar commented 7 months ago

the only thing extra we are doing when user call User32.ShowWindow(this.window.Handle, ShowWindowCommand.ShowMaximized); is to call the resize function (as shown here).

1) I have uploaded new code in f/testchanges branch, can you see if that fix your issue?

2) if not, can you un-comment the code in that branch (ref https://github.com/zaafar/ClickableTransparentOverlay/blob/f/testchanges/ClickableTransparentOverlay/Overlay.cs#L561-L563) and see if that fixes the issue?

Th3C0D3R commented 7 months ago

Will test it when I am at my PC again. Probably not "today" (for the next 14h).

Th3C0D3R commented 7 months ago

the only thing extra we are doing when user call User32.ShowWindow(this.window.Handle, ShowWindowCommand.ShowMaximized); is to call the resize function (as shown here).

1. I have uploaded new code in `f/testchanges` branch, can you see if that fix your issue?

that fixed the issue. problem solved then :) will close issue the PR

zaafar commented 7 months ago

@Th3C0D3R which part fixed the issue? Commented one or both ( Un-commented + commented ).

Th3C0D3R commented 7 months ago

@Th3C0D3R which part fixed the issue? Commented one or both ( Un-commented + commented ).

@zaafar Just using it so the first fix did it without the commented thing