flicker free drawing & smooth scrolling!!!

hi friends! i wanna make an active-x control for drawing GANT charts,
so i want some good ideas from u to implement it. Can i use report style of ListView for it, if yes, how can i draw in it. If i dont use CListView & draw all colomns by my self by using 'LineTo' in OnDraw() function of View class, how can i produce FLICKER FREE DRAWING & SMOOTH SCROLLING.
i know a way of using MemoryDC & bit blitting but it make it very slow.
i hope u will tell me the way out.
thanks!!!!
HaroonSiddiqiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JPMartineauCommented:
You can either derive an object from CListCtrl and override its WM_PAINT message handler, or you can use the CListCtrl and respond to custom draw notifications. The difference between both is that owner-draw is handled by the control itself, while custom draw delegates the drawing to the parent window.

You can override the WM_EraseBackground so that the parent's implementation of it will not be called. This should be done whenever you do owner draw stuff, since you paint over the DC anyways. This will prevent some of the flicker. Whoever the only true way I achieved this is by using custom draw and a memory DC. I never experienced performance issues with this method...

If you produce flicker-free drawing, scrolling should be smooth, as it is a specific use of the drawing.

If you use custom Draw, you might also want to create these functions for the window that contains the list control to avoid modifying the contents of the window while the drawing occurs...

void CDialog::LockDraw()
{
      if(m_iLockDrawCount++ == 0)
            m_listCtrl.SetRedraw(FALSE);
}

void CDialog::UnlockDraw()
{
      if(--m_iLockDrawCount == 0)
            m_listCtrl.SetRedraw(TRUE);
}

ex:

LockDraw();
m_listCtrl.InsertItem(...);
UnlockDraw();

Hope this helps...

JPM
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.