Jump to content

Lines drawn with GDI get 'erased'


Recommended Posts

I've been using _GDIPlus_GraphicsDrawLine() to draw a dividing line between sections of a GUI but found today that the lines get erased by any other window being overlapped with it, or even by minimising/maximising the window.

Is there a way to prevent this or is there a better way to do it? I've tried using labels and - or _ chars but that's pretty poor. I've also tried GUICtrlControlGroup() but had some difficulty but right now I don't recall what it was, and in any case that's not what I want... just a simple divider.


Link to comment
Share on other sites

you need to register the WM_PAINT event

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Gdiplus.au3>


$Form = GUICreate("Hello world", 400, 400)

$Main_Graphics = _GDIPlus_GraphicsCreateFromHWND($Form)
_GDIPlus_GraphicsDrawLine($Main_Graphics, 0, 200, 400, 200)

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE


Func WM_PAINT($hWnd, $nMsg, $wParam, $lParam)
    _GDIPlus_GraphicsDrawLine($Main_Graphics, 0, 200, 400, 200)

[font="Impact"]Never fear, I is here.[/font]

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

  • Recently Browsing   0 members

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