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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? btnst.cpp

?? 一個功能挺多的
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
//
//Modify by 徐景周 2000.10
//功能:平面按鈕顯示及鼠標捕捉不到按鈕郊果

#include "stdafx.h"
#include "BtnST.h"

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

/////////////////////////////////////////////////////////////////////////////
// CButtonST

CButtonST::CButtonST()
{
    m_nJumpDistance = 10; //按鈕不讓鼠標碰到的自移動距離

	m_MouseOnButton = FALSE;

	m_hIconIn = NULL;
	m_hIconOut = NULL;
	m_cxIcon = 0;
	m_cyIcon = 0;
	m_hCursor = NULL;
  
	m_bTrickButton=false; //按鈕自移動默認值為假

	// Default type is "flat" button
	m_bIsFlat = TRUE; 
  
	// By default draw border in "flat" button 
	m_bDrawBorder = TRUE; 
  
	// By default icon is aligned horizontally
	m_nAlign = ST_ALIGN_HORIZ; 
  
	// By default show the text button
	m_bShowText = TRUE; 
  
	// By default, for "flat" button, don't draw the focus rect
	m_bDrawFlatFocus = FALSE;

	// By default the button is not the default button
	m_bIsDefault = FALSE;

	SetDefaultInactiveBgColor();
	SetDefaultInactiveFgColor();
	SetDefaultActiveBgColor();
	SetDefaultActiveFgColor();

	// No tooltip created
	m_ToolTip.m_hWnd = NULL;

	// Do not draw as a transparent button
	m_bDrawTransparent = FALSE;
	m_pbmpOldBk = NULL;
} // End of CButtonST


CButtonST::~CButtonST()
{
	// Restore old bitmap (if any)
	if (m_dcBk.m_hDC != NULL && m_pbmpOldBk != NULL)
	{
		m_dcBk.SelectObject(m_pbmpOldBk);
	}

	// Destroy the icons (if any)
	// Note: the following two lines MUST be here! even if
	// BoundChecker says they are unnecessary!
	if (m_hIconIn != NULL) ::DestroyIcon(m_hIconIn);
	if (m_hIconOut != NULL) ::DestroyIcon(m_hIconOut);
	// Destroy the cursor (if any)
	if (m_hCursor != NULL) ::DestroyCursor(m_hCursor);
} // End of ~CButtonST


BEGIN_MESSAGE_MAP(CButtonST, CButton)
    //{{AFX_MSG_MAP(CButtonST)
	ON_WM_CAPTURECHANGED()
	ON_WM_SETCURSOR()
	ON_WM_KILLFOCUS()
	ON_WM_MOUSEMOVE()
	ON_WM_CTLCOLOR_REFLECT()
	ON_WM_SYSCOLORCHANGE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


void CButtonST::SetIcon(int nIconInId, int nIconOutId)
{
	HICON hIconIn;
	HICON hIconOut;
	HINSTANCE hInstResource = AfxFindResourceHandle(MAKEINTRESOURCE(nIconInId), RT_GROUP_ICON);

	// Set icon when the mouse is IN the button
	hIconIn = (HICON)::LoadImage(hInstResource/*AfxGetApp()->m_hInstance*/, MAKEINTRESOURCE(nIconInId), IMAGE_ICON, 0, 0, 0);
  	// Set icon when the mouse is OUT the button
	hIconOut = (nIconOutId == NULL) ? NULL : (HICON)::LoadImage(hInstResource/*AfxGetApp()->m_hInstance*/, MAKEINTRESOURCE(nIconOutId), IMAGE_ICON, 0, 0, 0);

	SetIcon(hIconIn, hIconOut);
/*
	// Note: the following two lines MUST be here! even if
	// BoundChecker says they are unnecessary!
	if (m_hIconIn != NULL) ::DestroyIcon(m_hIconIn);
	if (m_hIconOut != NULL) ::DestroyIcon(m_hIconOut);

	// Set icon when the mouse is IN the button
	m_hIconIn = (HICON)::LoadImage(hInstResource, MAKEINTRESOURCE(nIconInId), IMAGE_ICON, 0, 0, 0);
  	// Set icon when the mouse is OUT the button
	m_hIconOut = (nIconOutId == NULL) ? m_hIconIn : (HICON)::LoadImage(hInstResource, MAKEINTRESOURCE(nIconOutId), IMAGE_ICON, 0, 0, 0);
  
	ICONINFO ii;

	// Get icon dimension
	ZeroMemory(&ii, sizeof(ICONINFO));
	::GetIconInfo(m_hIconIn, &ii);

	m_cxIcon = (BYTE)(ii.xHotspot * 2);
	m_cyIcon = (BYTE)(ii.yHotspot * 2);
    ::DeleteObject(ii.hbmMask);
	::DeleteObject(ii.hbmColor);

	RedrawWindow();
*/
} // End of SetIcon

