1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- // BitmapEx.h: interface for the CBitmapEx class.
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_BitmapEx_H__73EF928E_90A7_461A_B879_7E3007684679__INCLUDED_)
- #define AFX_BitmapEx_H__73EF928E_90A7_461A_B879_7E3007684679__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- //#include "include\Picture.h"
- //#include "EnBitmap.h"
- class CBitmapEx : public CBitmap
- {
- public:
- BOOL Draw(CDC *pDC, LPRECT r, int pos);
- void TransParentDraw(CDC *pDC, CRect rc, COLORREF col);
- BOOL LoadImage(LPCTSTR szImagePath, COLORREF crBack = 0);
- BOOL LoadImage(UINT uIDRes, LPCTSTR szResourceType, HMODULE hInst = NULL, COLORREF crBack = 0);
- // helpers
- static BOOL GetResource(LPCTSTR lpName, LPCTSTR lpType, HMODULE hInst, void* pResource, int& nBufSize);
- static IPicture* LoadFromBuffer(BYTE* pBuff, int nSize);
- BOOL Draw( CDC *pDC, LPRECT r);
- //draw sub bmp to special point
- BOOL Draw( CDC *pDC, int x, int y, LPRECT sr );
- BOOL Draw( CDC *pDC, int x, int y, LPRECT sr, COLORREF colTrans, BOOL bTrans );
- BOOL StretchDraw(CDC *pDC, LPRECT tr, LPRECT sr );
- BOOL StretchDraw(CDC *pDC, LPRECT r);
- BOOL StretchDraw2(CDC *pDC, LPRECT r);
- int Width()
- {
- return GetWidth();
- }
-
- int GetWidth()
- {
- BITMAP bm;
- memset( &bm, 0, sizeof(bm) );
- GetBitmap(&bm);
- return bm.bmWidth;
- }
- int Height()
- {
- return GetHeight();
- }
-
- int GetHeight()
- {
- BITMAP bm;
- memset( &bm, 0, sizeof(bm) );
- GetBitmap(&bm);
- return bm.bmHeight;
- }
-
- CBitmapEx();
- virtual ~CBitmapEx();
- BOOL Attach(IPicture* pPicture, COLORREF crBack);
- BOOL Attach( HBITMAP hbmp )
- {
- return CBitmap::Attach( hbmp );
- }
- /*
- HBITMAP hBitmap = NULL;
- hBitmap = (HBITMAP)LoadImage(NULL, szFilename, IMAGE_BITMAP, 0, 0,
- LR_LOADFROMFILE | LR_CREATEDIBSECTION | LR_DEFAULTSIZE);
- */
- /* BOOL LoadBitmap(LPCTSTR szFilename)
- {
- ASSERT(szFilename);
- DeleteObject();*/
- /*
- CClientDC dc(NULL);
- CPicture pic;
- if ( !pic.LoadPicture( szFilename ) )
- return FALSE;
- HBITMAP hBitmap = pic.CreateDDB(&dc);
- pic.DeleteObject();
- return Attach(hBitmap);
- */
- // return LoadImage( szFilename );
- // }
- BOOL DrawTransparent(CDC * pDC, int x, int y, COLORREF crColour);
- HRGN CreateRgnFromFile( COLORREF color );
- };
- #endif // !defined(AFX_BitmapEx_H__73EF928E_90A7_461A_B879_7E3007684679__INCLUDED_)
|