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.
 
 
 
 
 

129 lines
3.5 KiB

//----------------------------------------------------------------------------
// Laser Guard Ltd.
// Copyright © 2000-2002. All Rights Reserved.
// Version 1.0 01/01/2000
// Last modification: 08/10/2003
// PROJECT:
// SUBSYSTEM:
// FILE: LogoWnd.cpp
// AUTHOR: Sergey Chizhevskiy
// OVERVIEW
// ~~~~~~~~
// Source file of LogoWnd.cpp
//----------------------------------------------------------------------------
// LogoWnd.cpp : implementation file
//
#include "stdafx.h"
#include "chicago.h"
#include "LogoWnd.h"
#include "..\..\LgLib\Version.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CLogoWnd
CLogoWnd::CLogoWnd()
{
m_pOverlayBitmapOld = NULL;
m_bRotate = FALSE;
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CLogoWnd::CLogoWnd") );
}
CLogoWnd::~CLogoWnd()
{
if( m_pOverlayBitmapOld )
{
m_OverlayDC.SelectObject( m_pOverlayBitmapOld );
m_OverlayBitmap.DeleteObject();
m_OverlayDC.DeleteDC();
}
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CLogoWnd::~CLogoWnd") );
}
BEGIN_MESSAGE_MAP(CLogoWnd, CWnd)
//{{AFX_MSG_MAP(CLogoWnd)
ON_WM_PAINT()
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLogoWnd message handlers
BOOL CLogoWnd::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
if( CWnd::CreateEx( WS_EX_DLGMODALFRAME, lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext) )
{
CDC *pDC = GetDC();
m_OverlayDC.CreateCompatibleDC( pDC );
ReleaseDC( pDC );
HBITMAP hBitmap = (HBITMAP)::LoadImage( NULL, "LOGO.BMP", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE );
m_OverlayBitmap.Attach( hBitmap );
// m_OverlayBitmap.LoadBitmap( IDB_BITMAP_LOGO );
m_pOverlayBitmapOld = m_OverlayDC.SelectObject( &m_OverlayBitmap );
m_nStage = 0;
// SetTimer( 0, 125, NULL );
return TRUE;
}
return FALSE;
}
void CLogoWnd::PaintLogo(CDC *pDC)
{
// SYSTEMTIME st;
// ::GetLocalTime( &st );
CRect rect;
GetClientRect( &rect );
const int width = 128;
const int height = 128;
CPoint p( (rect.Width() - width) / 2, (rect.Height() - height) / 2 );
CRect rect1( rect.left, rect.top, rect.left + p.x, rect.bottom );
CRect rect2( rect.left + p.x + width, rect.top, rect.right, rect.bottom );
CRect rect3( rect.left + p.x, rect.top, rect.left + p.x + width, rect.top + p.y );
CRect rect4( rect.left + p.x, rect.top + p.y + height, rect.left + p.x + width, rect.bottom );
COLORREF color = m_OverlayDC.GetPixel( 0, 0 );
pDC->FillSolidRect( &rect1, color );
pDC->FillSolidRect( &rect2, color );
pDC->FillSolidRect( &rect3, color );
pDC->FillSolidRect( &rect4, color );
if( m_bRotate )
pDC->BitBlt( p.x, p.y, width, height, &m_OverlayDC, width * m_nStage, 0, SRCCOPY );
else
pDC->BitBlt( p.x, p.y, width, height, &m_OverlayDC, width * 8, 0, SRCCOPY );
}
void CLogoWnd::OnPaint()
{
CPaintDC dc(this); // device context for painting
PaintLogo( &dc );
}
void CLogoWnd::OnTimer(UINT nIDEvent)
{
m_nStage = (m_nStage+1)%8;
CDC *pDC = GetDC();
PaintLogo( pDC );
ReleaseDC( pDC );
CWnd::OnTimer(nIDEvent);
}
void CLogoWnd::Rotate(BOOL bRotate)
{
m_bRotate = bRotate;
}