Jump to content

Cropping Images


Recommended Posts

Possible.

#)

edit:

Here is an example:

#include "GUIConstants.au3"
#include <Math.au3>

$gui=GUICreate("test transparentpic", 200, 100)
$pic=GUICreate("", 80, 71, 10, 10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui)
GUICtrlCreatePic(@Systemdir & "\oobe\images\merlin.gif",0,0, 0,0)

GUISetState(@SW_SHOW,$pic)
GUISetState(@SW_SHOW,$gui)

Const $MAX_WIDTH = 80, $MAX_HEIGHT = 71

HotKeySet("{LEFT}", "left")
HotKeySet("{RIGHT}", "right")
HotKeySet("{DOWN}", "down")
HotKeySet("{UP}", "up")

Do
    Sleep(10)
until GUIGetMsg() = $GUI_EVENT_CLOSE

Func left ()
    $picPos = WinGetPos($pic)
    WinMove($pic,"",$picPos[0],$picPos[1],_Max($picPos[2]-10, 0),$picPos[3])
EndFunc

Func right()
    $picPos = WinGetPos($pic)
    WinMove($pic,"",$picPos[0],$picPos[1],_Min($picPos[2]+10, $MAX_WIDTH),$picPos[3])
EndFunc

Func down()
    $picPos = WinGetPos($pic)
    WinMove($pic,"",$picPos[0],$picPos[1],$picPos[2],_Min($picPos[3]+10,$MAX_HEIGHT))
EndFunc

Func up()
    $picPos = WinGetPos($pic)
    WinMove($pic,"",$picPos[0],$picPos[1],$picPos[2],_Max($picPos[3]-10,0))
EndFunc

See what happens when you press the arrow keys.

#)

Edited by nfwu
Link to comment
Share on other sites

Thank you so much. You have no idea how much time you saved me with $WS_EX_MDICHILD that I was completely unaware of.

Also, I had thought about creating a seperate window but did not realize that window ordering allowed the child to permanently stay in front of the parent. Well, it does, but now I have found autoit can't handle multiple stacked child windows correctly in all regards (I already have one much more important one) so this method can't apply unfortunately.

Please, anyone, anything else?

Edited by Jlack0700
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...