Sign in to follow this  
Followers 0
Jlack0700

Cropping Images

3 posts in this topic

First Attempt : 0 replies

Cropping images rather than resizing on a GUI. I just need a possible / probable / impossible on this one. Any help appreciated here.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

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