亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? bitmapdialog.cpp

?? 可以檢測(cè)到插入到USB的設(shè)備的插入或者拔出
?? CPP
字號(hào):
// BitmapDialog.cpp : implementation file
//
// Created by David Forrester, January 1, 2001
// Feel free to use this code in any way you want.

#include "stdafx.h"
#include "BitmapDialog.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


/////////////////////////////////////////////////////////////////////////////
// CBitmapDialog dialog

//----------------------------------------------------------------
// CBitmapDialog :: CBitmapDialog - constructor for CBitmapDialog
//
// Parameters:
//  lpszTemplateName - the name of the dialog template resource
//  nIDTemplate - the ID of the dialog template resource
//  pParentWnd - the parent window
//
// You can leave any or all of the below NULL or 0 to not use it
//  lpszResourceName - the name of the bitmap resource to load
//  nIDResource - the ID of the bitmap resource to load
//  lpszFilename - the filename of the bitmap file to load
//  pBitmap - the bitmap to use (user is responsible for handling the bitmap)

// The common constructor for CBitmapDialog
void CBitmapDialog :: Constructor (LPCTSTR lpszResourceName, UINT nIDResource,
								   LPCTSTR lpszFilename, CBitmap *pBitmap)
{
	m_bTransparent = FALSE;			// No transparency
	m_bStaticTransparent = TRUE;	// Static controls are transparent
	m_bBitmapCreated = FALSE;		// Don't automatically release the bitmap
	m_bBitmapExists = FALSE;		// IS there a bitmap?
	m_bClickAnywhereMove = FALSE;	// Clicking anywhere moves
	
	// Create a hollow brush used in making static controls transparent
	m_brushHollow = (HBRUSH) GetStockObject (HOLLOW_BRUSH);

	// Load a bitmap from a resource name
	if (lpszResourceName != NULL)
	{
		LoadBitmap (lpszResourceName, NULL);
	}
	// Load a bitmap from a resource ID
	else if (nIDResource != 0)
	{
		LoadBitmap (nIDResource);
	}
	// Use the passed bitmap
	else if (pBitmap != 0)
	{
		// NOTE: The user is responsible for handling the bitmap
		SetBitmap (pBitmap);
	}
	// else: No bitmap has been created yet
}

CBitmapDialog::CBitmapDialog (LPCTSTR lpszTemplateName, CWnd* pParentWnd,
							  LPCTSTR lpszResourceName, UINT nIDResource,
							  LPCTSTR lpszFilename, CBitmap *pBitmap)
	: CDialog (lpszTemplateName, pParentWnd)
{
	Constructor (lpszResourceName, nIDResource, lpszFilename, pBitmap);
}

CBitmapDialog::CBitmapDialog (UINT nIDTemplate, CWnd* pParentWnd,
							  LPCTSTR lpszResourceName, UINT nIDResource,
							  LPCTSTR lpszFilename, CBitmap *pBitmap)
	: CDialog (nIDTemplate, pParentWnd)
{
	Constructor (lpszResourceName, nIDResource, lpszFilename, pBitmap);
}

CBitmapDialog::CBitmapDialog (LPCTSTR lpszResourceName, UINT nIDResource,
							  LPCTSTR lpszFilename, CBitmap *pBitmap)
	: CDialog ()
{
	Constructor (lpszResourceName, nIDResource, lpszFilename, pBitmap);
}

//----------------------------------------------------------------
// CBitmapDialog :: LoadBitmap - load a bitmap from a resource or file
//
// Parameters:
//  lpszResourceName - the name of the bitmap resource to load.
//    Set this to NULL if you use lpszFilename.
//  lpszFilename - the filename of the bitmap file to load.
//    Set this to NULL if you use lpszResourceName.
//  nIDResource - the ID of the bitmap resource to load

