Jump to content

GDI Problem


Recommended Posts

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

Link to comment
Share on other sites

  • Moderators

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

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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...