Sign in to follow this  
Followers 0
MadaraUchiha

GDI Problem

4 posts in this topic

Hey,

I tried drawing a line on my GUI like this:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>


$Form1 = GUICreate("Form1", 404, 350, 192, 124)
$Button1 = GUICtrlCreateButton("Go", 8, 8, 75, 25)
GUISetState(@SW_SHOW)



While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $Hwnd = WinGetHandle($Form1)
            _GDIPlus_Startup()
            $hGraphics = _GDIPlus_GraphicsCreateFromHWND($Hwnd)
            _GDIPlus_GraphicsDrawLine($hGraphics,50,50,50,50)
    EndSwitch
WEnd

But nothing happens? Why is that? ;o


Share this post


Link to post
Share on other sites



Your parameters for GraphicsDrawLine are incorrect. Try this:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>


$Form1 = GUICreate("Form1", 404, 350, 192, 124)
$Button1 = GUICtrlCreateButton("Go", 8,8,75,25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $Button1
            _GDIPlus_Startup()
            $hGraphics = _GDIPlus_GraphicsCreateFromHWND($Form1)
            _GDIPlus_GraphicsDrawLine($hGraphics,10,150,390,150)
    EndSwitch
WEnd
1 person likes this

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Yes, that works, but after minimizing and then restoring the GDI Stuff dissapeared from the GUI?

How can I prevent this?


Share this post


Link to post
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
Sign in to follow this  
Followers 0