Sign in to follow this  
Followers 0
npploveyou

Removing windows border

9 posts in this topic

#1 ·  Posted (edited)

Hi there,

It's me again, i'm working on my new project to create a login page before going to the main function. The GUI interface looks like this:

However, that doesn't look nice enough so I would like to remove the "silver border" of the windows surrounding my main GUI ( well, i don't know exactly how to call it ), to make it look like:

I have been digging for 2 days but couldn't find a way to do it with autoit.

Please provide me some suggestion or @mac or functions to do this job.

Thank you so much and have a great day! :)

Edited by npploveyou

Share this post


Link to post
Share on other sites



Put The WS_POPUP Style to the GUI

Share this post


Link to post
Share on other sites

perfect, that's what I need. Thank you so much!

Share this post


Link to post
Share on other sites

How did you that GUI with custom buttons ??


Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Share this post


Link to post
Share on other sites

How did you that GUI with custom buttons ??

I would guess that it is displaying a small HTML page because I don't think I have seen input boxes that could look like that from AutoIt. The other parts shouldn't be too hard - just create jpg pictures as buttons.


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

if you look close you will see the black back of the GUI in the corners..

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

How did you that GUI with custom buttons ??

well i got this so far :)

#include <winapiex.au3>
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>

global $color
Global $Widht = 400
Global $Height = 400
Global $transColor = 0x123456
$hGui = GUICreate("test", $Widht, $Height, -1, -1, $WS_POPUP)
GUISetBkColor(0, $hGui)
$hRgn = _WinAPI_CreateRoundRectRgn(10, 10, $Widht, $Height, 10, 10)
_WinAPI_SetWindowRgn($hGui, $hRgn)
_SetBackGradients()
GUISetState()
$ControlGui = GUICreate("", $Widht, $Height, 0, 0, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_LAYERED), $hGui)
GUISetBkColor($transColor, $ControlGui)
_WinAPI_SetLayeredWindowAttributes($ControlGui, $transColor, 255)
$icon = GUICtrlCreateIcon("shell32.dll", 48, 45, 155, 25, 25)
$input = Guictrlcreateinput("",78, 160, 289, 20,$ES_PASSWORD)
$color = 20
GUICtrlSetbkColor(-1, "0x" & Hex($color, 2) & Hex($color, 2) & Hex($color, 2))
GUICtrlSetColor(-1, 0xAAAAAA)
_EraseInputBorders()
GUISetState()
Do
Until GUIGetMsg() = -3

_WinAPI_DeleteObject($hRgn)

Func _Hipotenusa($int1, $int2)
    Local $ret = Sqrt($int1 ^ 2 + $int2 ^ 2)
    Return $ret
EndFunc   ;==>_Hipotenusa
Func _EraseInputBorders()

    $hRgn = _WinAPI_CreateRoundRectRgn(10, 10, 287, 18, 10, 10)
_WinAPI_SetWindowRgn(GuictrlgetHandle($input), $hRgn)
EndFunc

Func _SetBackGradients()
    GUICtrlCreateGraphic(0, 0, $Widht, $Height)
    $color = 100
    For $i = 0 To 150
        GUICtrlSetGraphic(-1, $GUI_GR_COLOR, "0x" & Hex($color, 2) & Hex($color, 2) & Hex($color, 2))
        GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
        GUICtrlSetGraphic(-1, $GUI_GR_LINE, 400, $i)
        If $color > 0 Then $color -= 1
    Next
    $color = 40
    GUICtrlCreateGraphic(39, 149, 33, 33)
    GUICtrlSetBkColor(-1, "0x" & Hex($color, 2) & Hex($color, 2) & Hex($color, 2))
    GUICtrlCreateGraphic(40, 150, 30, 30)
    For $i = 0 To 30
        GUICtrlSetGraphic(-1, $GUI_GR_COLOR, "0x" & Hex($color, 2) & Hex($color, 2) & Hex($color, 2))
        GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
        GUICtrlSetGraphic(-1, $GUI_GR_LINE, 30, $i)
        If $color > 0 Then $color -= $color/30
    Next
    $color = 40
    GUICtrlCreateGraphic(73, 149, 292, 33)
    GUICtrlSetBkColor(-1, "0x" & Hex($color, 2) & Hex($color, 2) & Hex($color, 2))
    $color = 20
    GUICtrlCreateGraphic(74, 150, 289, 30)
    GUICtrlSetBkColor(-1, "0x" & Hex($color, 2) & Hex($color, 2) & Hex($color, 2))
