Jump to content

how to modify this code, so that a thin colored line can appear in the middle of the screen to divide the screen into 2 parts?


Go to solution Solved by mistersquirrle,

Recommended Posts

#include <WindowsConstants.au3>
#include <WinAPI.au3>
#Include <GDIPlus.au3>

_GDIPlus_Startup ()

$hDC = _WinAPI_GetWindowDC(0)

$hGraphic = _GDIPlus_GraphicsCreateFromHDC($hDC)
$Color = 0xFF000000
$hPen = _GDIPlus_PenCreate($Color,2)


For $y = 0 to 30
    For $x = 0 to @DesktopWidth Step 5
        _GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth/2, 0, $x, @DesktopHeight, $hPen)
        $Color += Hex(2)
        _GDIPlus_PenSetColor($hPen, $Color)
    Next
Next


_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE+$RDW_ALLCHILDREN)
_WinAPI_ReleaseDC(0, $hDC)
_GDIPlus_Shutdown()
Edited by jacky998877
Link to comment
Share on other sites

  • jacky998877 changed the title to how to modify this code, so that a thin colored line can appear in the middle of the screen to divide the screen into 2 parts?
  • Solution

Just modifying that code?

#include <WindowsConstants.au3>
#include <WinAPI.au3>
#Include <GDIPlus.au3>

_GDIPlus_Startup ()

$hDC = _WinAPI_GetWindowDC(0)

$hGraphic = _GDIPlus_GraphicsCreateFromHDC($hDC)
$Color = 0xFF000000
$hPen = _GDIPlus_PenCreate($Color,2)

_GDIPlus_GraphicsDrawLine($hGraphic, 0, @DesktopHeight/2, @DesktopWidth, @DesktopHeight/2, $hPen)

_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE+$RDW_ALLCHILDREN)
_WinAPI_ReleaseDC(0, $hDC)
_GDIPlus_Shutdown()

However there's some issues with it, such that anything that updates on the screen will remove your painted line. If you want to create a presistent overlay, check out this thread/post from Melba: 

 

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...