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

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

?? dragsizerbmp.cpp

?? 一個(gè)modbus的編程庫
?? CPP
字號:
/*****************************************************************************
 *
 *  Filename : DRAGSIZERBMP.CPP
 *
 *****************************************************************************
 *
 *  Copyright : (c) Adroit Technologies (Pty) Ltd 1992, 2000
 *
 *****************************************************************************
 *
 *  Description : This is the implementation for CDragSizerBmp class .
 *
 * USE: to use this class, subclass a static control, and then provide a 
 * resourse id via the SetBitmapID() function. By default the drag is NW-SE
 * (bottom right) to change this specify....
 *****************************************************************************/


#include "stdafx.h"

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

// Colors
#define rgbWhite RGB(255,255,255)
// Raster op codes
#define DSa     0x008800C6L
#define DSx     0x00660046L

/////////////////////////////////////////////////////////////////////////////
// CDragSizerBmp

CDragSizerBmp::CDragSizerBmp()
{
   m_iWidth = 0;
   m_iHeight = 0;
   m_hbmMask = NULL;
   m_buttonDown = FALSE;
}

CDragSizerBmp::~CDragSizerBmp()
{

}

// --------------------------------------- PreSubclassWindow -------------------
void CDragSizerBmp::PreSubclassWindow()
{
LONG style;

   style = GetWindowLong(this->GetSafeHwnd(), GWL_STYLE);
   ASSERT( style & SS_NOTIFY);  // If your debugger stops here, 
   // turn on the "Notify" window property for the static control.
}


// -------------------------------- SetBitmapID ---------------------------------
// set resource Id (int this module) to the bitmap to paint.
// the bitmap uses a transparent background.
BOOL CDragSizerBmp::SetBitmapID(int resourceId)
{
   return(m_bitMap.LoadBitmap(resourceId));
}

// ---------------------------------- SetCornerType ----------------------------
// Specify the mouse cursor and the bitmap resource ID to load.
// If "shiftControl" is true, the control is moved to the relevant corner if not 
// already there. The gap is calculated using GetSystemMetrics(SM_CXSIZEFRAME),
// and the bitmap size, not the control size, which may be changed
//
BOOL CDragSizerBmp::SetCornerType(_CursorCornerType corner, 
                                  int resourceId,
                                  BOOL shiftControl)
{
BOOL ret;
int frameWidth;

   m_cornerType = corner;
   ret = SetBitmapID(resourceId);
   if (shiftControl)
   {
   CRect dRect, parentRect;
   CWnd *pParent = GetParent();
      // move the control towards the desired corner

      // To get rid of an annoying 1-pixel gap, between the edge of this control and the dialog frame.
      // for some reason, the dialog editor may not be positioning the control right up to the edge
      GetWindowRect(&dRect);
      ScreenToClient(&dRect);

      pParent->GetWindowRect(&parentRect);
      pParent->ScreenToClient(&parentRect);

      frameWidth = GetSystemMetrics(SM_CXSIZEFRAME);  // use the same value for x and y
      switch (m_cornerType)
      {
      case CORNER_BOTTOMRIGHT :
         dRect.right = parentRect.right - frameWidth;
         dRect.bottom = parentRect.bottom - frameWidth;
         dRect.left = dRect.right - GetWidth();
         dRect.top = dRect.bottom - GetHeight();
         break;
      case CORNER_BOTTOMLEFT :
         dRect.left = 0;
         dRect.bottom = parentRect.bottom - frameWidth;
         dRect.right = dRect.left + GetWidth();
         dRect.top = dRect.bottom - GetHeight();
         break;
      case CORNER_TOPRIGHT :
         dRect.right = parentRect.right - frameWidth;
         dRect.top = 0;
         dRect.left = dRect.right - GetWidth();
         dRect.bottom = dRect.top + GetHeight();
         break;
      case CORNER_TOPLEFT :
         dRect.left = 0;
         dRect.top = 0;
         dRect.right = dRect.left + GetWidth();
         dRect.bottom = dRect.bottom + GetHeight();
         break;
      }
      MoveWindow(&dRect, TRUE);

   }
   return(ret);
}


IMPLEMENT_DYNAMIC(CDragSizerBmp, CWnd)

BEGIN_MESSAGE_MAP(CDragSizerBmp, CWnd)
	//{{AFX_MSG_MAP(CDragSizerBmp)
	ON_WM_PAINT()
	ON_WM_ERASEBKGND()
	ON_WM_SETCURSOR()
	ON_WM_LBUTTONDOWN()
	ON_WM_LBUTTONUP()
	ON_WM_MOUSEMOVE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CDragSizerBmp message handlers

