Sign in to follow this  
Followers 0
GraaF1337

GUICtrlSetGraphic Wont work? | Resizing Graphic?

12 posts in this topic

#1 ·  Posted (edited)

I'm unable to resize my Graphic?

Edited by GraaF1337

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Wow! I've been so stupid! Totally forgot the 

GUICtrlSetPos

Command! >.<

Replacing my "GUICtrlSetGraphic" with this:

GUICtrlSetPos($drawinggui,100 + $side, 100 + $up)

Did the job! 

Still need to resize it tho!

Edited by GraaF1337
1 person likes this

Share this post


Link to post
Share on other sites

I'm unable to resize the graphic?

Understand me right, i want to make the graphic bigger after it have been drawn?

Share this post


Link to post
Share on other sites

Just tried to use "GuiCtrlSetData" to resize the graphic, that doesn't seem to work..

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <StaticConstants.au3>
#NoTrayIcon


$Form1 = GUICreate("Change Drawing", 617, 440, 192, 124)
GUISetState(@SW_SHOW)

$size = 100


$drawinggui = GUICtrlCreateGraphic(75, 75, $size, $size)
GUICtrlSetColor($drawinggui, 0xFF0000)


$update = GUICtrlCreateButton("Update", 100, 20)
$plus = GUICtrlCreateButton("+", 143, 20, 15)
$min = GUICtrlCreateButton("-", 85, 20, 15)
$show2 = GUICtrlCreateLabel($size, 112, 50)



While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $update
            GUICtrlSetData($drawinggui, $size)


        Case $plus
            $size +=10
            GUICtrlSetData($show2, $size)


        Case $min
            $size -=10
            GUICtrlSetData($show2, $size)


    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

Any ideas?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Relax ...  Don't bump your threads within 24 hours.

ps your initial post is confusing as that states **Solved**.

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Relax ...  Don't bump your threads within 24 hours.

ps your initial post is confusing as that states **Solved**.

Jos

Fixed and sorry >.<

Share this post


Link to post
Share on other sites

Graphics do not have "sizes". You can do this:

GuiCtrlCreateGraphic(0,0)

and you can still draw anywhere in the GUI's client area. If you want to scale the drawn elements, you could make them dynamic by placing their coords in an array.


I will answer every single PM, and you are free to ask anything anytime.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Are you trying to create a larger graphic from an existing small one, or are you just trying to display it bigger?

If the latter, then use GUICtrlSetImage, having first created a control (i.e. Label) of the specified size you want.

If the former, then you need to study both the GDIPlus and WinAPI sections of the User Defined Function (UDF) section of the AutoIt Help file. Have a go at knocking some code up, and we will help you with any issues. UDF is the last section.

Edited by TheSaint

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

I want to do something like, draw a graphic, then if i press "+" or "-" it will either make the graphic bigger or small once i click the "update" button.

I tried this but it dont work..

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <StaticConstants.au3>
#NoTrayIcon


$Form1 = GUICreate("Change Drawing", 617, 440, 192, 124)
GUISetState(@SW_SHOW)

$size = 100


$drawinggui = GUICtrlCreateGraphic(75, 75, $size, $size)
GUICtrlSetColor($drawinggui, 0xFF0000)


$update = GUICtrlCreateButton("Update", 100, 20)
$plus = GUICtrlCreateButton("+", 143, 20, 15)
$min = GUICtrlCreateButton("-", 85, 20, 15)
$show2 = GUICtrlCreateLabel($size, 112, 50)



While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $update
            GUICtrlSetData($drawinggui, $size)


        Case $plus
            $size +=10
            GUICtrlSetData($show2, $size)


        Case $min
            $size -=10
            GUICtrlSetData($show2, $size)


    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

Helpfile is your friend :)

Case $update
            GUICtrlSetPos($drawinggui,75,75, $size,$size)

Jos

Facking love you sometimes! :)

Thank you alot! :D

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