BOOL CBitmapDialog :: LoadBitmap (LPCTSTR lpszResourceName, LPCTSTR lpszFilename)
{
	// Release the bitmap if it was created
	ReleaseBitmap ();

	if (lpszResourceName != NULL)
	{
		// Load the bitmap from a resource
		m_bmBitmap = new CBitmap;
		if (!m_bmBitmap->LoadBitmap (lpszResourceName))
			return FALSE;

		// Automatically delete the object
		m_bBitmapCreated = TRUE;
		m_bBitmapExists = TRUE;

		// Make the window transparent if needed
		MakeWindowRgn ();
	}
	else
	{
		// Load the bitmap from a file
		HBITMAP hbm = (HBITMAP) LoadImage (NULL, lpszFilename, IMAGE_BITMAP, 0, 0,
			LR_LOADFROMFILE|LR_CREATEDIBSECTION);
		if (hbm == NULL) return FALSE;

		// Get the CBitmap object
		CopyBitmapFrom (CBitmap::FromHandle(hbm));
		//m_bmBitmap = CBitmap::FromHandle (hbm);
	}

	return TRUE;
}

BOOL CBitmapDialog :: LoadBitmap (UINT nIDResource)
{
	// Release the bitmap if it was created
	ReleaseBitmap ();
	
	// Load the bitmap
	m_bmBitmap = new CBitmap;
	if (!m_bmBitmap->LoadBitmap (nIDResource))
		return FALSE;

	// Automatically delete the object
	m_bBitmapCreated = TRUE;
	m_bBitmapExists = TRUE;

	// Make the window transparent if needed
	MakeWindowRgn ();

	return TRUE;
}

//----------------------------------------------------------------
// CBitmapDialog :: CopyBitmapFrom - sets the bitmap to a copy
//  of a CBitmap.
//
// Parameters:
//  pBitmap - a pointer to the bitmap to make a copy of and use.

BOOL CBitmapDialog :: CopyBitmapFrom (CBitmap *pBitmap)
{
	// Release the bitmap if it was created
	ReleaseBitmap ();

	// Get the bitmap information
	BITMAP bmSrc;
	pBitmap->GetBitmap (&bmSrc);

	// Get a DC to the source bitmap
	CDC dcSrc;
	dcSrc.CreateCompatibleDC (NULL);
	CBitmap *bmSrcOld = dcSrc.SelectObject (pBitmap);

	// Create a new bitmap
	m_bmBitmap = new CBitmap;
	if (!m_bmBitmap->CreateCompatibleBitmap (&dcSrc, bmSrc.bmWidth, bmSrc.bmHeight))
		return FALSE;

	// Get a DC to the destination bitmap
	CDC dcDst;
	dcDst.CreateCompatibleDC (NULL);
	CBitmap *bmDstOld = dcDst.SelectObject (m_bmBitmap);

	// Copy the bitmap
	dcDst.BitBlt (0, 0, bmSrc.bmWidth, bmSrc.bmHeight, &dcSrc, 0, 0, SRCCOPY);

	// Release
	dcSrc.SelectObject (bmSrcOld);
	dcDst.SelectObject (bmDstOld);
	dcSrc.DeleteDC ();
	dcDst.DeleteDC ();

	// Automatically delete the object
	m_bBitmapCreated = TRUE;
	m_bBitmapExists = TRUE;

	// Make the window transparent if needed
	MakeWindowRgn ();

	return TRUE;
}

//----------------------------------------------------------------
// CBitmapDialog :: SetBitmap - sets the bitmap
//
// Parameters:
//  pBitmap - a pointer to the bitmap to use.
//
// NOTE: This function does not copy the bitmap.  You are responsible
//  for handling the bitmap.  Use CopyBitmapFrom() to copy a bitmap.

void CBitmapDialog :: SetBitmap (CBitmap *pBitmap)
{
	// Release the bitmap if it was created
	ReleaseBitmap ();

	// Set the bitmap
	m_bmBitmap = pBitmap;

	// The bitmap exists, but was not created
	m_bBitmapExists = TRUE;

	// Make the window transparent if needed
	MakeWindowRgn ();
}

//----------------------------------------------------------------
// CBitmapDialog :: ReleaseBitmap - releases a bitmap if it was
//  created using LoadBitmap or CopyBitmapFrom.

void CBitmapDialog :: ReleaseBitmap ()
{
	// Make sure that the bitmap was created using LoadBitmap or CopyBitmapFrom
	if (m_bBitmapCreated)
	{
		// Delete the bitmap
		m_bmBitmap->DeleteObject ();
		delete m_bmBitmap;

		// The bitmap has not been created yet
		m_bBitmapCreated = FALSE;
	}

	m_bBitmapExists = FALSE;
}

