AutoHotkey Community

It is currently May 27th, 2012, 12:40 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: February 13th, 2010, 6:38 pm 
Offline

Joined: July 22nd, 2008, 1:49 pm
Posts: 151
I'm running a script that uses a picture as background, i've added a menu to let the user change the size of the picture, but i cant seem to be able to change the size of the picture once its added, i tried doing it with first deleting it then adding an identical picture with the size i wanted, which worked. But seems to me that there must be some way to do it with guicontrol?

Tried the following:
Code:
...
Gui, Add, Picture, w%Screenwidth% h-1 vkeypic, %keypicpath% ; works just fine
...
Guicontrol, , keypic, w100 %keypicpath% ;nothing happens


I'm a just a syntax moron again? really cant figure it out..


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2010, 7:08 pm 
Offline

Joined: February 6th, 2010, 5:17 pm
Posts: 57
Code:
Guicontrol, MoveDraw, keypic, w100


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2010, 7:30 pm 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6074
Location: San Diego, California
I'd suggest you should slow down and read the docs

In this case, you are missing the * before the w, and you need to repeat the h parameter if you want the new image proportional
Code:
Guicontrol, , keypic, *w100 *h-1 %keypicpath% ;this works


There is also this:

http://www.autohotkey.com/docs/commands/GuiControl.htm

Quote:
GuiControl, Move: Moves and/or resizes the control. Specify one or more of the following option letters in Param3: X (the x-coordinate relative to the GUI window's client area, which is the area not including title bar, menu bar, and borders); Y (the y-coordinate), W (Width), H (Height). (Specify each number as decimal, not hexadecimal.) For example:

GuiControl, Move, MyEdit, x10 y20 w200 h100
GuiControl, Move, MyEdit, % "x" VarX+10 "y" VarY+5 "w" VarW*2 "h" VarH*1.5 ; Uses an expression via "% " prefix.

GuiControl, MoveDraw: Same as "Move" (above) except that it also repaints the region of the GUI window occupied by the control. Although this may cause an unwanted flickering effect when called repeatedly and rapidly, it solves painting artifacts for certain control types such as GroupBoxes. In v1.0.48.04+, the last parameter may be omitted to redraw the control without moving it.



Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2010, 8:47 pm 
Offline

Joined: July 22nd, 2008, 1:49 pm
Posts: 151
after rereading the GUI files, i'll have to agree with you leaf_me, i should have read the files more carefully. I will keep that in mind before asking for help again. I've had no trouble moving or risizing all sorts of controls, but when it comes to pictures I for some reason cannot get it to work.

Thanks for helping me out, even though i was a tard!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 14th, 2010, 12:57 am 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6074
Location: San Diego, California
On the off chance you are still haveing trouble, here is a working script.

You'll have to supply your own picture :wink:
Code:
keypicpath=kittens.jpg

sw:=a_Screenwidth/2
k:=sw-100

Gui, Add, Picture, w%sw% h-1 vkeypic, %keypicpath% ; works just fine

gui, show

msgbox To see reduced picture size`nPress OK

Guicontrol, , keypic, *w%k% *h-1 %keypicpath% ;nothing happens


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: chaosad, jrav, Yahoo [Bot] and 21 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group