4Eyes Posted May 14, 2010 Share Posted May 14, 2010 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. 4Eyes Link to comment Share on other sites More sharing options...
Alek Posted May 14, 2010 Share Posted May 14, 2010 you need to register the WM_PAINT event #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Gdiplus.au3> _GDIPlus_Startup() $Form = GUICreate("Hello world", 400, 400) GUISetState() $Main_Graphics = _GDIPlus_GraphicsCreateFromHWND($Form) _GDIPlus_GraphicsDrawLine($Main_Graphics, 0, 200, 400, 200) GUIRegisterMsg($WM_PAINT, "WM_PAINT") While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd _GDIPlus_GraphicsDispose($Main_Graphics) _GDIPlus_Shutdown() Func WM_PAINT($hWnd, $nMsg, $wParam, $lParam) _GDIPlus_GraphicsDrawLine($Main_Graphics, 0, 200, 400, 200) EndFunc [font="Impact"]Never fear, I is here.[/font] Link to comment Share on other sites More sharing options...
4Eyes Posted May 15, 2010 Author Share Posted May 15, 2010 Alek, That's excellent! Simple and elegent, thank you. That will save a lot of experimenting with alternatives. Regards, Mike H Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now