faustf

queston about GUICtrlCreateGraphic

5 posts in this topic

hi guy 

how  is possible set  on top   a  line  created with GUICtrlCreateGraphic ? 

i used GUICtrlSetState(-1 ,$GUI_ONTOP)  but  stay on top only  is  you not  use  nothing  over the  gui , if   you put  them a  inputbox or  edit box , the line  go down  the  inputbox or  edit 

i wanna create  somthing like  this  (foto in attach) ,  how  is possible to do ???  

 

Untitled.jpg

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi. You can do something like this (its not the best way, but do the trick). need to be cleaned and free resource....

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
Global $hDC, $hPen, $o_Orig
#Region ### START Koda GUI section ### Form=
Global $hGUI = GUICreate("Form1", 603, 348, 192, 124)
Global $iLeft = 20, $iTop = 32
Global $Edit1 = GUICtrlCreateEdit("", $iLeft, $iTop, 561, 289)


$hDC = _WinAPI_GetWindowDC(GUICtrlGetHandle($Edit1)) ; DC of entire screen (desktop)
$hPen = _WinAPI_CreatePen($PS_SOLID, 2, 0xFF)
$o_Orig = _WinAPI_SelectObject($hDC, $hPen)


GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


Local $nMsg = 0
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
    Draw()
WEnd

Func Draw()
    Local $aSize = 0
    _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_UPDATENOW) ; force redraw of Gui (Rect=0 Region=0)
    $aSize = ControlGetPos($hGUI, "", $Edit1)
    If Not IsArray($aSize) Then Return
    $aSize[0] = $aSize[0] - $iLeft
    $aSize[1] = $aSize[1] - $iTop
    _WinAPI_DrawLine($hDC, $aSize[0], $aSize[1] + 1, $aSize[2], $aSize[1] + 1)
    _WinAPI_DrawLine($hDC, $aSize[0], $aSize[1] + 1 + 20, $aSize[2] + 1, $aSize[1] + 20)
    _WinAPI_DrawLine($hDC, $aSize[0], $aSize[1] + 1 + 40, $aSize[2] + 1, $aSize[1] + 40)
    _WinAPI_DrawLine($hDC, $aSize[0] + 1, $aSize[1], $aSize[0] + 1, $aSize[3])
    _WinAPI_DrawLine($hDC, $aSize[2] - 1, $aSize[1], $aSize[2] - 1, $aSize[2])
    _WinAPI_DrawLine($hDC, $aSize[0], $aSize[3] - 1, $aSize[2], $aSize[3] - 1)
    _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_VALIDATE) ; then force no-redraw of Gui
EndFunc   ;==>Draw

Saludos

Edited by Danyfirex
1 person likes this

Share this post


Link to post
Share on other sites

o thankz so mcuh 

 

Share this post


Link to post
Share on other sites

but  how  is  possible  cancel the   rectangle??? 

 

Share this post


Link to post
Share on other sites

i answer me  destroy  eedit  and recreate :)  simply   :)

 

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