//----------------------------------------------------------------
// CBitmapDialog :: SetTransparent - sets the dialog's transparent
//  state.

void CBitmapDialog :: SetTransparent (BOOL bTransparent)
{
	m_bTransparent = bTransparent;
	MakeWindowRgn ();
}

void CBitmapDialog :: SetTransColor (COLORREF col)
{
	m_colTrans = col;
	MakeWindowRgn ();
}

//----------------------------------------------------------------
// CBitmapDialog :: MakeWindowRgn - makes a window region from
//  the bitmap and uses it if on transparent mode.

void CBitmapDialog :: MakeWindowRgn ()
{
	if (!m_bTransparent)
	{
		// Set the window region to the full window
		CRect rc;
		GetWindowRect (rc);
		CRgn rgn;
		rgn.CreateRectRgn (0, 0, rc.Width(), rc.Height());
		SetWindowRgn (rgn, TRUE);
	}
	else
	{
		// Set the region to the window rect minus the client rect
		CRect rcWnd;
		GetWindowRect (rcWnd);

		CRgn rgn;
		rgn.CreateRectRgn (rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom);

		CRect rcClient;
		GetClientRect (rcClient);
		ClientToScreen (rcClient);

		CRgn rgnClient;
		rgnClient.CreateRectRgn (rcClient.left, rcClient.top, rcClient.right,
			rcClient.bottom);

		// Subtract rgnClient from rgn
		rgn.CombineRgn (&rgn, &rgnClient, RGN_XOR);

		// Get a DC for the bitmap
		CDC dcImage;
		dcImage.CreateCompatibleDC (NULL);
		CBitmap *pOldBitmap = dcImage.SelectObject (m_bmBitmap);

		// Get the bitmap for width and height information
		BITMAP bm;
		m_bmBitmap->GetBitmap (&bm);

		// Get window width and height
		CRect rc;
		GetClientRect (rc);

		// Use the minimum width and height
		int width = min (bm.bmWidth, rc.Width());
		int height = min (bm.bmHeight, rc.Height());

		// Use RLE (run-length) style because it goes faster.
		// Row start is where the first opaque pixel is found.  Once
		// a transparent pixel is found, a line region is created.
		// Then row_start becomes the next opaque pixel.
		int row_start;

		// Go through all rows
		for (int y=0; y<height; y++)
		{
			// Start looking at the beginning
			row_start = 0;

			// Go through all columns
			for (int x=0; x<width; x++)
			{
				// If this pixel is transparent
				if (dcImage.GetPixel(x, y) == m_colTrans)
				{
					// If we haven't found an opaque pixel yet, keep searching
					if (row_start == x) row_start ++;
					else
					{
						// We have found the start (row_start) and end (x) of
						// an opaque line.  Add it to the region.
						CRgn rgnAdd;
						rgnAdd.CreateRectRgn (rcClient.left+row_start,
							rcClient.top+y, rcClient.left+x, rcClient.top+y+1);
						rgn.CombineRgn (&rgn, &rgnAdd, RGN_OR);
						row_start = x+1;
					}
				}
			}

			// If the last pixel is still opaque, make a region.
			if (row_start != x)
			{
				CRgn rgnAdd;
				rgnAdd.CreateRectRgn (rcClient.left+row_start, rcClient.top+y,
					rcClient.left+x, rcClient.top+y+1);
				rgn.CombineRgn (&rgn, &rgnAdd, RGN_OR);
			}
		}
		
		SetWindowRgn (rgn, TRUE);
	}
}

BEGIN_MESSAGE_MAP(CBitmapDialog, CDialog)
	//{{AFX_MSG_MAP(CBitmapDialog)
	ON_WM_ERASEBKGND()
	ON_WM_LBUTTONDOWN()
	ON_WM_CTLCOLOR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CBitmapDialog message handlers

//----------------------------------------------------------------
// CBitmapDialog :: OnEraseBkgnd - normally erases the background.
//  We override this function to replace it with window drawing
//  code.