void CButtonST::SetIcon(HICON hIconIn, HICON hIconOut)
{
	// Note: the following two lines MUST be here! even if
	// BoundChecker says they are unnecessary!
	if (m_hIconIn != NULL) ::DestroyIcon(m_hIconIn);
	if (m_hIconOut != NULL) ::DestroyIcon(m_hIconOut);

	// Set icon when the mouse is IN the button
	m_hIconIn = hIconIn;
	// Set icon when the mouse is OUT the button
	m_hIconOut = (hIconOut == NULL) ? m_hIconIn : hIconOut;
  
	ICONINFO ii;

	// Get icon dimension
	ZeroMemory(&ii, sizeof(ICONINFO));
	::GetIconInfo(m_hIconIn, &ii);

	m_cxIcon = (BYTE)(ii.xHotspot * 2);
	m_cyIcon = (BYTE)(ii.yHotspot * 2);
    ::DeleteObject(ii.hbmMask);
	::DeleteObject(ii.hbmColor);

	RedrawWindow();
} // End of SetIcon

BOOL CButtonST::SetBtnCursor(int nCursorId)
{
	HINSTANCE hInstResource;
	// Destroy any previous cursor
	if (m_hCursor != NULL) ::DestroyCursor(m_hCursor);
	m_hCursor = NULL;

	// If we want a cursor
	if (nCursorId != -1)
	{
		hInstResource = AfxFindResourceHandle(MAKEINTRESOURCE(nCursorId),
											RT_GROUP_CURSOR);
		// Load icon resource
		m_hCursor = (HCURSOR)::LoadImage(hInstResource/*AfxGetApp()->m_hInstance*/, MAKEINTRESOURCE(nCursorId), IMAGE_CURSOR, 0, 0, 0);
		// If something wrong then return FALSE
		if (m_hCursor == NULL) return FALSE;
	}

	return TRUE;
} // End of SetBtnCursor

//在此新增加按鈕自移動設置和判斷涵數
void CButtonST::SetTrickButton(BOOL bTrick)
{
  m_bTrickButton = bTrick;
}

BOOL CButtonST::GetTrickButton()
{
  return m_bTrickButton;
}

void CButtonST::SetFlat(BOOL bState)
{
  m_bIsFlat = bState;
  Invalidate();
} // End of SetFlat


BOOL CButtonST::GetFlat()
{
  return m_bIsFlat;
} // End of GetFlat



void CButtonST::SetAlign(int nAlign)
{
  switch (nAlign)
  {    
    case ST_ALIGN_HORIZ:
         m_nAlign = ST_ALIGN_HORIZ;
         break;
    case ST_ALIGN_HORIZ_RIGHT:
         m_nAlign = ST_ALIGN_HORIZ_RIGHT;
         break;
    case ST_ALIGN_VERT:
         m_nAlign = ST_ALIGN_VERT;
         break;
  }
  Invalidate();
} // End of SetAlign


int CButtonST::GetAlign()
{
  return m_nAlign;
} // End of GetAlign


void CButtonST::DrawBorder(BOOL bEnable)
{
  m_bDrawBorder = bEnable;
} // End of DrawBorder


const char* CButtonST::GetVersionC()
{
  return "2.6";
} // End of GetVersionC


const short CButtonST::GetVersionI()
{
  return 26; // Divide by 10 to get actual version
} // End of GetVersionI


void CButtonST::SetShowText(BOOL bShow)
{
  m_bShowText = bShow;
  Invalidate();
} // End of SetShowText


BOOL CButtonST::GetShowText()
{
  return m_bShowText;
} // End of GetShowText