void CDragSizerBmp::GetMetrics()
{
    // Get the width and height
    BITMAP bm;
    m_bitMap.GetObject(sizeof(bm), &bm);
    m_iWidth = bm.bmWidth;
    m_iHeight = bm.bmHeight;
}


int CDragSizerBmp::GetWidth()
{
    if ((m_iWidth == 0) || (m_iHeight == 0)){
        GetMetrics();
    }
    return m_iWidth;
}

int CDragSizerBmp::GetHeight()
{
    if ((m_iWidth == 0) || (m_iHeight == 0)){
        GetMetrics();
    }
    return m_iHeight;
}

// ----------------------------------- DrawTrans ---------------------------------
void CDragSizerBmp::DrawTrans(HDC hDC, int x, int y)
{
    ASSERT(hDC);
    if (!m_hbmMask) 
       CreateMask(hDC);

    ASSERT(m_hbmMask);
    int dx = GetWidth();
    int dy = GetHeight();

    // Create a memory DC to do the drawing to
    HDC hdcOffScr = ::CreateCompatibleDC(hDC);
    // Create a bitmap for the off-screen DC that is really
    // color compatible with the destination DC.
    HBITMAP hbmOffScr = ::CreateBitmap(dx, dy, 
                             (BYTE)GetDeviceCaps(hDC, PLANES),
                             (BYTE)GetDeviceCaps(hDC, BITSPIXEL),
                             NULL);
    // Select the buffer bitmap into the off-screen DC
    HBITMAP hbmOldOffScr = (HBITMAP)::SelectObject(hdcOffScr, hbmOffScr);

    // Copy the image of the destination rectangle to the
    // off-screen buffer DC so we can play with it
    ::BitBlt(hdcOffScr, 0, 0, dx, dy, hDC, x, y, SRCCOPY);

    // Create a memory DC for the source image
    HDC hdcImage = ::CreateCompatibleDC(hDC); 
    HBITMAP hbmOldImage = (HBITMAP)::SelectObject(hdcImage, m_bitMap.m_hObject);

    // Create a memory DC for the mask
    HDC hdcMask = ::CreateCompatibleDC(hDC);
    HBITMAP hbmOldMask = (HBITMAP)::SelectObject(hdcMask, m_hbmMask);

    // XOR the image with the destination
    ::SetBkColor(hdcOffScr,rgbWhite);
    ::BitBlt(hdcOffScr, 0, 0, dx, dy ,hdcImage, 0, 0, DSx);
    // AND the destination with the mask
    ::BitBlt(hdcOffScr, 0, 0, dx, dy, hdcMask, 0,0, DSa);
    // XOR the destination with the image again
    ::BitBlt(hdcOffScr, 0, 0, dx, dy, hdcImage, 0, 0, DSx);

    // Copy the resultant image back to the screen DC
    ::BitBlt(hDC, x, y, dx, dy, hdcOffScr, 0, 0, SRCCOPY);

    // Tidy up
    ::SelectObject(hdcOffScr, hbmOldOffScr);
    ::SelectObject(hdcImage, hbmOldImage);
    ::SelectObject(hdcMask, hbmOldMask);
    ::DeleteObject(hbmOffScr);
    ::DeleteDC(hdcOffScr);
    ::DeleteDC(hdcImage);
    ::DeleteDC(hdcMask);
}

// ---------------------------------- DrawTrans ------------------------------
// Draw transparent bitmap, using a CDC
void CDragSizerBmp::DrawTrans(CDC* pDC, int x, int y)
{
    ASSERT(pDC);
    HDC hDC = pDC->GetSafeHdc();
    DrawTrans(hDC, x, y);
}


// ------------------------------------- CreateMask -----------------------------
void CDragSizerBmp::CreateMask(HDC hDC)
{
    // Nuke any existing mask
    if (m_hbmMask) {
        ::DeleteObject(m_hbmMask);
    }
    // Create memory DCs to work with
    HDC hdcMask = ::CreateCompatibleDC(hDC);
    HDC hdcImage = ::CreateCompatibleDC(hDC);
    // Create a monochrome bitmap for the mask
    m_hbmMask = ::CreateBitmap(GetWidth(),
                               GetHeight(),
                               1,
                               1,
                               NULL);
    // Select the mono bitmap into its DC
    HBITMAP hbmOldMask = (HBITMAP)::SelectObject(hdcMask, m_hbmMask);
    // Select the image bitmap into its DC
    HBITMAP hbmOldImage = (HBITMAP)::SelectObject(hdcImage, m_bitMap.m_hObject);
    // Set the transparency color to be the top-left pixel
    ::SetBkColor(hdcImage, ::GetPixel(hdcImage, 0, 0));
    // Make the mask
    ::BitBlt(hdcMask,
             0, 0,
             GetWidth(), GetHeight(),
             hdcImage,
             0, 0,
             SRCCOPY);
    // Tidy up
    ::SelectObject(hdcMask, hbmOldMask);
    ::SelectObject(hdcImage, hbmOldImage);
    ::DeleteDC(hdcMask);
    ::DeleteDC(hdcImage);
}


