Jump to content
Sign in to follow this  
Bayosky

GUI size & RichText Size

Recommended Posts

Hello,

I'm french ... my english is realy poor... sorry.

 

I have a GUI and, inside, a _GUICtrlRichEdit
The GUI is resizable and I want to know the size for adapting the size of _GUICtrlRichEdit

I use     GUISetOnEvent($GUI_EVENT_RESIZED,"SIZE")

but, into the function SIZE() , I dont know how to

- read the new position and size of the GUI

- Change the size of the    _GUICtrlRichEdit

 

Thank's

HB

 

Share this post


Link to post
Share on other sites

Hi Bayosky,

This did it for me a few weeks ago :

#include <GUIConstantsEx.au3>
#include <GuiRichEdit.au3>
#include <WindowsConstants.au3>

Global $hGui = GUICreate("RichEdit control (resized with GUI)", 600, 400, -1, -1, _
    $WS_SIZEBOX, $WS_EX_TOPMOST)
Global $hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 0, 0, 600, 400, _
    BitOr($WS_VSCROLL, $ES_MULTILINE))

GUIRegisterMsg($WM_SIZE, "WM_SIZE") ; resize RichEdit control while resizing GUI
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _GUICtrlRichEdit_Destroy($hRichEdit)
            GUIDelete($hGui)
            Exit
    EndSwitch
WEnd

Func WM_SIZE($hWndGUI, $MsgID, $wParam, $lParam)
    Local $iWidth = _WinAPI_LoWord($lParam)
    Local $iHeight = _WinAPI_HiWord($lParam)
    ; _WinAPI_MoveWindow($hRichEdit, 0, 0, $iWidth, $iHeight)
    _WinAPI_MoveWindow($hRichEdit, 8, 8, $iWidth - 16, $iHeight - 16)
    ; Return $GUI_RUNDEFMSG
    Return 0 ; "an application should return zero if it processes this message" (MSDN)
EndFunc      ; ==> WM_SIZE

If you want your RichEdit control to have maximum space, choose the other _WinAPI_MoveWindow() line, the one with 0, 0
Good luck :)

 

Edited by pixelsearch

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...