void CButtonST::OnMouseMove(UINT nFlags, CPoint point)
{
  if(GetTrickButton()) //當按鈕設置為自移動,不讓鼠標碰到時
  {
	//新增功能,加入隨鼠標按鈕不斷移動,不讓鼠標碰上按鈕郊果
	CWnd* pParent = GetParent();
    if (!pParent) pParent = GetDesktopWindow();

    CRect ParentRect;                                   // Parent client area (Parent coords)
    pParent->GetClientRect(ParentRect);

    ClientToScreen(&point);                             // Convert point to parent coords
    pParent->ScreenToClient(&point);

    CRect ButtonRect;                                   // Button Dimensions (Parent coords)
    GetWindowRect(ButtonRect);  
    pParent->ScreenToClient(ButtonRect);
    CPoint Center = ButtonRect.CenterPoint();           // Center of button (parent coords)

    CSize CriticalSize(ButtonRect.Width()/6, ButtonRect.Height()/6);


    CRect NewButtonRect = ButtonRect;                    // New position (parent coords)

    if (point.x - CriticalSize.cx > Center.x)            // Mouse is right of center
    {
        if (ButtonRect.left > ParentRect.left + ButtonRect.Width() + m_nJumpDistance)
            NewButtonRect -= CSize(ButtonRect.right - point.x + m_nJumpDistance, 0);
        else
            NewButtonRect += CSize(point.x - ButtonRect.left + m_nJumpDistance, 0);
    }
    else if (point.x + CriticalSize.cx < Center.x)      // Mouse is left of center
    {
        if (ButtonRect.right < ParentRect.right - ButtonRect.Width() - m_nJumpDistance)
            NewButtonRect += CSize(point.x - ButtonRect.left + m_nJumpDistance, 0);
        else
            NewButtonRect -= CSize(ButtonRect.right - point.x + m_nJumpDistance, 0);
    }

    if (point.y - CriticalSize.cy > Center.y)           // Mouse is below center
    {
        if (ButtonRect.top > ParentRect.top + ButtonRect.Height() + m_nJumpDistance)
            NewButtonRect -= CSize(0, ButtonRect.bottom - point.y + m_nJumpDistance);
        else
            NewButtonRect += CSize(0, point.y - ButtonRect.top + m_nJumpDistance);
    }
    else if (point.y + CriticalSize.cy < Center.y)      // Mouse is above center
    {
        if (ButtonRect.bottom < ParentRect.bottom - ButtonRect.Height() - m_nJumpDistance)
            NewButtonRect += CSize(0, point.y - ButtonRect.top + m_nJumpDistance);
        else
            NewButtonRect -= CSize(0, ButtonRect.bottom - point.y + m_nJumpDistance);
    }

    MoveWindow(NewButtonRect);
    RedrawWindow();
  }

	CButton::OnMouseMove(nFlags, point);

	//原函數功能,捕捉鼠標
    CWnd* pWnd;  // Finestra attiva
	CWnd* pParent; // Finestra che contiene il bottone

	// If the mouse enter the button with the left button pressed
	// then do nothing
	if (nFlags & MK_LBUTTON && m_MouseOnButton == FALSE) return;

	// If our button is not flat then do nothing
	if (m_bIsFlat == FALSE) return;

	pWnd = GetActiveWindow();
	pParent = GetOwner();

	if ((GetCapture() != this) && 
		(
#ifndef ST_LIKEIE
		pWnd != NULL && 
#endif
		pParent != NULL)) 
	{
		m_MouseOnButton = TRUE;
		//SetFocus();	// Thanks Ralph!
		SetCapture();
		Invalidate();
	}
	else
	{
		/*
		CRect rc;
		GetClientRect(&rc);
		if (!rc.PtInRect(point))
		{
		*/

		POINT p2 = point;
		ClientToScreen(&p2);
		CWnd* wndUnderMouse = WindowFromPoint(p2);
//		if (wndUnderMouse != this)
		if (wndUnderMouse && wndUnderMouse->m_hWnd != this->m_hWnd)
		{
			// Redraw only if mouse goes out
			if (m_MouseOnButton == TRUE)
			{
				m_MouseOnButton = FALSE;
				Invalidate();
			}
			// If user is NOT pressing left button then release capture!
			if (!(nFlags & MK_LBUTTON)) ReleaseCapture();
		}
	}
} // End of OnMouseMove


void CButtonST::OnKillFocus(CWnd * pNewWnd)
{
  CButton::OnKillFocus(pNewWnd);

  // If our button is not flat then do nothing
  if (m_bIsFlat == FALSE) return;

  if (m_MouseOnButton == TRUE)
  {
    m_MouseOnButton = FALSE;
    Invalidate();
  }
} // End of OnKillFocus


void CButtonST::OnCaptureChanged(CWnd *pWnd) 
{
	if (m_MouseOnButton == TRUE)
	{
		ReleaseCapture();
		Invalidate();
	}

	// Call base message handler
	CButton::OnCaptureChanged(pWnd);
} // End of OnCaptureChanged


