Jump to content

GUICtrlSetGraphic Wont work? | Resizing Graphic?


 Share

Recommended Posts

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
Link to comment
Share on other sites

  • Developers

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

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

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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

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

Link to comment
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
Link to comment
Share on other sites

  • Developers

Helpfile is your friend :)

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

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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