CListView - Overriding OnPaint() 
Author Message
 CListView - Overriding OnPaint()

Hi,

I've been thinking about something...

I have an application where I am updating a list at a high rate of speed.
I guess the CListView doesn't use a MemoryDC to do quick refreshes and
instead I see that
annoying blinking and the list isn't updated as quickly as I want.

I suppose I will have to ovveride the CListView::OnPaint() to do this.
and dig up what is done in the MFC CListView::OnPaint() and change it.
Is this feasible?

I am also trying to figure out a way to change the font in the Items List.
Could this be another tough assignment?

I am using the CListViewEx & the CListView Base class.

Thanks for your help,
// in full row select mode, we need to extend the clipping region
 // so we can paint a selection all the way to the right
 if (m_bClientWidthSel &&
  (GetStyle() & LVS_TYPEMASK) == LVS_REPORT &&
  GetFullRowSel())
 {
  CRect rcAllLabels;
  GetListCtrl().GetItemRect(0, rcAllLabels, LVIR_BOUNDS);

  if(rcAllLabels.right < m_cxClient)
  {
   // need to call BeginPaint (in CPaintDC c-tor)
   // to get correct clipping rect
   CPaintDC dc(this);

   CRect rcClip;
   dc.GetClipBox(rcClip);

   rcClip.left = min(rcAllLabels.right-1, rcClip.left);
   rcClip.right = m_cxClient;

   InvalidateRect(rcClip, FALSE);
   // EndPaint will be called in CPaintDC d-tor
  }
 }

 CListView::OnPaint(); ?? <- Call the Base Class to do the painting

Quote:
}



Thu, 30 Dec 2004 01:08:42 GMT  
 CListView - Overriding OnPaint()

Quote:
>I have an application where I am updating a list at a high rate of speed.
>I guess the CListView doesn't use a MemoryDC to do quick refreshes and
>instead I see that
>annoying blinking and the list isn't updated as quickly as I want.

>I suppose I will have to ovveride the CListView::OnPaint() to do this.
>and dig up what is done in the MFC CListView::OnPaint() and change it.
>Is this feasible?

Christopher,

The list view is a wrapper around the list control, so you won't be
able to paint it that way. You could possibly use custom draw
(NM_CUSTOMDRAW), or a full owner drawn control, but I don't know if
they would necessarily help you resolve the flicker (they may - I
don't know).

Quote:
>I am also trying to figure out a way to change the font in the Items List.
>Could this be another tough assignment?

You can change the font of any standard Windows control using the
WM_SETFONT facility. If you want to change the font for part of the
control, then you can make use of the custom draw facilities.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.



Thu, 30 Dec 2004 09:38:48 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Overriding OnPaint of CListView

2. About override the OnPaint function.

3. About override the OnPaint function!

4. Override OnPaint in ATL/WTL

5. OnPaint override on CListViewCtrl?

6. OnPaint() override

7. Can we override a control's OnPaint ?

8. CListBox -- Owner Drawn - (override OnPaint) - Need help, please!

9. Overriding the OnPaint method for button controls

10. overriding events (OnPaint, OnClick, etc.)

11. CListCtrl - override clistctrl in clistview

12. Q: How to override CListView drawing?

 

 
Powered by phpBB® Forum Software