void CButtonST::DrawItem(LPDRAWITEMSTRUCT lpDIS)
{
#ifdef ST_USE_MEMDC
  CDC  *pdrawDC = CDC::FromHandle(lpDIS->hDC);
  CMemDC memDC(pdrawDC);
  CDC  *pDC = &memDC;
#else	
  CDC* pDC = CDC::FromHandle(lpDIS->hDC);
#endif

  CPen *pOldPen;
  BOOL bIsPressed  = (lpDIS->itemState & ODS_SELECTED);
  BOOL bIsFocused  = (lpDIS->itemState & ODS_FOCUS);
  BOOL bIsDisabled = (lpDIS->itemState & ODS_DISABLED);

  CRect itemRect = lpDIS->rcItem;

  pDC->SetBkMode(TRANSPARENT);

  if (m_bIsFlat == FALSE)
  {
    if (bIsFocused || (GetDefault() == TRUE))
    {
      CBrush br(RGB(0,0,0));  
      pDC->FrameRect(&itemRect, &br);
      itemRect.DeflateRect(1, 1);
    }
  }

  // Prepare draw... paint button's area with background color
  COLORREF bgColor;
  if ((m_MouseOnButton == TRUE) || (bIsPressed))
    bgColor = GetActiveBgColor();
  else
    bgColor = GetInactiveBgColor();

	CBrush br(bgColor);
	// Draw transparent?
	if (m_bDrawTransparent == TRUE)
	{
		PaintBk(pDC);
	}
	else
	{
		pDC->FillRect(&itemRect, &br);
	}

	// Disegno lo sfondo del bottone
//CBrush br(GetSysColor(COLOR_BTNFACE));  
//pDC->FillRect(&itemRect, &br);

  // Draw pressed button
  if (bIsPressed)
  {
    if (m_bIsFlat == TRUE)
    {
      if (m_bDrawBorder == TRUE)
      {
		  pDC->Draw3dRect(itemRect, ::GetSysColor(COLOR_BTNSHADOW), ::GetSysColor(COLOR_BTNHILIGHT));
/*
	    CPen penBtnHiLight(PS_SOLID, 0, GetSysColor(COLOR_BTNHILIGHT)); // Bianco
        CPen penBtnShadow(PS_SOLID, 0, GetSysColor(COLOR_BTNSHADOW));   // Grigio scuro

        // Disegno i bordi a sinistra e in alto
        // Dark gray line
        pOldPen = pDC->SelectObject(&penBtnShadow);
        pDC->MoveTo(itemRect.left, itemRect.bottom-1);
        pDC->LineTo(itemRect.left, itemRect.top);
        pDC->LineTo(itemRect.right, itemRect.top);
        // Disegno i bordi a destra e in basso
        // White line
        pDC->SelectObject(penBtnHiLight);
        pDC->MoveTo(itemRect.left, itemRect.bottom-1);
        pDC->LineTo(itemRect.right-1, itemRect.bottom-1);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产一区二区亚洲人成毛片| 亚洲精品乱码久久久久| 亚洲一区二区综合| 99国产精品99久久久久久| 中文av一区特黄| 国产精品一品视频| 久久精品水蜜桃av综合天堂| 国产成人av一区二区| 26uuu色噜噜精品一区| 三级精品在线观看| 欧美人体做爰大胆视频| 婷婷国产v国产偷v亚洲高清| 日韩精品在线一区二区| 激情综合色丁香一区二区| 欧美一级夜夜爽| 粉嫩在线一区二区三区视频| 国产精品美女久久久久久| 成人18视频在线播放| 亚洲手机成人高清视频| 99久精品国产| 亚洲一区欧美一区| 欧美日韩第一区日日骚| 国产一区二区毛片| 国产精品二三区| 欧美一级黄色录像| 国产美女视频91| 亚洲欧美色图小说| 日韩精品一区二区三区三区免费| 国产一区二区三区四区在线观看| 欧美刺激午夜性久久久久久久| 狠狠色2019综合网| 国产精品美女久久福利网站| 色av成人天堂桃色av| 日本亚洲电影天堂| 国产免费观看久久| 欧美日韩电影在线播放| 精品一区二区三区影院在线午夜 | 国产成人精品免费在线| 国产精品狼人久久影院观看方式| 欧美性大战久久| 激情欧美一区二区| 国产精品福利一区| 91精品国产aⅴ一区二区| 成人高清视频在线| 日韩成人免费看| 亚洲欧美另类久久久精品| 欧美一区二区视频在线观看2020 | 色8久久精品久久久久久蜜| 久久成人免费网站| 亚洲美腿欧美偷拍| 久久精品一区二区三区不卡 | 亚洲国产一区二区在线播放| 欧美sm美女调教| 99久久婷婷国产综合精品| 亚洲综合色婷婷| 久久久噜噜噜久噜久久综合| 色偷偷久久人人79超碰人人澡| 久久99热这里只有精品| 亚洲蜜臀av乱码久久精品蜜桃| 欧美tickling网站挠脚心| 欧美久久婷婷综合色| 成人av影视在线观看| 一区二区三区免费看视频| 久久综合久久综合久久| 欧美亚洲免费在线一区| 91久久精品国产91性色tv| 国产成人亚洲综合a∨婷婷| 91福利社在线观看| 99天天综合性| 精品中文字幕一区二区小辣椒| 一本久道久久综合中文字幕| 亚洲国产成人一区二区三区| 国产福利不卡视频| 欧美精品久久久久久久多人混战| 免费不卡在线视频| 欧美三级在线播放| 亚洲成人www| 中文字幕欧美激情| 日韩国产高清影视| 欧美日韩不卡在线| 成人国产电影网| 国产黄人亚洲片| 亚洲免费av在线| www.视频一区| 国产成人综合在线| 亚洲一二三四区不卡| 久久午夜国产精品| 久久精品国产99国产| 91麻豆精品在线观看| 亚洲成人自拍偷拍| 国产亚洲污的网站| 欧美日韩一区二区三区视频| 丁香啪啪综合成人亚洲小说| 国产一区在线看| 国产一区二区精品久久91| 韩国女主播成人在线观看| 韩国v欧美v日本v亚洲v| 麻豆91精品视频| 国内精品伊人久久久久av影院| 免费在线观看视频一区| 韩国av一区二区三区四区 | 亚洲欧洲av在线| 国产欧美精品一区二区三区四区| 欧美日韩国产综合草草| caoporen国产精品视频| 成人少妇影院yyyy| 欧洲人成人精品| 欧美久久婷婷综合色| 日韩午夜电影在线观看| 国产精品婷婷午夜在线观看| 亚洲午夜羞羞片| av网站免费线看精品| 欧洲精品在线观看| 欧美美女一区二区在线观看| 日韩精品成人一区二区在线| 久久国产精品区| 99久久精品免费看| 日韩一区二区精品在线观看| 国产精品久久久久久久久晋中 | 99在线视频精品| 色婷婷久久99综合精品jk白丝| 日韩av在线免费观看不卡| 国产白丝精品91爽爽久久| 欧美精品一级二级| 亚洲欧美日韩一区二区| 秋霞av亚洲一区二区三| 91欧美一区二区| 久久久国产午夜精品| 视频精品一区二区| 一本大道综合伊人精品热热| 久久香蕉国产线看观看99| 亚洲国产va精品久久久不卡综合| 亚洲精品福利视频网站| 亚洲最大成人综合| 国产91精品露脸国语对白| 国产原创一区二区| 91久久久免费一区二区| 亚洲精品乱码久久久久久日本蜜臀| 成人丝袜高跟foot| 亚洲欧美日韩人成在线播放| 色综合久久综合| 亚洲精品综合在线| 欧美丰满美乳xxx高潮www| 亚洲福利视频一区二区| 亚洲一区二区三区激情| 91免费在线播放| 亚洲一级不卡视频| 欧美一区中文字幕| 加勒比av一区二区| 国产亚洲一二三区| 99综合电影在线视频| 亚洲永久免费视频| 26uuu精品一区二区在线观看| 成人开心网精品视频| 天天操天天色综合| 国产欧美日韩在线视频| 九色porny丨国产精品| 日韩精品最新网址| heyzo一本久久综合| 丝袜美腿亚洲色图| 国产精品―色哟哟| 欧美日韩亚洲另类| 成人黄色国产精品网站大全在线免费观看 | 国产suv精品一区二区三区| 久久精品一级爱片| 不卡av在线免费观看| 亚洲一区二区成人在线观看| 国产午夜精品一区二区三区嫩草| 日韩一二三区视频| 26uuu欧美日本| 中文字幕av不卡| 亚洲男同性视频| 日韩精品一级二级| 免费精品视频最新在线| 美日韩黄色大片| 视频在线观看91| 91精品国产色综合久久久蜜香臀| 欧美性色黄大片| 26uuu久久综合| 一区二区三区四区视频精品免费| 国产精品国产三级国产普通话蜜臀 | 欧美a一区二区| 日韩美女久久久| 欧美一级二级在线观看| 在线不卡中文字幕| 久久五月婷婷丁香社区| 亚洲女女做受ⅹxx高潮| 日韩av电影天堂| 白白色 亚洲乱淫| 欧美男生操女生| 国产日本欧美一区二区| 一个色在线综合| 极品少妇xxxx偷拍精品少妇| a级高清视频欧美日韩| 欧洲亚洲精品在线| 欧美韩国一区二区| 日本不卡高清视频| 欧美在线视频全部完| 精品国产百合女同互慰| 亚洲国产一区二区三区|