TreeCtrlEx.cpp
上传用户:popouu88
上传日期:2013-02-11
资源大小:2894k
文件大小:2k
源码类别:

IP电话/视频会议

开发平台:

Visual C++

  1. // TreeCtrlEx.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "TreeCtrlEx.h"
  5. #ifdef _DEBUG
  6. #define new DEBUG_NEW
  7. #undef THIS_FILE
  8. static char THIS_FILE[] = __FILE__;
  9. #endif
  10. #pragma comment( lib , "msimg32.lib" )
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CTreeCtrlEx
  13. CTreeCtrlEx::CTreeCtrlEx()
  14. {
  15. }
  16. CTreeCtrlEx::~CTreeCtrlEx()
  17. {
  18. }
  19. BEGIN_MESSAGE_MAP(CTreeCtrlEx, CTreeCtrl)
  20. //{{AFX_MSG_MAP(CTreeCtrlEx)
  21. ON_WM_PAINT()
  22. ON_WM_ERASEBKGND()
  23. ON_WM_MOUSEMOVE()
  24. ON_WM_SIZE()
  25. ON_WM_HSCROLL()
  26. ON_WM_VSCROLL()
  27. //}}AFX_MSG_MAP
  28. END_MESSAGE_MAP()
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CTreeCtrlEx message handlers
  31. void CTreeCtrlEx::OnPaint() 
  32. {
  33. CPaintDC dc( this );
  34. CDC memDC , dcMask;
  35. memDC.CreateCompatibleDC( &dc );
  36. dcMask.CreateCompatibleDC( &dc );
  37. CBitmap b , b2;
  38. CRect rc;
  39. dc.GetClipBox( &rc );
  40. b.CreateCompatibleBitmap( &dc , rc.Width( ) , rc.Height( ) );
  41. b2.CreateCompatibleBitmap( &dc , rc.Width( ) , rc.Height( ) );
  42. memDC.SelectObject( &b );
  43. dcMask.SelectObject( &b2 );
  44. CTreeCtrl::DefWindowProc( WM_PAINT ,( WPARAM )memDC.GetSafeHdc( ) , 0 );
  45. dcMask.FillSolidRect( &rc , RGB( 214 , 239 , 255 ) );
  46. ::TransparentBlt( dcMask.GetSafeHdc( ) , 0 , 0 , rc.Width( ) , rc.Height( ) , memDC.GetSafeHdc( ) , 0 , 0 , rc.Width( ) , rc.Height( ) , ::GetSysColor( COLOR_WINDOW ) );
  47. dc.BitBlt( 0 , 0 , rc.Width( ) , rc.Height( ) , &dcMask , 0 , 0 , SRCCOPY );
  48. }
  49. BOOL CTreeCtrlEx::OnEraseBkgnd( CDC* pDC ) 
  50. {
  51. return TRUE;
  52. }
  53. void CTreeCtrlEx::OnMouseMove(UINT nFlags, CPoint point) 
  54. {
  55. CTreeCtrl::OnMouseMove(nFlags, point);
  56. this->Invalidate( );
  57. }
  58. void CTreeCtrlEx::OnSize(UINT nType, int cx, int cy) 
  59. {
  60. CTreeCtrl::OnSize(nType, cx, cy);
  61. this->Invalidate( );
  62. }
  63. void CTreeCtrlEx::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
  64. {
  65. CTreeCtrl::OnHScroll(nSBCode, nPos, pScrollBar);
  66. this->Invalidate( );
  67. }
  68. void CTreeCtrlEx::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
  69. {
  70. CTreeCtrl::OnVScroll(nSBCode, nPos, pScrollBar);
  71. this->Invalidate( );
  72. }