SkinView.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // SkinView.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. //#include "dialog.h"
  5. #include "SkinView.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CSkinView
  13. CSkinView::CSkinView()
  14. {
  15. }
  16. CSkinView::~CSkinView()
  17. {
  18. }
  19. BEGIN_MESSAGE_MAP(CSkinView, CStatic)
  20. //{{AFX_MSG_MAP(CSkinView)
  21. ON_WM_PAINT()
  22. ON_WM_ERASEBKGND()
  23. //}}AFX_MSG_MAP
  24. END_MESSAGE_MAP()
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CSkinView message handlers
  27. BOOL CSkinView::LoadBKImage(LPCTSTR szImagePath)
  28. {
  29. return m_bmpBK.LoadImage(szImagePath);
  30. }
  31. void CSkinView::OnPaint()
  32. {
  33. CPaintDC dc(this); // device context for painting
  34. CRect rcClient;
  35. GetClientRect(&rcClient);
  36. CEnBitmap bmp;
  37. if (m_bmpBK.m_hObject !=0)
  38. m_bmpBK.ExtendDraw(&dc,rcClient,5,5);
  39. //Ö»»­×óÓұ߿ò
  40. CPen pen(PS_SOLID,1,m_ViewBorder);
  41. CPen * oldPen=dc.SelectObject(&pen);
  42. dc.MoveTo(rcClient.left ,rcClient.top);
  43. dc.LineTo(rcClient.left ,rcClient.bottom );
  44. dc.MoveTo(rcClient.right ,rcClient.top);
  45. dc.LineTo(rcClient.right ,rcClient.bottom );
  46. dc.SelectObject(&oldPen);
  47. // Do not call CStatic::OnPaint() for painting messages
  48. }
  49. BOOL CSkinView::OnEraseBkgnd(CDC* pDC)
  50. {
  51. return TRUE;
  52. }