Jump to content

Recommended Posts

Posted

Hi together,

is it possible to draw a rectangle during mouse movement and resize it all the time. Something like when the mouse left button is pressed start drawing it. I tried something like this:

While 1
        If _IsPressed("01", $UserDLL) Then
            Local $Start_Pos = MouseGetPos()
;~              While 1
;~                  Local $Mouse_Pos = MouseGetPos()
;~                  Local $Ausschnitt
;~                  GUICtrlDelete($Ausschnitt)
;~                  $Ausschnitt = GUICtrlCreateLabel($Start_Pos[0], $Start_Pos[1], $Mouse_Pos[0], $Mouse_Pos[1], 0x1000)
;~                  If Not _IsPressed("01", $UserDLL) Then ExitLoop
;~              WEnd
            ExitLoop
        EndIf
    WEnd

Thanks for your help.

pastl

p.s. sorry for my english.

Posted

hello,

ummm why are there comments on every line?

if you mean these:

;~ While 1
;~                   Local $Mouse_Pos = MouseGetPos()
;~                   Local $Ausschnitt
;~                   GUICtrlDelete($Ausschnitt)
;~                   $Ausschnitt = GUICtrlCreateLabel($Start_Pos[0], $Start_Pos[1], $Mouse_Pos[0], $Mouse_Pos[1], 0x1000)
;~                   If Not _IsPressed("01", $UserDLL) Then ExitLoop
;~               WEnd

They are not working.

pastl

Posted

#include <Misc.au3>
#include <GUIConstants.au3>

Opt( 'GUIOnEventMode', 1)

$UserDLL = DllOpen("user32.dll")
$gui = GUICreate( '')
GUISetOnEvent( $GUI_EVENT_CLOSE, 'quit')
GUISetState()

While 1
    draw_label()
WEnd


Func draw_label()
    Local $MouseCoordMode, $Start_Pos, $Ausschnitt, $Mouse_Pos
While 1
    If _IsPressed("01", $UserDLL) Then
        $MouseCoordMode = Opt( 'MouseCoordMode', 2)
        $Start_Pos = MouseGetPos()
        $Ausschnitt = GUICtrlCreateLabel( 'text...', 0, 0, 1, 1, $SS_SUNKEN)
        GUICtrlSetBkColor( $Ausschnitt, 0)
        
        While _IsPressed("01", $UserDLL)
            $Mouse_Pos = MouseGetPos()
            GUICtrlSetPos( $Ausschnitt, $Start_Pos[0], $Start_Pos[1], $Mouse_Pos[0] - $Start_Pos[0], $Mouse_Pos[1] - $Start_Pos[1])
            Sleep( 10)
        WEnd
    
        Opt( 'MouseCoordMode', $MouseCoordMode)
        Return $Ausschnitt
    EndIf
    
    Sleep( 10)
WEnd
EndFunc

Func quit()
    Exit
EndFunc

Func onautoitexit()
    DllClose( $UserDLL)
EndFunc

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