Jump to content

Recommended Posts

Posted

Here is a code to illustrate that problem.

CODE

#include <GUIConstants.au3>

Global $val = 10

Global $graphic = 0

Global $needle1 = 0

Global $inputv

Global $inputVol = 0

Global $gui = 0

Global $green = 0x00FF00

Global $red = 0xFF0000

Global $yellow = 0xffff00

Global $gray = 0xD4D0C8

Global $aqua = 0x00ffff

Global $struct = DllStructCreate("long;long;long;long")

Global $group

Func DrawDial($left , $top , $basescale , $title , $units , ByRef $value , ByRef $needle , $scale = 1 , $leftG = 20, $rightG = 70)

$group = GuiCreate(" " & $title , 150 , 120 , $left , $top, BitOr($WS_CHILD,$WS_DLGFRAME), BitOr($WS_EX_MDICHILD,$WS_EX_CLIENTEDGE),$gui)

;GuiCtrlCreateLabel("test label",10,10)

;GuiSetState(@SW_SHOW,$group)

;return

;$group1 = GUICtrlCreateGroup( $title , 0 , 0 , 150 ,120 , Bitor( $BS_CENTER,0) )

GuiCtrlCreateLabel($title,40,0)

for $x = 0 to 100 step 10

if StringinStr($x / 20,".") = 0 Then

GUICtrlCreateLabel("",$x * 1.2 + 15 , 15 , 1 , 15 , $SS_BLACKRECT)

GuiCtrlSetState(-1,$GUI_DISABLE)

if $x < 100 Then

$test = GUICtrlCreateLabel("",$x * 1.2 + 16,15 , 11 , 5 , 0 )

GuiCtrlSetState(-1,$GUI_DISABLE)

if $x < $rightG and $x > $leftG then

GUICtrlSetBkColor($test , 0x00ff00)

Else

GUICtrlSetBkColor($test , 0xff0000)

EndIf

EndIf

$scalevalue = $basescale + $x / $scale

if ($x == 0 and $scalevalue > 99 ) or ( $scalevalue <100 and $scalevalue > 9 ) then

GUICtrlCreateLabel( $scalevalue , $x * 1.2 + 8, 25 ,20,10,Bitor($SS_LEFTNOWORDWRAP,$GUI_SS_DEFAULT_LABEL) )

;GuiCtrlSetState(-1,$GUI_DISABLE)

Else

if $scalevalue < 10 Then

GUICtrlCreateLabel($scalevalue , $x * 1.2 + 16, 25 ,20,10,Bitor($SS_LEFTNOWORDWRAP,$GUI_SS_DEFAULT_LABEL))

Else

GUICtrlCreateLabel($scalevalue , $x * 1.2 + 8, 25 ,20,10,Bitor($SS_LEFTNOWORDWRAP,$GUI_SS_DEFAULT_LABEL))

EndIf

;GuiCtrlSetState(-1,$GUI_DISABLE)

EndIf

GUICtrlSetFont(-1,7)

Else

GUICtrlCreateLabel("",$x * 1.2 + 15 , 15 , 1 , 5 , $SS_BLACKRECT )

GuiCtrlSetState(-1,$GUI_DISABLE)

$test = GUICtrlCreateLabel("", $x *1.2 + 16 ,15 , 11 , 5 , 0 )

;GuiCtrlSetState(-1,$GUI_DISABLE)

if $x < $rightG and $x > $leftG then

GUICtrlSetBkColor($test , 0x00ff00)

Else

GUICtrlSetBkColor($test , 0xff0000)

EndIf

EndIf

Next

$value = GUICtrlCreateLabel(0 , 5 ,100 , 60 , 15 )

$label2 = GUICtrlCreateLabel($units , 135 ,100 , 20 , 15 )

$needle = GUICtrlCreateGraphic(10 ,35 , 120 , 80 )

$fill = GuiCtrlCreateGraphic(0 , 0 , 150 , 120)

GuiSetState(@SW_SHOW,$group)

;GuiCtrlSetBkColor(-1,0x00ffff)

EndFunc

$gui = GUICreate("UPS Monitor", 608 + 25, 338, -1 , -1,BitOr($WS_CLIPCHILDREN,$GUI_SS_DEFAULT_GUI ))

DrawDial(136 + 25, 70 , 170 , "Input Voltage" , "V" , $inputv , $needle1 , 1)

;GuiRegisterMsg(0x000F,"rePaint")

;DrawError(136 + 25 , 70 , "NOT CONNECTED" )

;Update()

GUISetState(@SW_SHOW,$gui)

#EndRegion ### END Koda GUI section ###

;AdlibEnable("Update",1000)

While 1

$nMsg = GUIGetMsg(1)

if $nMsg[0] == $GUI_EVENT_CLOSE and $nMsg[1]==$gui then

Exit

EndIf

WEnd

The child window where I draw the scale and everything is gone (just gray background shown)

after I minimize and restore the main gui window.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...