Jump to content

Recommended Posts

Posted

Well Im not really impressed with the looks of my trainer, coded it.. but I feel the GUI is really lacking. This is my first GUI ever, but id like to make it look alot better, if anyone could show me some code/with examples or give me ideas that would be great.

Here's a picture for you all.

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Posted

Question how do you add a picture as the background.. I was trying but had no luck. Also when I compile it, how can I add the Picture to the compiled file?

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Posted

1

fileinstall()

this installs the picture into the exe

2

right after creating the gui..

guictrlcreatepic()

guictrlsetstate( -1, $GUI_DISABLE) ; this disables the picture

8)

NEWHeader1.png

Posted

Why do I want to disable the picture?

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Posted (edited)

to make sure that the controls you place ontop of the picture are giving messages... that they were clicked

used in $msg = GUIGetMsg()

8)

Edited by Valuater

NEWHeader1.png

Posted (edited)

I can't get the picture to appear as the background for the life of me.

GUICtrlCreatePic("C:\logo.bmp",50,50, 200,50)

Well it appears but it's left justified.. is there any way to make it have auto strech it and make it fill the entire GUI window?

Edited by Sardith

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Posted

Nope :/

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Posted

The image just appears in the left corner, does anyone know how to correct this and make the image strech the entire area of the GUI window?

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Posted (edited)

1

you can change the attributes of the pic ( size )

2

to make sure...

GUICtrlCreatePic("C:\logo.bmp", 0, 0, gui width, gui hieght)

set this the same as the gui... width and hieght

8)

Edited by Valuater

NEWHeader1.png

Posted

Figured it.. I really should trial and error, seems to be working for me XD.

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Posted (edited)

Or you can use gradient background color:

#include <Color.au3>

Global $GUI_GR_LINE     = 2
Global $GUI_GR_MOVE     = 6
Global $GUI_GR_COLOR    = 8

$color1 = 0x000066
$color2 = 0x0000FF

$gui = GUICreate("Gradient Demo")
$size = WinGetClientSize($gui)
_GUICtrlCreateGradient($color1, $color2, 0, 0, $size[0], $size[1])
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then Exit
Wend

Func _GUICtrlCreateGradient($nStartColor, $nEndColor, $nX, $nY, $nWidth, $nHeight)
    Local $color1R = _ColorGetRed($nStartColor)
    Local $color1G = _ColorGetGreen($nStartColor)
    Local $color1B = _ColorGetBlue($nStartColor)

    Local $nStepR = (_ColorGetRed($nEndColor) - $color1R) / $nHeight
    Local $nStepG = (_ColorGetGreen($nEndColor) - $color1G) / $nHeight
    Local $nStepB = (_ColorGetBlue($nEndColor) - $color1B) / $nHeight

    GuiCtrlCreateGraphic($nX, $nY, $nWidth, $nHeight)
    For $i = 0 To $nHeight - $nY
        $sColor = "0x" & StringFormat("%02X%02X%02X", $color1R+$nStepR*$i, $color1G+$nStepG*$i, $color1B+$nStepB*$i)
        GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $sColor, 0xffffff)
        GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
        GUICtrlSetGraphic(-1, $GUI_GR_LINE, $nWidth, $i)
    Next
EndFunc
Edited by Zedna
Posted

Interesting thanks.

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Posted

This is my updated GUI look:

Any improvements that I could make? Also How do you go about making colored buttons?

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Posted (edited)

Valuater <3, thanks for all your help today.

Side note: Any other ideas on how to make it look better would be great.

Edited by Sardith

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Posted (edited)

I've worked a little bit on it, look here: (You need Beta)

F.E.A.R. Trainer GUI

#NoTrayIcon

#include <GUIConstants.au3>
#include <File.au3>

$BackgroundJPG = _TempFile()
FileInstall("Background.jpg",$BackgroundJPG)

$FEARTrainerGUI = GUICreate("F.E.A.R. Trainer", 400, 400, -1, -1, $WS_POPUP + $WS_SYSMENU + $WS_MINIMIZEBOX)

$Minimize = GUICtrlCreateLabel("", 361, 8, 15, 15)
GUICtrlSetTip($Minimize, "Minimize")

$Close = GUICtrlCreateLabel("", 377, 8, 15, 15)
GUICtrlSetTip($Close, "Close")

; Functional Buttons

$Health = GUICtrlCreateLabel("", 92, 168, 216, 30)
$Armor = GUICtrlCreateLabel("", 92, 202, 216, 30)
$Ammo = GUICtrlCreateLabel("", 92, 236, 216, 30)
$About = GUICtrlCreateLabel("", 92, 271, 216, 30)
$Run = GUICtrlCreateLabel("", 92, 304, 216, 30)
$ChangeDirectory = GUICtrlCreateLabel("", 92, 336, 216, 30)

$Background = GUICtrlCreatePic($BackgroundJPG, 0, 0, 400, 400)
RoundGUI($FEARTrainerGUI, 0, 0, 12, 12)

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $FEARTrainerGUI, "int", 200, "long", 0x00080000)
    
GuiSetState(@SW_SHOW)

While 1
    $Message = GUIGetMsg()
    
    Select
        Case $Message = $GUI_EVENT_CLOSE Or $Message = $Close
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $FEARTrainerGUI, "int", 100, "long", 0x00090000)
            Exit
        Case $Message = $Minimize
            GUISetState(@SW_MINIMIZE)
; Functional Buttons
        Case $Message = $Health
;Your Code
        Case $Message = $Armor
;Your Code
        Case $Message = $Ammo
;Your Code
        Case $Message = $About
;Your Code
        Case $Message = $Run
;Your Code
        Case $Message = $ChangeDirectory
;Your Code
        Case Else
            DllCall("user32.dll", "int", "ReleaseCapture")
            DllCall("user32.dll", "int", "SendMessage", "hWnd", $FEARTrainerGUI, "int", 0xA1, "int", 2, "int", 0)
    EndSelect
WEnd

Func RoundGUI($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
   Dim $pos, $ret, $ret2
   $pos = WinGetPos($h_win)
   $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3)
   If $ret[0] Then
      $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1)
      If $ret2[0] Then
         Return 1
      Else
         Return 0
      EndIf
   Else
      Return 0
   EndIf
EndFunc

Background image: (Put in same directory as source before compiling)

Edited by JoshDB
Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

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