EndFunc   ;==>_SetBackGradients

I guess you can imagine how to do the buttons, and you can handle the notify msg to make the GUI behavior more correctly ;)

Posted Image

Edited by monoscout999

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Hi there,

Well as first I had the same thought as monoscout to interact with the WinAPI and shapes but as you can see that was so complicated. Somehow I remembered a login page for my web admin, then I start with this concept, Well i actually remade my login page so there is no black background for it, just a rectangle form:

- First, I try to draw the png of the background by using:

#include <GDIPlus.au3>
#include <GuiConstantsEx.au3>

Opt("MustDeclareVars", 1)

; ===============================================================================================================================
; Description ...: Shows how to display a PNG image
; Author ........: Paul Campbell (PaulIA)
; Notes .........:
; ===============================================================================================================================

; ===============================================================================================================================
; Global variables
; ===============================================================================================================================
Global $hGUI, $hImage, $hGraphic

; Create GUI
$hGUI = GUICreate("Show PNG", 240, 240)
GUISetState()

; Load PNG image
_GDIPlus_StartUp()
$hImage   = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Images\Torus.png")

; Draw PNG image
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
_GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0)

; Loop until user exits
do
until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_ShutDown()

What includes in the background png is the background itself, the pic of the form/icon ... but no button and other links. (you can add as much label for your text as you want) => in my example I drew the JPG NOT PNG that's why I still have the black background

- Create 2 input boxes, set the background color to match with the background login form's color. Set it to @noborder => we have input form

- For the login button or create new account, just design it within the background, then create a pic with that button and assign it to $pic1 for instance. In GUIGetMsg() just get $Pic1 as the "Login Action"

It would be much easier. However, the only thing that troubled me is when I drew the png background, the size was not original as I had designed. I'm still trying to figure that out.

Good luck! :)

Edited by npploveyou

Share this post


Link to post
Share on other sites