void CDragSizerBmp::OnPaint() 
{

   if (m_bitMap.GetSafeHandle())
   {
	   CPaintDC dc(this); // device context for painting
      // draw a transparent bitmap
      DrawTrans(&dc, 0,0);
   }
	// Do not call CWnd::OnPaint() for painting messages
}

BOOL CDragSizerBmp::OnEraseBkgnd(CDC* pDC) 
{
	// DO nothing
	
	return 1;//CWnd::OnEraseBkgnd(pDC);
}

// ------------------------------ OnSetCursor -----------------------------
// called by the framework, the control must have the NOTIFY style
BOOL CDragSizerBmp::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
{
	// TODO: Add your message handler code here and/or call default
	
	//return CWnd::OnSetCursor(pWnd, nHitTest, message);
   HCURSOR hCursor = ::LoadCursor(NULL, IDC_SIZENWSE);
   ASSERT(hCursor);
   ::SetCursor(hCursor);
   return TRUE;

}

// ------------------------------- OnLButtonDown ---------------------------
// start capture of the mouse
void CDragSizerBmp::OnLButtonDown(UINT nFlags, CPoint point) 
{
   m_buttonDown = TRUE;
   m_downPosition = point; // remember this point, it is used as the drag 
   // starting-reference point
   ::SetCapture(m_hWnd);
   //OutputDebugString("Mouse down\n");
	CWnd::OnLButtonDown(nFlags, point);
}

// -------------------------------- OnLButtonUp -----------------------------
// releases the mouse, and stops dragging
void CDragSizerBmp::OnLButtonUp(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
   m_buttonDown = FALSE;
	ReleaseCapture();
   //OutputDebugString("Mouse up\n");
	CWnd::OnLButtonUp(nFlags, point);
}

