Sign in to follow this  
Followers 0
Iczer

Draw Edge on non square or round GUI

4 posts in this topic

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

Share this post


Link to post
Share on other sites



Hi,

I remember an old function called _GUIRoundCorners, available

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
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

Share this post


Link to post
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.

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