473,398 Members | 2,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

CreateParams issue

31
hi all!

I have an aggrieviating problem concerning using CreateParams on my forms. I'm using compositing style (cp.ExStyle|=0x02000000) to eliminate flicker and it works wonderfully in most cases. However, i've noticed that on controls such as ListBox and TabControl it cancels the effect of drawing in OnDrawItem handler. I've read that compositing style can do that with 3rd party controls. Is there a way to get both the OnDrawItem stuff and compositing to work?
(In OnDrawItem i'm doing some user drawing, such as mnemonics and coloring stuff)

thanx,
M.
Sep 30 '08 #1
5 2561
mldisibio
190 Expert 100+
If someone else has a direct answer, please jump in.

This is not a direct answer, but perhaps a workaround.
If you've read through the entire post on MSDN : Flicker-Free Painting you probably already know that the composite painting flag is not compatible with Vista, and presents several other quirks, such as what you have pointed out.

The workaround I have gone with is this:
- Override the Form.OnResizeBegin method:
- Loop through each visible control on the form and stop its drawing with the WM_SETREDRAW(0) message.
- Override the From.OnResizeEnd method:
- Redraw the controls by sending the WM_SETREDRAW(1) message.

I do not propose this is the only way to stop flicker or the best, but it avoids the issues with the CompositePaint flag.

The one drawback to this solution is that when you drag/resize your form, you do not see the effect on the controls until you let go of the Resize drag cursor. So it is not as "seamless" as the composite flag. Nonetheless, I think it will solve your problem, because the WM_SETREDRAW message should (but I haven't proven) fire the OnDrawItem event you need.
Oct 1 '08 #2
Mecena
31
thanx, i'll give it a try!

M.

If someone else has a direct answer, please jump in.

This is not a direct answer, but perhaps a workaround.
If you've read through the entire post on MSDN : Flicker-Free Painting you probably already know that the composite painting flag is not compatible with Vista, and presents several other quirks, such as what you have pointed out.

The workaround I have gone with is this:
- Override the Form.OnResizeBegin method:
- Loop through each visible control on the form and stop its drawing with the WM_SETREDRAW(0) message.
- Override the From.OnResizeEnd method:
- Redraw the controls by sending the WM_SETREDRAW(1) message.

I do not propose this is the only way to stop flicker or the best, but it avoids the issues with the CompositePaint flag.

The one drawback to this solution is that when you drag/resize your form, you do not see the effect on the controls until you let go of the Resize drag cursor. So it is not as "seamless" as the composite flag. Nonetheless, I think it will solve your problem, because the WM_SETREDRAW message should (but I haven't proven) fire the OnDrawItem event you need.
Oct 1 '08 #3
Mecena
31
i tried your solution, but unfortunately it doesn't improve quality in the way compositing style does, and there are unwelcome side effects; it does howerver resolve the OnDrawItem issue, all goes well there..
thanx anyway!

If someone else has a direct answer, please jump in.

This is not a direct answer, but perhaps a workaround.
If you've read through the entire post on MSDN : Flicker-Free Painting you probably already know that the composite painting flag is not compatible with Vista, and presents several other quirks, such as what you have pointed out.

The workaround I have gone with is this:
- Override the Form.OnResizeBegin method:
- Loop through each visible control on the form and stop its drawing with the WM_SETREDRAW(0) message.
- Override the From.OnResizeEnd method:
- Redraw the controls by sending the WM_SETREDRAW(1) message.

I do not propose this is the only way to stop flicker or the best, but it avoids the issues with the CompositePaint flag.

The one drawback to this solution is that when you drag/resize your form, you do not see the effect on the controls until you let go of the Resize drag cursor. So it is not as "seamless" as the composite flag. Nonetheless, I think it will solve your problem, because the WM_SETREDRAW message should (but I haven't proven) fire the OnDrawItem event you need.
Oct 1 '08 #4
mldisibio
190 Expert 100+
Bummer. Let me just ask a few more things before I abandon you to the flicker netherworld.

- Did you remove the Composite flag before you tried my solution?
- Did you set the DrawMode property correctly (OwnerDrawFixed)?
- Is your flicker problem on the intial drawing or during resizing?
- If the problem is during the initial drawing of the control, and since you are doing your own painting, have you tried the double-buffering technique without the composite flag?

I realize that the OnDrawItem is somewhat of an "iteration" method...one for each tab or list item...so double buffering may not even be possible because it assumes you are drawing everything at once...I'm just throwing out ideas here that maybe get you thinking of a different workaround.
Oct 1 '08 #5
Mecena
31
to answer yr questions:
- yes i did, in fact i tried both combos
- DrawMode is set to OwnerDrawFixed
- flickering is related to initial drawing, resizing is disabled
- double buffering using SetStyles doesn't help, tried that too.. only i switch it on every control type i'm using (since i have my own wrappers).. maybe if i tried that..

i do have an alternative solution which i've implemented to resolve flicker during initialization and that is fading, but it is cca 250 ms slower than normal loading, and i want my forms to be super-responsive; but fading doesn't solve flicker during i.e. tabpage switching etc.

i'll try double buffering all my wrappers and reapply yr solution.


Bummer. Let me just ask a few more things before I abandon you to the flicker netherworld.

- Did you remove the Composite flag before you tried my solution?
- Did you set the DrawMode property correctly (OwnerDrawFixed)?
- Is your flicker problem on the intial drawing or during resizing?
- If the problem is during the initial drawing of the control, and since you are doing your own painting, have you tried the double-buffering technique without the composite flag?

I realize that the OnDrawItem is somewhat of an "iteration" method...one for each tab or list item...so double buffering may not even be possible because it assumes you are drawing everything at once...I'm just throwing out ideas here that maybe get you thinking of a different workaround.
Oct 2 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Paul Mateer | last post by:
Hi, I have been running some queries against a table in a my database and have noted an odd (at least it seems odd to me) performance issue. The table has approximately 5 million rows and...
7
by: George Hester | last post by:
Please take a look at this google artcle: http://groups.google.com/groups?hl=en&lr=&frame=right&th=55d6f4b50f5f9382&seekm=411f370d%241%40olaf.komtel.net#link9 The op was having trouble with...
2
by: Anthony Cuttitta Jr. | last post by:
We have an application that outputs several different graphs from data downloaded from our AS400. The application has worked without (this) issue for several months now, but just recently, the...
2
by: Ben Rush | last post by:
Hello World, Okay, I have spent the day browsing the newsgroups and reading up on article after article concerning ViewState corruption and so forth, and I have a couple questions. We...
5
by: Robert | last post by:
I have a series of web applications (configured as separate applications) on a server. There is a main application at the root and then several virtual directories that are independant...
0
by: Kristopher Wragg | last post by:
I've got a control that's used as part of building blocks to create various "views" by our customers, these views are then dynamically compiled then will then be hosted in webpages for their staff...
1
by: aagarwal8 | last post by:
Hi, I have a very simple form containing a TabControl with 2 TabPages. The Dock property for TabControl is set to Fill. TabPage1 contains a TreeView with some nodes. Tabpage2 is currently blank....
13
by: SAL | last post by:
Hello, I'm trying to include a popup in the ItemTemplate of a gridview row. The ItemTemplate for the field contains a textbox and when the user clicks in the textbox I want a popup panel to show...
0
by: RileyHassell | last post by:
I've seen hundreds of unanswered posts on the ListView and related control flicking issues. This arise in the form of an unsuccessful paint of the ListView where edges are not completed or excessive...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.