// -------------------------------- OnMouseMove ----------------------------
// uses mouse drag to size (sends WM_SIZE) the window, if we have capture!
void CDragSizerBmp::OnMouseMove(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
   if (m_buttonDown)
   {
      if (MK_LBUTTON && nFlags)
      {
      CRect parentRect;
      CWnd *pParent = GetParent();
      LONG x,y;

         //OutputDebugString("Mouse move\n");  
         pParent->GetWindowRect(&parentRect);
         // calc the distance moved
         x = point.x - m_downPosition.x;
         y = point.y - m_downPosition.y;
         parentRect.right += x;
         parentRect.bottom += y;
         // re-position the window
         pParent->MoveWindow(&parentRect);
      }
   }
	
	CWnd::OnMouseMove(nFlags, point);
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
高清av一区二区| 亚洲女厕所小便bbb| 麻豆国产精品777777在线| 91精品久久久久久久91蜜桃 | 精品国精品国产| 免费成人深夜小野草| 精品日韩一区二区三区| 国产乱码精品一区二区三区忘忧草| 久久久久久**毛片大全| 成人精品一区二区三区四区 | 一本一道久久a久久精品综合蜜臀| 日本欧美在线看| 久久精品视频在线免费观看| 成人av资源下载| 亚洲一区二区3| 欧美一级理论片| 成人亚洲一区二区一| 一级特黄大欧美久久久| 日韩亚洲欧美一区二区三区| 国产成都精品91一区二区三| 亚洲欧美激情小说另类| 7777精品久久久大香线蕉| 国产一区二区三区免费| 亚洲天天做日日做天天谢日日欢| 欧美日韩一区在线观看| 狠狠色综合播放一区二区| 亚洲欧洲av色图| 91精品国产欧美日韩| 成人午夜av在线| 午夜精品免费在线观看| 国产日韩影视精品| 欧美三级日韩在线| 国产电影一区二区三区| 亚洲国产欧美一区二区三区丁香婷| 日韩精品一区二区三区四区 | 成人午夜短视频| 婷婷国产v国产偷v亚洲高清| 久久久久国产成人精品亚洲午夜| 日本电影欧美片| 国产麻豆一精品一av一免费 | 亚洲成av人片在线观看无码| 精品久久久三级丝袜| 在线国产电影不卡| 国产在线一区二区| 午夜精品久久久久| 亚洲欧洲在线观看av| 欧美videofree性高清杂交| 色综合网色综合| 国产乱码精品一区二区三区av | 亚洲综合一区在线| 亚洲在线视频一区| 久久久99精品免费观看| 欧美人伦禁忌dvd放荡欲情| 99久久婷婷国产精品综合| 久久国产欧美日韩精品| 午夜日韩在线电影| 成人ar影院免费观看视频| 国产精品日韩成人| 国产一区二区三区免费在线观看| 亚洲一区二区不卡免费| 欧美高清在线视频| 2023国产精品视频| 日韩一区二区在线观看视频 | 性欧美疯狂xxxxbbbb| 日韩一区日韩二区| 欧美极品美女视频| 久久午夜电影网| 日韩欧美精品在线视频| 欧美巨大另类极品videosbest| 色悠悠久久综合| 91在线码无精品| 波波电影院一区二区三区| 国产精华液一区二区三区| 精品一区二区免费在线观看| 人人精品人人爱| 免费人成网站在线观看欧美高清| 亚洲不卡在线观看| 日韩欧美黄色影院| 制服丝袜成人动漫| 成人免费小视频| 欧美美女直播网站| 欧美日韩一级视频| 18欧美乱大交hd1984| 久久久久成人黄色影片| 久久蜜桃av一区精品变态类天堂| 久久视频一区二区| 国产网站一区二区三区| 国产精品免费人成网站| 综合激情网...| 一区av在线播放| 午夜精品一区在线观看| 免费av网站大全久久| 麻豆中文一区二区| 激情综合色综合久久| 国产九色精品成人porny| 成人高清视频在线观看| 色综合久久综合| 欧美高清视频www夜色资源网| 欧美一区二区高清| 精品美女一区二区| 国产精品久久久久久久午夜片| 亚洲欧美色一区| 日韩精品亚洲专区| 韩国精品一区二区| 欧美一级在线免费| 欧美精品一区二区三区久久久| 欧美日韩性生活| 日韩欧美电影在线| 国产午夜精品一区二区三区四区| 国产精品不卡一区| 亚洲成人av一区| 国产在线播放一区二区三区| 国产91精品露脸国语对白| 91久久香蕉国产日韩欧美9色| 欧美日韩国产综合一区二区| 精品999在线播放| ㊣最新国产の精品bt伙计久久| 午夜久久久久久电影| 欧美在线播放高清精品| 欧美一级生活片| 成人欧美一区二区三区| 日本特黄久久久高潮| 粉嫩av一区二区三区粉嫩| 欧美写真视频网站| 国产亚洲美州欧州综合国| 亚洲电影在线免费观看| 国产成人精品影视| 91精品国产综合久久久久久| 欧美国产激情二区三区| 欧美一二三在线| 免费三级欧美电影| 精品区一区二区| 国产精品天天看| 水野朝阳av一区二区三区| 成人精品在线视频观看| 欧美日韩国产色站一区二区三区| 久久久激情视频| 爽好多水快深点欧美视频| 91在线国产福利| 2020国产精品久久精品美国| 亚洲777理论| 99免费精品在线| 久久精品人人做人人爽人人| 视频精品一区二区| 蜜桃精品视频在线| 日韩欧美国产麻豆| 亚洲精品成人在线| 高清不卡一区二区| 日韩一卡二卡三卡国产欧美| 中文字幕乱码日本亚洲一区二区| 蜜桃传媒麻豆第一区在线观看| 91福利在线观看| 国产精品久久久久久久第一福利| 美女免费视频一区| 欧美日韩电影在线| 亚洲综合色噜噜狠狠| 国产乱码精品一区二区三区忘忧草| 日本一区二区不卡视频| 亚洲欧洲一区二区三区| 亚洲福利电影网| 色偷偷成人一区二区三区91 | 日本欧美加勒比视频| 欧美丝袜自拍制服另类| 亚洲女同女同女同女同女同69| 不卡av电影在线播放| 国产精品区一区二区三| 国产99精品国产| 中文字幕成人av| 国产.欧美.日韩| 国产亚洲一区二区三区| 国产一区二区福利视频| 久久久亚洲午夜电影| 国产剧情av麻豆香蕉精品| 国产欧美精品区一区二区三区| 狠狠v欧美v日韩v亚洲ⅴ| 精品av久久707| 国产不卡视频一区二区三区| 国产午夜精品一区二区三区视频 | 国产乱国产乱300精品| 久久精品综合网| 成人黄色av网站在线| 亚洲视频免费看| 色吧成人激情小说| 亚洲成av人片观看| 日韩三级在线观看| 国产麻豆欧美日韩一区| 国产精品美女久久久久久2018 | 91高清视频在线| 五月天精品一区二区三区| 日韩亚洲欧美中文三级| 精品一区二区三区在线播放视频| 国产日韩精品一区二区三区在线| 成人国产精品免费| 亚洲自拍偷拍综合| 日韩免费高清av| 成人免费高清在线观看| 亚洲女厕所小便bbb| 欧美三片在线视频观看 | 国产一区二区三区精品欧美日韩一区二区三区 | 成人综合婷婷国产精品久久|