Jump to content

Is it possible to change color on my gui's border?


AdmiralAlkex
 Share

Recommended Posts

Lets say I create a gui like this:

GUICreate("TEST", 320, 240, -1, -1, BitOR($WS_SIZEBOX, $WS_POPUP))
GUISetBkColor(0x000000)

You will get a black gui with a whitish/greyish border (atleast on WinXP) around the gui for the "sizebox" and that doesn't look very good, is it possible to change the borders color to black somehow??

Link to comment
Share on other sites

Lets say I create a gui like this:

GUICreate("TEST", 320, 240, -1, -1, BitOR($WS_SIZEBOX, $WS_POPUP))
GUISetBkColor(0x000000)

You will get a black gui with a whitish/greyish border (atleast on WinXP) around the gui for the "sizebox" and that doesn't look very good, is it possible to change the borders color to black somehow??

MrCreatoR wrote a udf, (I think it's in example scripts,) for resizing controls and I have copied his idea and changed it to use it for resizing a popup window which doesn't have the sizing borders. My udf needs modifying a bit because it has some code which is only useful for my script and I haven't got time to look at it now. If no-one provides a solution to your problem you are welcome to have my version but it won't be until tomorrow. Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

AdmiralAlkex

Hi! Try this:

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

Global Const $PS_SOLID = 0

$hGUI = GUICreate("TEST", 320, 240, -1, -1, BitOR($WS_POPUP, $WS_SIZEBOX))
GUISetBkColor(0x000000)

GUIRegisterMsg($WM_NCPAINT, "WM_NCPAINT")

GUISetState()

Do
Until GUIGetMsg() = -3

Func WM_NCPAINT($hWnd, $Msg, $wParam, $lParam)
    Local $hDC, $hPen, $OldPen, $OldBrush, $aHwndPos
    
    $hDC = _WinAPI_GetWindowDC($hWnd)
    
    $hPen = DllCall("gdi32.dll", "hwnd", "CreatePen", "int", $PS_SOLID, "int", 5, "int", 0x0000FF)
    $hPen = $hPen[0]
    
    $OldPen = _WinAPI_SelectObject($hDC, $hPen)
    $OldBrush = _WinAPI_SelectObject($hDC, _WinAPI_GetStockObject($NULL_BRUSH))
    
    $aHwndPos = WinGetPos($hWnd)
    
    DllCall("gdi32.dll", "int", "Rectangle", "hwnd", $hDC, "int", 1, "int", 1, "int", $aHwndPos[2], "int", $aHwndPos[3])
    
    _WinAPI_SelectObject($hDC, $OldBrush)
    _WinAPI_SelectObject($hDC, $OldPen)
    _WinAPI_DeleteObject($hPen)
    _WinAPI_ReleaseDC($hWnd, $hDC)
    
    Return True
EndFunc

;)

Link to comment
Share on other sites

@martin

Feel free to post yours if you want, but rasim's example for me so it is not necessary.

@rasim

That works perfect with my script, thank you! ;)

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