Jump to content

GuiCtrlCreateGraphic overwrite previosly created


eJan
 Share

Recommended Posts

Can it be done to overwrite previously created GuiCtrlCreateGraphic with new one (like on the pic)?Posted Image

Script:

#include "GUIConstants.au3"

GUICreate("Graphic",130 ,100)

$g1 = GuiCtrlCreateGraphic(10, 10, 80, 80, 0)

GUICtrlSetGraphic($g1, $GUI_GR_COLOR, 0x000000)

GUICtrlSetGraphic($g1, $GUI_GR_RECT, 0, 0, 80, 80)

$g2 = GuiCtrlCreateGraphic(60, 20, 60, 60, 0)

GUICtrlSetGraphic($g2, $GUI_GR_COLOR, 0xFF0000)

GUICtrlSetGraphic($g2, $GUI_GR_RECT, 0, 0, 60, 60)

GuiCtrlCreateLabel("label", 60, 42, 60, 20, $SS_CENTER)

GUISetState()

Do

  $msg = GUIGetMsg()

 

Until $msg = $GUI_EVENT_CLOSE

(working only when i set GUICtrlSetBkColor, but I don't want to use background color). AI v3.1.0.15J
Link to comment
Share on other sites

Like this?

#include "GUIConstants.au3"

GUICreate("Graphic",130 ,100)

$g1 = GuiCtrlCreateGraphic(10, 10, 80, 80, 0)
GUICtrlSetGraphic($g1, $GUI_GR_COLOR, 0x000000)
GUICtrlSetGraphic($g1, $GUI_GR_RECT, 0, 0, 80, 80)

$g2 = GuiCtrlCreateGraphic(60, 20, 60, 60, 0)
GUICtrlSetBkColor($g2,0xece9d8)
GUICtrlSetGraphic($g2, $GUI_GR_COLOR, 0xFF0000)
GUICtrlSetGraphic($g2, $GUI_GR_RECT, 0, 0, 60, 60)

GuiCtrlCreateLabel("label", 60, 42, 60, 20, $SS_CENTER)

GUISetState()

Do
  $msg = GUIGetMsg()
  
Until $msg = $GUI_EVENT_CLOSE

edit: sorry, i mis-understood you now i have a correct example

Edited by Xenogis

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Link to comment
Share on other sites

Actually I need to convert

[HKEY_CURRENT_USER\Control Panel\Colors]"ButtonFace"="236 233 216"

to 'Hex' and set it to GUICtrlSetBkColor($g2, ?), where "0xece9d8" is my Windows theme color, but supposed that I don't know other users Theme colors used.
Link to comment
Share on other sites

$RGB = StringSplit ( RegRead ( "HKCU\Control Panel\Colors", "ButtonFace" ), " " )
$Hex = "0x" & Hex ( $RGB[1], 2 ) & Hex ( $RGB[2], 2 ) & Hex ( $RGB[3], 2 )
#include "GUIConstants.au3"

GUICreate("Graphic",130 ,100)

$g1 = GuiCtrlCreateGraphic(10, 10, 80, 80, 0)
GUICtrlSetGraphic($g1, $GUI_GR_COLOR, 0x000000)
GUICtrlSetGraphic($g1, $GUI_GR_RECT, 0, 0, 80, 80)

$g2 = GuiCtrlCreateGraphic(60, 20, 60, 60, 0)
GUICtrlSetBkColor($g2,$hex)
GUICtrlSetGraphic($g2, $GUI_GR_COLOR, 0xFF0000)
GUICtrlSetGraphic($g2, $GUI_GR_RECT, 0, 0, 60, 60)

GuiCtrlCreateLabel("label", 60, 42, 60, 20, $SS_CENTER)

GUISetState()

Do
  $msg = GUIGetMsg()
  
Until $msg = $GUI_EVENT_CLOSE

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

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