Sign in to follow this  
Followers 0
torels

Drawing on GUI

2 posts in this topic

hi there

I was trying to draw on a gui (just like if I were using paint) but I had some problems

the script is to slow and what i end up with is an inconstant dotted line.

I was planning to use a graphic once I get around this issue. The script here was just for testing... to se if the concept was right, that's why it uses labels.

here is my code:

#include <Misc.au3>
opt("mousecoordmode", 2)
$gui = guicreate("",600,600)
GUISetState()
while 1
    $p = MouseGetPos()
    If _IsPressed(01) And $p[0]<601 and $p[1]<601 Then GUICtrlSetBkColor(GUICtrlCreateLabel("",$p[0],$p[1],1,1),0x000000)
    If GUIGetMsg() = -3 then Exit
WEnd

does anyone have any suggestions ?

thanks in advance


Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Share this post


Link to post
Share on other sites



#include <WinAPI.au3>

Dim $hGUI = GUICreate('Title', 600, 600)
GUISetBkColor(0xFFFFFF)
Dim $bPressed = False

Global $hGdi32 = DllOpen('gdi32.dll')
Global $hDC = _WinAPI_GetDC($hGUI)

GUIRegisterMsg(0x0201, '_LeftButtonDown')
GUIRegisterMsg(0x0200, '_MouseMove')
GUIRegisterMsg(0x0202, '_LeftButtonUp')

GUISetState()

Do
    Sleep(20)
Until GUIGetMsg() = -3


DllClose($hGdi32)
GUIDelete($hGUI)
Exit

Func _LeftButtonDown($hWnd, $uMsg, $wParam, $lParam)
    $bPressed = True
    Return 0
EndFunc


Func _LeftButtonUp($hWnd, $uMsg, $wParam, $lParam)
    $bPressed = False
    Return 0
EndFunc


Func _MouseMove($hWnd, $uMsg, $wParam, $lParam)
    Local $nX = BitAND($lParam, 0xFFFF)
    Local $nY = BitAND($lParam, 0xFFFF0000)/0x10000
    
    If $bPressed Then Local $Ret = DllCall($hGdi32, 'dword', 'SetPixel', 'ptr', $hDC, 'int', $nX, 'int', $nY, 'dword', 0x00445599)
EndFunc

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