Jump to content

Draw Edge on non square or round GUI


Iczer
 Share

Recommended Posts

Is there some way to draw edge on non square or round GUI ?

like make _WinAPI_DrawEdge($hDC, $ptrRect, $nEdgeType, $grfFlags) accept result of _WinAPI_CombineRgn in place $ptrRect,

or special brush to draw borders with a _WinAPI_FrameRgn

I need to replace red line with edge - $BDR_RAISEDINNER / $BDR_SUNKENINNER / $BDR_RAISEDOUTER / $BDR_SUNKENOUTER or combinations

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hBrush, $hDC
Local $hBrush, $hDC, $hGUI, $ptrRect, $tRect,$hRgn,$hRgn2,$Button
Local $iWidth = 1, $iHeight = 1
Local $aPoint[7][2] = [[0, 180], [190, 180], [250, 0], [308, 180], [500, 180], [400, 362], [100, 362]]

$hGUI = GUICreate("WinAPI", 500, 500,-1,-1, BitOR($WS_POPUP,$DS_MODALFRAME,$DS_SETFOREGROUND),$WS_EX_TOPMOST)
WinSetTrans($hGUI, "", 255)
$Button = GUICtrlCreateButton('Exit', 215, 255, 70, 23)
$hDC = _WinAPI_GetWindowDC($hGUI)

$hBrush = _WinAPI_CreateSolidBrush(0x0000FF)

$hRgn = _WinAPI_CreatePolygonRgn($aPoint)
$hRgn2 = _WinAPI_CreateRoundRectRgn($aPoint[2][0]-25, $aPoint[2][1], $aPoint[2][0]+25, $aPoint[2][1]+50, 50, 50)
_WinAPI_CombineRgn($hRgn, $hRgn, $hRgn2, $RGN_OR)
_WinAPI_DeleteObject($hRgn2)

GUISetState()

_WinAPI_FrameRgn ( $hDC, $hRgn, $hBrush, $iWidth, $iHeight )
_WinAPI_SetWindowRgn($hGUI, $hRgn)

Do
Until GUIGetMsg() = $Button

_WinAPI_DeleteObject($hBrush)
_WinAPI_ReleaseDC($hGUI, $hDC)
EndFunc
Link to comment
Share on other sites

Round corners is not problem - problem is round 3d edge - like this, but round or star-shaped :

#include <StaticConstants.au3>
#Include <GUIConstantsEx.au3>
#Include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <BorderConstants.au3>
#Include <WinAPIEx.au3> 

$hGUI = GUICreate("", 400, 300,-1,-1, BitOR($WS_POPUP,$DS_MODALFRAME,$DS_SETFOREGROUND),$WS_EX_TOPMOST)
$Button = GUICtrlCreateButton('Exit', 80, 100, 70, 23)
GUISetState()

$hDC = _WinAPI_GetWindowDC($hGUI)

$tRect = DllStructCreate($tagRECT)
DllStructSetData($tRect, "Left", 20)
DllStructSetData($tRect, "Top", 50)
DllStructSetData($tRect, "Right", 200)
DllStructSetData($tRect, "Bottom", 200)
$ptrRect = DllStructGetPtr($tRect)

_WinAPI_DrawEdge($hDC, $ptrRect, $EDGE_RAISED, $BF_RECT)
$hRgn = _WinAPI_CreateRectRgnIndirect ( $tRECT );_WinAPI_CreateRect ( 20, 50, 205, 205)
_WinAPI_SetWindowRgn($hGUI, $hRgn)
_WinAPI_ReleaseDC($hGUI, $hDC)

Do
Until GUIGetMsg() = $Button
Link to comment
Share on other sites

You could use pictures.

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

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