I also do some GUIs with Pngs images using the SetBitMap() function from L0ader(here in the forum), but now i`m playing with your design.

WARNING; This isn`t a clean script it`s only for tests(I will do some UDF in the future with this)

Posted Image

#include <winapiex.au3>
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>

global $color
Global $Widht = 400
Global $Height = 400
Global $transColor = 0x123456
$hGui = GUICreate("test", $Widht, $Height, -1, -1, $WS_POPUP)
GUISetBkColor(0, $hGui)
$hRgn = _WinAPI_CreateRoundRectRgn(0, 0, $Widht, $Height, 10, 10)
_WinAPI_SetWindowRgn($hGui, $hRgn)
_SetBackGradients()
GUISetState()
$ControlGui = GUICreate("", $Widht, $Height, 0, 0, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_LAYERED), $hGui)
GUISetBkColor($transColor, $ControlGui)
_WinAPI_SetLayeredWindowAttributes($ControlGui, $transColor, 255)
$icon = GUICtrlCreateIcon("shell32.dll", 48, 45, 155, 25, 25)
$input = Guictrlcreateinput("",78, 160, 289, 20,$ES_PASSWORD)
$color = 20
GUICtrlSetbkColor(-1, "0x" & Hex($color, 2) & Hex($color, 2) & Hex($color, 2))
GUICtrlSetColor(-1, 0xCCCCCC)
_EraseInputBorders()
GuiCtrlCreateLabel("MonoScout999 1.0",70,10,340,50)
GuiCtrlsetcolor(-1,0xCCCCCC)
GuiCtrlSetFont(-1,25,200,0,"Verdana",5)
$label = GuiCtrlCreateLabel("",10,300,190,50,$SS_CENTER)
GuiCtrlsetcolor(-1,0xCCCCCC)

GUISetState()
While True
    $msg = GuiGetMsg()
    Switch $msg
        case -3
            Exit
        case $label
            consolewrite(GuiCtrlRead($input)&@CRLF)
              GUICtrlSetBkColor($G, 0x00ff00)
    EndSwitch
WEnd


_WinAPI_DeleteObject($hRgn)

Func _Hipotenusa($int1, $int2)
    Local $ret = Sqrt($int1 ^ 2 + $int2 ^ 2)
    Return $ret
EndFunc   ;==>_Hipotenusa
Func _EraseInputBorders()

    $hRgn = _WinAPI_CreateRoundRectRgn(10, 10, 287, 18, 10, 10)
_WinAPI_SetWindowRgn(GuictrlgetHandle($input), $hRgn)
EndFunc

Func _SetBackGradients()
    GUICtrlCreateGraphic(0, 0, $Widht, $Height)
    $color = 100
    For $i = 0 To 150
        GUICtrlSetGraphic(-1, $GUI_GR_COLOR, "0x" & Hex($color, 2) & Hex($color, 2) & Hex($color, 2))
        GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
        GUICtrlSetGraphic(-1, $GUI_GR_LINE, 400, $i)
        If $color > 0 Then $color -= 1
    Next
    $color = 40
    GUICtrlCreateGraphic(39, 149, 33, 33)
    GUICtrlSetBkColor(-1, "0x" & Hex($color, 2) & Hex($color, 2) & Hex($color, 2))
    GUICtrlCreateGraphic(40, 150, 30, 30)
    For $i = 0 To 30
        GUICtrlSetGraphic(-1, $GUI_GR_COLOR, "0x" & Hex($color, 2) & Hex($color+15, 2) & Hex($color, 2))
        GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
        GUICtrlSetGraphic(-1, $GUI_GR_LINE, 30, $i)
        If $color > 0 Then $color -= $color/30
    Next
    $color = 40
    GUICtrlCreateGraphic(73, 149, 292, 33)
    GUICtrlSetBkColor(-1, "0x" & Hex($color, 2) & Hex($color, 2) & Hex($color, 2))
    $color = 20
    GUICtrlCreateGraphic(74, 150, 289, 30)
    GUICtrlSetBkColor(-1, "0x" & Hex($color, 2) & Hex($color, 2) & Hex($color, 2))
     $color = 40
    GUICtrlCreateGraphic(10,300,189,50)
    For $i = 0 To 50
        GUICtrlSetGraphic(-1, $GUI_GR_COLOR, "0x" & Hex($color, 2) & Hex($color, 2) & Hex($color, 2))
        GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
        GUICtrlSetGraphic(-1, $GUI_GR_LINE, 189, $i)
        If $color > 0 Then $color -= $color/50
    Next
    $color = 50
    global $G2 = GUICtrlCreateGraphic(11,301,186,47)
    For $i = 0 To 47
        GUICtrlSetGraphic(-1, $GUI_GR_COLOR, "0x" & Hex($color, 2) & Hex($color, 2) & Hex($color+15, 2))
        GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
        GUICtrlSetGraphic(-1, $GUI_GR_LINE, 186, $i)
        If $color > 0 Then $color -= $color/47
    Next
    global $G = GUICtrlCreateGraphic(25, 322, 7, 7)
    GUICtrlSetBkColor(-1, 0x56789a)
    $color =40
    GUICtrlCreateGraphic(200,300,189,50)
    For $i = 0 To 50
        GUICtrlSetGraphic(-1, $GUI_GR_COLOR, "0x" & Hex($color, 2) & Hex($color, 2) & Hex($color, 2))
        GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
        GUICtrlSetGraphic(-1, $GUI_GR_LINE, 189, $i)
        If $color > 0 Then $color -= $color/50
    Next
    $color = 50
    GUICtrlCreateGraphic(201,301,186,47)
    For $i = 0 To 47
        GUICtrlSetGraphic(-1, $GUI_GR_COLOR, "0x" & Hex($color+15, 2) & Hex($color, 2) & Hex($color, 2))
        GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $i)
        GUICtrlSetGraphic(-1, $GUI_GR_LINE, 186, $i)
        If $color > 0 Then $color -= $color/47
    Next
EndFunc   ;==>_SetBackGradients

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