BOOL CBitmapDialog :: OnEraseBkgnd (CDC *pDC)
{
	// If no bitmap is loaded, behave like a normal dialog box
	if (!m_bBitmapExists)
		return CDialog :: OnEraseBkgnd (pDC);

	// Get the client rectangle of the window
	CRect rc;
	GetClientRect (rc);

	// Get a DC for the bitmap
	CDC dcImage;
	dcImage.CreateCompatibleDC (pDC);
	CBitmap *pOldBitmap = dcImage.SelectObject (m_bmBitmap);

	// Get bitmap width and height
	BITMAP bm;
	m_bmBitmap->GetBitmap (&bm);

	// Use the minimum width and height
	int width = min (bm.bmWidth, rc.Width());
	int height = min (bm.bmHeight, rc.Height());

	// Draw the bitmap as the window background
	pDC->BitBlt (0, 0, rc.Width(), rc.Height(), &dcImage, 0, 0, SRCCOPY);

	// Release
	dcImage.SelectObject (pOldBitmap);
	dcImage.DeleteDC ();

	// Return value: Nonzero if it erases the background.
	return TRUE;
}

//----------------------------------------------------------------
// CBitmapDialog :: OnLButtonDown - left mouse button is clicked
//  on the window

void CBitmapDialog::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	
	CDialog::OnLButtonDown(nFlags, point);

	// Fool windows into thinking that we clicked on the caption
	if (m_bClickAnywhereMove)
		PostMessage (WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x,point.y));
}

//----------------------------------------------------------------
// CBitmapDialog :: OnCtlColor - set the colors for controls

