Old fashion design for PC-104
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.4 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 08/10/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: ImageButton.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of ImageButton.cpp
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "ImageButton.h"
  16. #include "..\LgLib\Version.h"
  17. CImageButton::CImageButton()
  18. {
  19. m_hWnd = NULL;
  20. }
  21. CImageButton::~CImageButton()
  22. {
  23. Destroy();
  24. }
  25. BOOL CImageButton::Create( UINT nCtrlID, DWORD dwStyle, HBITMAP hBitmap, LPCTSTR pName, HWND hParent, INT x, INT y, INT cx, INT cy )
  26. {
  27. HINSTANCE hInstance = (HINSTANCE)::GetWindowLong( hParent, GWL_HINSTANCE );
  28. m_hWnd = ::CreateWindowEx( 0, "BUTTON", NULL, dwStyle | WS_CHILD, x, y, cx, cy, hParent, NULL, hInstance, this );
  29. if( !m_hWnd )
  30. return FALSE;
  31. if( dwStyle & BS_BITMAP )
  32. ::SendMessage( m_hWnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBitmap );
  33. else
  34. ::SetWindowText( m_hWnd, pName );
  35. ::SetWindowLong( m_hWnd, GWL_ID, nCtrlID );
  36. ::ShowWindow( m_hWnd, SW_SHOW );
  37. ::UpdateWindow( m_hWnd );
  38. return TRUE;
  39. }
  40. void CImageButton::Destroy()
  41. {
  42. if( m_hWnd )
  43. ::DestroyWindow( m_hWnd );
  44. }