I'm just beginning to look at controlling flicker when resizing a dialog.
I wrote a simple app with two image controls and put a picture in each.
Then I used %WM_SIZE to trigger resizing the controls. The resizing works fine but the use of Dialog Redraw gives MUCH more noticeable flicker than using a redraw for each of the two controls I placed on the dialog.
This is the opposite of what Help says - which is that Control Redraw schedules a redraw whereas Dialog Redraw gives immediate results.
Is there a general rule about using redraw commands, or more likely a body of experience on the topic to get flicker free resizing of controls on a dialog.
I did a brief forum search on flicker, but most posts didn't seem to address the question, although I must admit I didn't search long and hard.
Here's the whole example, if it's needed. I used one of my PBR files to get an image for the imagex controls.
I wrote a simple app with two image controls and put a picture in each.
Then I used %WM_SIZE to trigger resizing the controls. The resizing works fine but the use of Dialog Redraw gives MUCH more noticeable flicker than using a redraw for each of the two controls I placed on the dialog.
Code:
Dialog Redraw hDlg vs Control ReDraw hDlg, 110 Control ReDraw hDlg, 120
Is there a general rule about using redraw commands, or more likely a body of experience on the topic to get flicker free resizing of controls on a dialog.
I did a brief forum search on flicker, but most posts didn't seem to address the question, although I must admit I didn't search long and hard.
Here's the whole example, if it's needed. I used one of my PBR files to get an image for the imagex controls.
Code:
#Compile Exe #Include "Win32API.inc" #Resource "pb-test.pbr" Global hDlg As Dword, hLst As Dword, hTemp As Dword Global style&, extstyle& Function PBMain() As Long Dialog New Pixels, 0, "Graphic Control Test",300,300,450,380, _ %WS_OverlappedWindow, 0 To hDlg style& = %WS_Visible Or %SS_Notify Control Add ImageX, hDlg, 110,"cowgirl", 0,0,200,300, style& Control Add ImageX, hDlg, 120,"cowgirl", 210,0,200,300, style& Dialog Show Modal hDlg Call DlgProc End Function CallBack Function DlgProc() As Long If Cb.Msg = %WM_Size Then Dim w As Long, h As Long 'width/height of dialog Dialog Get Client hDlg To w,h Control Set Size hDlg, 110, w/2-4, h Control Set Size hDlg, 120, w/2-4, h Control Set Loc hDlg, 120, w/2+4, 0 ' Dialog ReDraw hDlg Control ReDraw hDlg, 110 Control ReDraw hDlg, 120 End If End Function
Comment