Flickering problem
-
I am trying to develop the gird control in which Comboboxes are displayed over each subitem. In DrawItem event i am displaying the combobox for each subitem, which is i think cause the flickering problem. Anyone knows the solution to remove the flickering in this scenario.
for(int nRow = 0; nRow < rows; ++ nRow) { for(int nCol = 0; cols; nCol++ ) { //Drawing combos by ShowWindow(SW_SHOW) call } }
-
I am trying to develop the gird control in which Comboboxes are displayed over each subitem. In DrawItem event i am displaying the combobox for each subitem, which is i think cause the flickering problem. Anyone knows the solution to remove the flickering in this scenario.
for(int nRow = 0; nRow < rows; ++ nRow) { for(int nCol = 0; cols; nCol++ ) { //Drawing combos by ShowWindow(SW_SHOW) call } }
While I've never had to do what you're doing, two things come to mind 1. Queue up the display of multiple windows with DeferWindowPos() 2. In the parent, change the erase background code to create a region that exclude the area of the child windows - I neat trick for dealing with excessive flickering when resizing a dialog. I hope this helps [ Jason De Arte | Toy Maker | 1001010.com ]
-
While I've never had to do what you're doing, two things come to mind 1. Queue up the display of multiple windows with DeferWindowPos() 2. In the parent, change the erase background code to create a region that exclude the area of the child windows - I neat trick for dealing with excessive flickering when resizing a dialog. I hope this helps [ Jason De Arte | Toy Maker | 1001010.com ]
Jason De Arte wrote: 2. In the parent, change the erase background code to create a region that exclude the area of the child windows - I neat trick for dealing with excessive flickering when resizing a dialog. Isn't WS_CLIPCHILDREN supposed to do this... :confused: I've a couple of dialogs which I want flicker free. WS_CLIPCHILDREN doesn't always help me. :| Say, you don't have a small dialog sample anywhere you'd like to show me, or better yet, write an article about it? :) -- Arigato gozaimashita!
-
Jason De Arte wrote: 2. In the parent, change the erase background code to create a region that exclude the area of the child windows - I neat trick for dealing with excessive flickering when resizing a dialog. Isn't WS_CLIPCHILDREN supposed to do this... :confused: I've a couple of dialogs which I want flicker free. WS_CLIPCHILDREN doesn't always help me. :| Say, you don't have a small dialog sample anywhere you'd like to show me, or better yet, write an article about it? :) -- Arigato gozaimashita!
Jörgen Sigvardsson wrote: Say, you don't have a small dialog sample anywhere you'd like to show me, or better yet, write an article about it? When I have some time, I might write a small article - but it's realy easy to do for most controls (except group boxes) on your resizing dialog. 1. In your WM_ERASEBKGND handler... 2. Create a region of the client area 3. For each valid & visible child window you want to exclude, 3.a. create a region of that window (try GetWindowRgn, XP Themes tends to make buttons round) 3.b. remove the child region - CombineRgn(rgnChild,rgnDlg,RGN_XOR) 4. Paint your background, I use FillRgn 5. return TRUE from WM_ERASEBKGRND, or all your work will be undone. Minor details were left out, but you'll get the idea. [ Jason De Arte | Toy Maker | 1001010.com ]
-
Jörgen Sigvardsson wrote: Say, you don't have a small dialog sample anywhere you'd like to show me, or better yet, write an article about it? When I have some time, I might write a small article - but it's realy easy to do for most controls (except group boxes) on your resizing dialog. 1. In your WM_ERASEBKGND handler... 2. Create a region of the client area 3. For each valid & visible child window you want to exclude, 3.a. create a region of that window (try GetWindowRgn, XP Themes tends to make buttons round) 3.b. remove the child region - CombineRgn(rgnChild,rgnDlg,RGN_XOR) 4. Paint your background, I use FillRgn 5. return TRUE from WM_ERASEBKGRND, or all your work will be undone. Minor details were left out, but you'll get the idea. [ Jason De Arte | Toy Maker | 1001010.com ]
I think I understand the idea. Now the question is; is this applicable for other controls than dialogs? I've had controls on resizable tab controls, and the flickering has been so bad. For this to work I need to be able to draw theme backgrounds using regions (tab controls have gradient backgrounds in XP). Seeing that the theme APIs don't make use of regions, I suppose I will have to give the HDC a clipping region. Do you know if that is possible? I'm guessing that selecting (SelectObject) a region will cause DC operations to be clipped by the region. (I'm really lost when it comes to advanced GDI :-O) -- Arigato gozaimashita!