Jump to content

GUI Resizing Flicker


Recommended Posts

Everytime i resize a GUI Window it flickers horribly,it's so evident it becomes annoying.Here's the GUI creation code

$MainForm = GUICreate($WindowTitle, 701, 481, 265, 145,BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX,$WS_CAPTION, $WS_POPUP, $WS_SIZEBOX))

I'm doing something wrong or is it a native AU3 problem?

Link to comment
Share on other sites

Everytime i resize a GUI Window it flickers horribly,it's so evident it becomes annoying.Here's the GUI creation code

$MainForm = GUICreate($WindowTitle, 701, 481, 265, 145,BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX,$WS_CAPTION, $WS_POPUP, $WS_SIZEBOX))

I'm doing something wrong or is it a native AU3 problem?

What exactly flickering? GUI window or items? If items is flickering, that this is normal behavior. I run a mspaint program and when i do resize the mspaint window all items flickering. :D
Link to comment
Share on other sites

What exactly flickering? GUI window or items? If items is flickering, that this is normal behavior. I run a mspaint program and when i do resize the mspaint window all items flickering. :D

Resize windows explorer,for example,and you'll see: no flicker at all.That's what's like with most windows.

I've got another issue with resizing:I have a Pic Control that gets resized within the GUI.When i resize it,the picture resizes too.But when i change/set the picture again,it changes back to the original size,not even the picture size.Is that a AU3 bug or do i need a message hook or something to to it myself?

Edited by danielkza
Link to comment
Share on other sites

Resize windows explorer,for example,and you'll see: no flicker at all.That's what's like with most windows.

Use the extended window style $WS_EX_COMPOSITED and the flickering will go away.

Const $WS_EX_COMPOSITED = 0x2000000

I've got another issue with resizing:I have a Pic Control that gets resized within the GUI.When i resize it,the picture resizes too.But when i change/set the picture again,it changes back to the original size,not even the picture size.Is that a AU3 bug or do i need a message hook or something to to it myself?

Maybe before you set the pic again find out what it's current size is and set the size to that after changing the image.
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

Use the extended window style $WS_EX_COMPOSITED and the flickering will go away.

Const $WS_EX_COMPOSITED = 0x2000000

The flicker is gone,but also is the window structure.The backgroud is transparent now.

Maybe before you set the pic again find out what it's current size is and set the size to that after changing the image.

I tried that,but ControlMove messes the pictures up.

Link to comment
Share on other sites

Add a $WS_CLIPCHILDREN style:

#include <GuiConstants.au3>

$hGUI = GUICreate("Test GUI", 300, 200, -1, -1, _
BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX,$WS_CAPTION, $WS_POPUP, $WS_SIZEBOX, $WS_CLIPCHILDREN))

$hPic = GUICtrlCreatePic(@SystemDir & "\setup.bmp", 0, 0, 300, 200)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
GUICtrlSetState(-1, $GUI_DISABLE)

GUISetState()

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

Hmm... interesting problem. I try to use double buffering, but GUI still fickering :D

#include <GuiConstants.au3>
#include <WinAPI.au3>

$hGUI = GUICreate("Test GUI", 300, 200, -1, -1, _
BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX,$WS_CAPTION, $WS_POPUP, $WS_SIZEBOX))

$hPic = GUICtrlCreatePic(@SystemDir & "\setup.bmp", 0, 0, 300, 200)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
GUICtrlSetState(-1, $GUI_DISABLE)

GUIRegisterMsg($WM_PAINT, "WM_PAINT")

GUISetState()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Func WM_PAINT($hWnd, $Msg, $wParam, $lParam)
    Local $PAINTSTRUCT = DllStructCreate("hwnd hdc;int fErase;dword rcPaint[4];int fRestore;int fIncUpdate;byte rgbReserved[32]")
    
    Local $hDC = DllCall("user32.dll", "hwnd", "BeginPaint", "hwnd", $hWnd, "ptr", DllStructGetPtr($PAINTSTRUCT))
    $hDC = $hDC[0]
    
    Local $win_width = DllStructGetData($PAINTSTRUCT, "rcPaint", 3)
    Local $win_height = DllStructGetData($PAINTSTRUCT, "rcPaint", 4)
    
    Local $hdcMem = _WinAPI_CreateCompatibleDC($hDC)
    Local $hbmMem = _WinAPI_CreateCompatibleBitmap($hDC, $win_width, $win_height)
    Local $hOld = _WinAPI_SelectObject($hdcMem, $hbmMem)
    
    _WinAPI_BitBlt($hDC, 0, 0, $win_width, $win_height, $hdcMem, 0, 0, $SRCCOPY)
    
    _WinAPI_SelectObject($hdcMem, $hOld)
    _WinAPI_DeleteObject($hbmMem)
    _WinAPI_DeleteDC($hdcMem)
    DllCall("user32.dll", "int", "EndPaint", "hwnd", $hDC, "ptr", DllStructGetPtr($PAINTSTRUCT))
    
    Return $GUI_RUNDEFMSG
EndFunc
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...