GuiDocSpecial.cpp
上传用户:zhanglf88
上传日期:2013-11-19
资源大小:6036k
文件大小:3k
源码类别:

金融证券系统

开发平台:

Visual C++

  1. //-----------------------------------------------------------------------//
  2. // This is a part of the GuiLib MFC Extention.  //
  3. // Autor  :  Francisco Campos  //
  4. // (C) 2002 Francisco Campos <www.beyondata.com> All rights reserved     //
  5. // This code is provided "as is", with absolutely no warranty expressed  //
  6. // or implied. Any use is at your own risk.  //
  7. // You must obtain the author's consent before you can include this code //
  8. // in a software library.  //
  9. // If the source code in  this file is used in any application  //
  10. // then acknowledgement must be made to the author of this program  //
  11. // fcampos@tutopia.com  //
  12. //-----------------------------------------------------------------------//
  13. #include "stdafx.h"
  14. #include "GuiDocSpecial.h"
  15. #ifdef _DEBUG
  16. #undef THIS_FILE
  17. static char THIS_FILE[]=__FILE__;
  18. #define new DEBUG_NEW
  19. #endif
  20. //////////////////////////////////////////////////////////////////////
  21. // Construction/Destruction
  22. //////////////////////////////////////////////////////////////////////
  23. #define _countof(array) (sizeof(array)/sizeof(array[0]))
  24. #define _AfxSetDlgCtrlID(hWnd, nID)     SetWindowLong(hWnd, GWL_ID, nID)
  25. #define _AfxGetDlgCtrlID(hWnd)          ((UINT)(WORD)::GetDlgCtrlID(hWnd))
  26. BEGIN_MESSAGE_MAP(CGuiDocSpecial,CDockBar)
  27.  //{{AFX_MSG_MAP(CGuiDocSpecial)
  28.  ON_WM_SIZE()
  29.  ON_WM_CREATE()
  30.  //}}AFX_MSG_MAP
  31. END_MESSAGE_MAP()
  32. CGuiDocSpecial::CGuiDocSpecial()
  33. {
  34. }
  35. CGuiDocSpecial::~CGuiDocSpecial()
  36. {
  37. }
  38. CSize CGuiDocSpecial::CalcDynamicLayout(int nLength,DWORD nMode)
  39. {
  40. CSize sz=CControlBar::CalcDynamicLayout(nLength,nMode);
  41. // sz.cx+=1;
  42. // sz.cy+=1;
  43. return sz;
  44. }
  45. int CGuiDocSpecial::OnCreate(LPCREATESTRUCT lpCreateStruct)
  46. {
  47. if (CDockBar::OnCreate(lpCreateStruct) == -1)
  48. return -1;
  49. return 0;
  50. }
  51. void CGuiDocSpecial::OnNcPaint()
  52. {
  53. CRect rcWindow;
  54. CRect rcClient;
  55. int m_iBorder=2; 
  56. CWindowDC dc(this);
  57. GetWindowRect(&rcWindow);
  58. GetClientRect(&rcClient);
  59. CBrush cbr;
  60. cbr.CreateSysColorBrush(GuiDrawLayer::GetRGBColorTabs());
  61. rcClient.OffsetRect(-rcWindow.TopLeft());
  62.     rcWindow.OffsetRect(-rcWindow.TopLeft());
  63.     ScreenToClient(rcWindow);
  64. rcClient.OffsetRect(-rcWindow.left,-rcWindow.top);
  65. dc.ExcludeClipRect(rcClient);   
  66. rcWindow.OffsetRect(-rcWindow.left, -rcWindow.top);
  67. int ibotton=rcWindow.bottom;
  68. rcWindow.top=rcWindow.bottom-m_iBorder;
  69. dc.FillRect(rcWindow,&cbr); 
  70. rcWindow.top=0;
  71. rcWindow.bottom+=3;
  72. dc.FillRect(rcWindow,&cbr); 
  73. //un truco primitivo que evita el efecto estar a un nivel encima de la otra barra
  74. dc.FillSolidRect(0,rcWindow.top,rcWindow.right+1,1,::GetSysColor(COLOR_BTNSHADOW)); 
  75. dc.FillSolidRect(0,rcWindow.top+1,rcWindow.right+1,1,::GetSysColor(COLOR_BTNHIGHLIGHT)); 
  76. }
  77. void CGuiDocSpecial::OnSize(UINT nType,int cx,int cy)
  78. {
  79. CDockBar::OnSize(nType,cx,cy);
  80. Invalidate();
  81. }
  82. /*
  83. void CGuiDocSpecial::RecalTabs()
  84. {
  85. int inumTabs=GetDockedCount();
  86. if (inumTabs > 1)
  87. {
  88. for (int i=0; i< inumTabs; i++)
  89. {
  90. //GetNumWnd(int m_numtab)
  91. CString m_caption;
  92. CWnd* pParent=(CWnd*)m_arrBars[i];
  93. ASSERT(pParent);
  94. int j=0;
  95. BOOL bFound=FALSE;
  96. while(j< m_tabwnd.GetCount())
  97. {
  98. if (m_tabwnd.GetNumWnd(j) == pParent)
  99. {
  100. bFound=TRUE;
  101. break;
  102. }
  103. j++;
  104. }
  105. if (bFound == FALSE)
  106. {
  107. pParent->GetWindowText(m_caption);
  108. m_tabwnd.Addtab(pParent,m_caption,i);
  109. }
  110. }
  111. }
  112. }
  113. */