HBRUSH CBitmapDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	
	// TODO: Change any attributes of the DC here

	// Make static controls transparent
	if (m_bStaticTransparent && nCtlColor == CTLCOLOR_STATIC)
	{
		// Make sure that it's not a slider control
		char lpszClassName[256];
		GetClassName (pWnd->m_hWnd, lpszClassName, 255);
		if (strcmp (lpszClassName, TRACKBAR_CLASS) == 0)
			return CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

		pDC->SetBkMode (TRANSPARENT);
		return m_brushHollow;
	}
	
	// TODO: Return a different brush if the default is not desired
	return hbr;
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色老汉av一区二区三区| 久久久综合视频| 91久久一区二区| 色综合中文字幕| 99久久免费视频.com| 国产1区2区3区精品美女| 韩国成人精品a∨在线观看| 美女mm1313爽爽久久久蜜臀| 免费在线视频一区| 奇米888四色在线精品| 青青草97国产精品免费观看无弹窗版| 丝袜美腿亚洲一区| 免费人成在线不卡| 捆绑调教一区二区三区| 韩国成人精品a∨在线观看| 国产精品一品二品| 高清久久久久久| 色综合激情久久| 欧美日韩精品三区| 91精品国产综合久久久久久久| 91.com在线观看| 欧美xxxxxxxx| 国产免费久久精品| 最新国产成人在线观看| 一区二区三区在线播| 亚洲午夜国产一区99re久久| 免费在线一区观看| 国产精品99久久久久久有的能看| 福利一区二区在线观看| 成人激情图片网| 欧美在线观看视频在线| 欧美一级片在线| 国产日韩精品一区| 亚洲欧美日韩久久| 午夜视频在线观看一区二区| 黄色日韩三级电影| av中文字幕在线不卡| 欧美日韩一级黄| 国产无一区二区| 一级特黄大欧美久久久| 久久99精品国产.久久久久| 成人av资源站| 欧美日韩综合一区| 久久久久久久久久久久久女国产乱| 国产精品高潮呻吟| 午夜精品爽啪视频| 国产成人午夜精品5599| 91精彩视频在线| 欧美不卡在线视频| 亚洲色图在线播放| 青娱乐精品视频| 成人av免费在线| 欧美精品欧美精品系列| 中文字幕精品综合| 日日骚欧美日韩| 懂色av一区二区在线播放| 欧美在线短视频| 国产亚洲一二三区| 日日夜夜一区二区| 99re热视频精品| 日韩视频一区二区三区| 亚洲精品国产一区二区精华液 | 国产一区二区三区在线观看免费 | 91女神在线视频| 91精品国产免费久久综合| 国产精品久久久久久久久久久免费看 | 欧美中文字幕久久| 久久久久久久久久久久久女国产乱 | 欧美成va人片在线观看| 一区二区三区欧美亚洲| 国产精品夜夜嗨| 在线成人av影院| 伊人色综合久久天天人手人婷| 国产伦精品一区二区三区免费| 欧美视频精品在线观看| 成人欧美一区二区三区在线播放| 久久99热国产| 在线不卡的av| 一区二区三区中文字幕精品精品 | 一区二区成人在线视频 | 91精品国产欧美一区二区成人| 亚洲欧美色图小说| 国产成人啪免费观看软件| 欧美成人国产一区二区| 日韩激情视频网站| 欧美综合亚洲图片综合区| 中文字幕不卡在线播放| 激情综合色综合久久| 4438成人网| 亚洲va中文字幕| 色欧美日韩亚洲| 亚洲女同一区二区| 波多野结衣91| 国产精品人人做人人爽人人添| 国产在线精品视频| 精品1区2区在线观看| 日本欧美在线看| 精品视频免费在线| 亚洲综合视频网| 日本韩国一区二区三区| 中文字幕亚洲综合久久菠萝蜜| 国产成人免费视频精品含羞草妖精 | 成人免费视频caoporn| 久久久久免费观看| 国产呦萝稀缺另类资源| 精品久久久久久久久久久久包黑料 | 国产不卡在线视频| 国产人伦精品一区二区| 国产成人免费视频网站| 中文一区在线播放| 成人精品一区二区三区中文字幕| 亚洲国产精品二十页| 豆国产96在线|亚洲| 国产精品久久三区| 99re热这里只有精品免费视频| 日韩一区在线播放| 在线精品视频小说1| 亚洲国产精品久久久久秋霞影院| 在线欧美日韩精品| 午夜欧美电影在线观看| 欧美男人的天堂一二区| 日韩av中文在线观看| 精品美女在线观看| 国产成人精品影院| 亚洲欧美一区二区视频| 欧美亚洲图片小说| 日韩av在线播放中文字幕| 欧美一区二区福利在线| 精品一区二区三区av| 欧美激情中文字幕一区二区| 99麻豆久久久国产精品免费| 亚洲乱码精品一二三四区日韩在线| 91福利小视频| 美腿丝袜亚洲色图| 国产婷婷一区二区| 99国产一区二区三精品乱码| 亚洲宅男天堂在线观看无病毒| 91麻豆精品国产91久久久资源速度| 美日韩一级片在线观看| 日本一区二区综合亚洲| 91视频.com| 免费日韩伦理电影| 国产精品日韩精品欧美在线| 欧美专区日韩专区| 久久99精品久久久| 亚洲色图另类专区| 91精品婷婷国产综合久久| 国产一区二区免费在线| 亚洲精品乱码久久久久久久久| 91精品国产乱码| 成人黄色a**站在线观看| 亚洲一区二区精品视频| 欧美大尺度电影在线| 国产xxx精品视频大全| 亚洲自拍偷拍欧美| 久久新电视剧免费观看| av电影天堂一区二区在线| 日韩国产一二三区| 中文字幕成人网| 欧美一区二区三级| 91视频免费播放| 久久精品久久久精品美女| 亚洲女人的天堂| 精品国产乱码久久久久久蜜臀| 91蜜桃网址入口| 韩国视频一区二区| 亚洲一区二区欧美激情| 欧美—级在线免费片| 欧美一区二区三区四区五区| av电影一区二区| 国内精品写真在线观看| 亚洲大片在线观看| 日韩一区中文字幕| 久久嫩草精品久久久精品一| 精品视频在线免费观看| 99在线热播精品免费| 精品夜夜嗨av一区二区三区| 亚洲国产视频一区| 中文字幕一区二区三区蜜月 | 国产日韩在线不卡| 欧美日韩国产一级| 91免费视频大全| 国产麻豆精品一区二区| 免费一级片91| 五月天网站亚洲| 亚洲一区在线播放| 国产精品国模大尺度视频| 精品国偷自产国产一区| 欧美精品久久天天躁| 一本大道av伊人久久综合| 国产91在线看| 极品尤物av久久免费看| 麻豆精品视频在线观看免费| 偷窥国产亚洲免费视频 | 日本高清无吗v一区| 成人午夜免费视频| 国产精品一区在线观看乱码| 毛片av中文字幕一区二区| 午夜av区久久| 日日夜夜精品视频免费|