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

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

?? resizer.cpp

?? modbus PLC 模擬程序
?? CPP
字號(hào):
/*****************************************************************************
 *
 *  Filename : DRAGSIZERBMP.CPP
 *
 *****************************************************************************
 *
 *  Copyright : (c) Adroit Technologies (Pty) Ltd 1992, 2000
 *
 *****************************************************************************
 *
 *  Description : This is the implementation for CResizer class .
 *
 * ORIGINAL HEADDER (modified):
 *
 * Class to correctly move child windows after parent window was resized
 *
 *  Copyright: (C)2001 Dmitry Kochin <dco@mail.ru>
 * Created: 06/07/01 by dukei@
 *
 *Each child window side (left, top, right and bottom) is connected to a side of another window,
 *so called relative window. It is typically dialog window, that owns the child window.
 *When dialog window is resized, child window sides are moved after the relative window,
 *preserving the connections. 
 *
 *Typical usage:
 *
 * 1. CResizer m_resizer is member variable;
 *
 * 2. Add the following code to OnInitDialog() 
 * (replacing control IDs to your specific ones).
 * See array format description later in the comment
 *  
 *  static CResizer::CBorderInfo s_bi[] = {
 *    {IDC_CONTROL_ID,      {CResizer::eFixed, IDC_MAIN, CResizer::eLeft},  *Left side
 *                          {CResizer::eFixed, IDC_MAIN, CResizer::eTop},   *Top side
 *                          {CResizer::eFixed, IDC_MAIN, CResizer::eLeft},  *Right side
 *                          {CResizer::eFixed, IDC_MAIN, CResizer::eTop}},  *Bottom side
 *    {IDC_STATIC_ID,       {CResizer::eFixed, IDC_MAIN, CResizer::eLeft}, 
 *                          {CResizer::eFixed, IDC_MAIN, CResizer::eTop},  
 *                          {CResizer::eFixed, IDC_MAIN, CResizer::eRight},
 *                          {CResizer::eFixed, IDC_MAIN, CResizer::eTop}}, 
 *  };
 *  const nSize = sizeof(s_bi)/sizeof(s_bi[0]);
 *  m_resizer.Init(m_hWnd, NULL, s_bi, nSize);
 *
 * 3. Add the following code to OnSize() handler
 *
 *  m_resizer.Move();
 *
 * 4. Everything should work now
 *
 * P.S. Data array format consists of one or more CBorderInfo structures, which contains
 * moved control ID (first field) and four CBorder structures, 
 * for left, top, right and bottom sides of moved control accordingly.
 *
 * The main difficulty is to understand CBorder structure, which has the following format:
 * 
 * {<how control side is connected to side of another window>, <another window id>, 
 *                  <side of another window, to which a control side is connected>}
 * 
 *     CResizer::eFixed                                  CResizer::eLeft 
 *     CResizer::eProportional  IDC_MAIN                 CResizer::eTop   
 * or {CResizer::eWidth       , IDC_ANOTHER_CONTROL_ID , CResizer::eRight   }
 *     CResizer::eHeight                                 CResizer::eBottom
 *                                                       CResizer::eXCenter
 *                                                       CResizer::eYCenter
 *
 * For example, {CResizer::eFixed, IDC_MAIN, CResizer::eLeft} means, that moved control side is
 * on the fixed distance (CResizer::eFixed) from left side (CResizer::eLeft) of dialog window (IDC_MAIN)
 *
 * Another example: {CResizer::eProportional, IDC_CONTROL_ID, CResizer::eLeft} means, that
 * moved control side preserves relation (proportionaly) (CResizer::eProportional)
 * to the width (CResizer::eLeft or CResizer::eRight) of control IDC_CONTROL_ID.
 *
 * TIP: Resizer resizes controls in the order they are defined in the array, so
 * <another window id> should always be defined (and, therefore, moved by the resizer) before
 * it is used as relative window. Otherwise, resizer ASSERTs.
 *
 *******************************************************************/

#include "stdafx.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CResizer::CResizer()
{
  memset(&m_rcInitial, 0, sizeof(m_rcInitial));
  m_vInfo = NULL;
  m_vRectInfo = NULL;
  m_nSize = 0;
  m_nCachedSize = 0;
}

CResizer::~CResizer()
{
  Clear();
}

void CResizer::Clear()
{
  delete [] m_vInfo;
  delete [] m_vRectInfo;
  m_vInfo = NULL;
  m_vRectInfo = NULL;
  m_nSize = 0;
  m_nCachedSize = 0;
}

bool CResizer::Init(HWND hWndParent, LPCRECT rcInitial, const CResizer::CBorderInfo *pBorders, int nSize)
{
  Clear();
  m_vInfo = new CControlInfo[nSize];
  m_nSize = nSize;

  m_wndParent = hWndParent;
  
  if(rcInitial == NULL)
    ::GetClientRect(m_wndParent, &m_rcInitial);
  else
    ::CopyRect(&m_rcInitial, rcInitial);
  
  for(int i=0; i<m_nSize; i++){
    CControlInfo &ci = m_vInfo[i];
    ci.pInfo = pBorders + i;
    GetDlgItemRect(ci.pInfo->nID, ci.rcInitial);
    
#ifdef _DEBUG
    //Make some debug checking
    //Check that no controls have reserved IDs
    //IDC_MAIN == 0 isn't allowed for control identifiers!
    //Set another control ID with CWindow::SetDlgCtrlID() or ::SetWindowLong(m_hWnd, GWL_ID, nID)!
    _ASSERTE(ci.pInfo->nID != IDC_MAIN); 
    //Check that this control ID is unique.
    //ALL control identifiers MUST BE UNIQUE!!!
    for(int j=0; j < i; j++){
      const CControlInfo &ciPrevious = m_vInfo[j];
      _ASSERTE(ciPrevious.pInfo->nID != ci.pInfo->nID); //Duplicated control ID!!!
      //Control j in initialization array has the same id as control i.
    }
#endif
  }
  return true;
}

void CResizer::Move() const{
  if(m_vRectInfo == NULL && m_nSize > 0)
    m_vRectInfo = new CRectInfo[m_nSize];
  
  for(int i=0; i<m_nSize; i++){
    //Move(i) should be called always for i=0 to m_nSize!!
    //It is required by its implementation!
    Move(i);
  }
  
  MoveAndHideOverlapped();
}

void CResizer::Move(int nIndex) const{
  const CControlInfo &ci = m_vInfo[nIndex];
  CRectInfo &ri = m_vRectInfo[nIndex];
  m_nCachedSize = nIndex + 1; //Now m_vRectInfo contains nIndex + 1 valid items
  
  ri.nID = ci.pInfo->nID;
  
  RECT &rc = ri.rc;
  
  rc.left = GetCoordinate(eLeft, ci.rcInitial, ci.pInfo->left, rc);
  rc.top = GetCoordinate(eTop, ci.rcInitial, ci.pInfo->top, rc);
  rc.right = GetCoordinate(eRight, ci.rcInitial, ci.pInfo->right, rc);
  rc.bottom = GetCoordinate(eBottom, ci.rcInitial, ci.pInfo->bottom, rc);
  
  HWND pCtl = GetDlgItem(ci.pInfo->nID);
  LONG dwStyle = ::GetWindowLong(pCtl, GWL_STYLE);
  ri.bVisible = (::IsWindowVisible(pCtl) != FALSE && (dwStyle&WS_CLIPSIBLINGS) == 0);
  ri.bHide = false;
}

int CResizer::GetCoordinate(ESize eType, const RECT &rcInitial, const CBorder &border, const RECT &rc) const{
  int nOld = GetRectCoord(eType, rcInitial);
  switch(border.eType){
  case eFixed:
    {
      //Get initial relative window position
      RECT rc;
      GetInitialDlgItemRect(border.nRelID, rc);
      int nRelOld = GetRectCoord(border.eRelType, rc);
      //Get current relative window position
      int nRelNew = GetRelativeCoord(border);
      //Compute and return new position
      return nOld - nRelOld + nRelNew;
    }
  case eProportional:
    {
      //Get initial relative window position
      RECT rcOld;
      GetInitialDlgItemRect(border.nRelID, rcOld);
      int nOldSize = GetRectSize(eType, rcOld);
      int nOldBase = GetRectCoord(border.eRelType, rcOld);
      //Get current relative window position
      RECT rcNew;
      GetCachedDlgItemRect(border.nRelID, rcNew);
      int nNewSize = GetRectSize(eType, rcNew);
      int nNewBase = GetRectCoord(border.eRelType, rcNew);
      //Compute and return new position
      return nNewBase + (nOld - nOldBase)*nNewSize/(nOldSize <= 0 ? 1 : nOldSize);
    }
  case eWidth:
    {
      return rc.left + rcInitial.right - rcInitial.left;
    }
  case eHeight:
    {
      return rc.top + rcInitial.bottom - rcInitial.top;
    }
  }
  _ASSERTE(FALSE); //Wrong relation type is specified. Use items from EBorder enum.
  return 0;
}

int CResizer::GetRectCoord(ESize eType, const RECT &rc){
  switch(eType){
  case eLeft:
    return rc.left;
  case eTop:
    return rc.top;
  case eRight:
    return rc.right;
  case eBottom:
    return rc.bottom;
  case eXCenter:
    return (rc.right + rc.left)/2;
  case eYCenter:
    return (rc.bottom + rc.top)/2;
  }
  _ASSERTE(FALSE); //Wrong side is specified. Use items from ESize enum.
  return 0;
}

int CResizer::GetRectSize(ESize eType, const RECT &rc){
  switch(eType){
  case eLeft:
  case eRight:
  case eXCenter:
    return rc.right - rc.left;
  case eTop:
  case eBottom:
  case eYCenter:
    return rc.bottom - rc.top;
  }
  _ASSERTE(FALSE); // Wrong side is specified. Use items from ESize enum.
  return 0;
}

int CResizer::GetRelativeCoord(const CBorder &border) const{
  RECT rc;
  GetCachedDlgItemRect(border.nRelID, rc);
  return GetRectCoord(border.eRelType, rc);
}

void CResizer::GetDlgItemRect(int nID, RECT &rc) const{
  switch(nID){
  case IDC_MAIN:
    {
      ::GetClientRect(m_wndParent, &rc);
      break;
    }
  default:
    {
      HWND pCtl = GetDlgItem(nID);
      ::GetWindowRect(pCtl, &rc);
      
      POINT pt1, pt2;
      pt1.x = rc.left, pt1.y = rc.top;
      pt2.x = rc.right, pt2.y = rc.bottom;
      ::ScreenToClient(m_wndParent, &pt1);
      ::ScreenToClient(m_wndParent, &pt2);
      rc.left = pt1.x, rc.top = pt1.y, rc.right = pt2.x, rc.bottom = pt2.y;
      break;
    }
  }
}

void CResizer::GetCachedDlgItemRect(int nID, RECT &rc) const{
  switch(nID){
  case IDC_MAIN:
    {
      GetDlgItemRect(nID, rc);
      break;
    }
  default:
    {
      int i = FindCached(nID);
      rc = m_vRectInfo[i].rc;
      break;
    }
  }
}

void CResizer::GetInitialDlgItemRect(int nID, RECT &rc) const{
  switch(nID){
  case IDC_MAIN:
    {
      rc = m_rcInitial;
      break;
    }
  default:
    {
      //Get initial relative window position
      int i = Find(nID);
      rc = m_vInfo[i].rcInitial;
      break;
    }
  }
}

int CResizer::Find(int nID) const{
  for(int i=0; i<m_nSize; i++){
    if(m_vInfo[i].pInfo->nID == nID)
      return i;
  }
  _ASSERTE(FALSE); //Possibly control id nID wasn't defined before it is used
  //as relative window. Read the TIP in the header file resizer.h
  return -1;
}

int CResizer::FindCached(int nID) const{
  for(int i=0; i<m_nCachedSize; i++){
    if(m_vRectInfo[i].nID == nID)
      return i;
  }
  _ASSERTE(FALSE); //Possibly control id nID wasn't defined before it is used
  //as relative window. Read the TIP in the header file resizer.h
  return -1;
}

void CResizer::MoveAndHideOverlapped() const{
  _ASSERTE(m_nSize == m_nCachedSize);
  for(int i=0; i<m_nSize; i++){
    CRectInfo &riSlave = m_vRectInfo[i];
    for(int j=0; j<i; j++){
      const CRectInfo &riMaster = m_vRectInfo[j];
      //if senior window is visible and intersects with juniur, junior is to be hidden
      if(riMaster.bVisible && riSlave.bVisible && !riSlave.bHide){ 
        RECT rc;
        ::IntersectRect(&rc, &riMaster.rc, &riSlave.rc);
        riSlave.bHide = !::IsRectEmpty(&rc);
      }
    }
    //if the window doesn't intersect with seniors, it can be drawn
    HWND pCtl = GetDlgItem(riSlave.nID);
    if(riSlave.bHide)
      ::SetRectEmpty(&riSlave.rc);
    //SWP_NOCOPYBITS is obligatory, otherwise windows don't correctly redraw itselves
    ::SetWindowPos(pCtl, NULL, riSlave.rc.left, riSlave.rc.top, 
      riSlave.rc.right - riSlave.rc.left, riSlave.rc.bottom - riSlave.rc.top, 
      SWP_NOCOPYBITS|SWP_NOZORDER);
  }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品传媒视频| 成人免费毛片片v| 一本色道久久综合狠狠躁的推荐| 国产亚洲一二三区| 国产成人午夜高潮毛片| 中文字幕在线观看不卡| 色婷婷精品久久二区二区蜜臀av| 亚洲精品欧美激情| 欧美日韩国产在线播放网站| 免费人成网站在线观看欧美高清| 欧美xxxxxxxxx| 成人性生交大片| 亚洲综合偷拍欧美一区色| 欧美福利视频一区| 国产成人av资源| 亚洲日本一区二区三区| 69p69国产精品| 粉嫩久久99精品久久久久久夜| 亚洲欧美影音先锋| 7878成人国产在线观看| 国产精品自拍网站| 亚洲一二三四久久| 久久色.com| 91黄色免费版| 国内一区二区视频| 亚洲精选视频在线| 精品久久久久久亚洲综合网| 777亚洲妇女| 国产99一区视频免费| 亚洲成a人片在线观看中文| 久久综合国产精品| 欧美日韩国产三级| 成人精品电影在线观看| 在线精品国精品国产尤物884a| 日精品一区二区三区| 精品国产99国产精品| fc2成人免费人成在线观看播放| 天天综合网 天天综合色| 欧美国产97人人爽人人喊| 6080亚洲精品一区二区| 成人国产精品免费观看视频| 另类小说一区二区三区| 一区二区三区在线视频观看58| 欧美精品一区二区三区四区| 欧美三片在线视频观看| 盗摄精品av一区二区三区| 视频精品一区二区| 亚洲精品一二三四区| 久久久国产午夜精品| 欧美高清精品3d| 一本大道av一区二区在线播放| 精品亚洲porn| 免费观看91视频大全| 亚洲成人中文在线| 亚洲欧美偷拍卡通变态| 国产亚洲精品福利| 亚洲精品日日夜夜| 2020日本不卡一区二区视频| 一本到不卡精品视频在线观看| 国产一区二区不卡| 蜜臀久久久99精品久久久久久| 亚洲一区二区三区美女| 亚洲精选视频在线| 亚洲精品美国一| 日韩不卡免费视频| 一区二区三区四区蜜桃| 亚洲色图制服丝袜| 国产精品狼人久久影院观看方式| 国产三级欧美三级日产三级99| 欧美一级欧美一级在线播放| 欧美日韩aaaaaa| 3d动漫精品啪啪一区二区竹菊| 在线观看网站黄不卡| 在线视频中文字幕一区二区| 91首页免费视频| 91日韩精品一区| 91久久精品一区二区二区| 91小视频在线| 91福利资源站| 8x8x8国产精品| 欧美日韩一本到| 欧美性色欧美a在线播放| 色婷婷精品大在线视频| 日本精品视频一区二区三区| 色吊一区二区三区 | 亚洲一级二级在线| 一区二区三区国产| 五月天欧美精品| 美日韩一级片在线观看| 国产一区二区按摩在线观看| 国产69精品久久777的优势| 成人福利视频在线| 色噜噜狠狠成人中文综合| 欧美中文一区二区三区| 欧美肥胖老妇做爰| 精品国产成人系列| 国产欧美一区二区三区网站| 亚洲天堂网中文字| 亚洲一区二区三区四区在线观看 | 污片在线观看一区二区| 捆绑变态av一区二区三区| 中文字幕中文字幕在线一区| 樱桃国产成人精品视频| 性做久久久久久久久| 九色综合国产一区二区三区| 成人午夜激情在线| 91久久香蕉国产日韩欧美9色| 91.xcao| 夜色激情一区二区| 天堂影院一区二区| 国产精品99久久久久久有的能看 | 亚洲一区国产视频| 久久99深爱久久99精品| 成人免费看视频| 欧美精品色综合| 欧美激情综合五月色丁香小说| 亚洲午夜av在线| 国产精品99久久久久久宅男| 在线免费观看不卡av| 久久久亚洲国产美女国产盗摄| 亚洲裸体xxx| 国产一区中文字幕| 欧美性生活大片视频| 欧美—级在线免费片| 日日嗨av一区二区三区四区| 成人97人人超碰人人99| 欧美四级电影网| 色综合久久久网| 日韩精品在线一区| 亚洲靠逼com| 国产成a人亚洲精品| 欧美年轻男男videosbes| 国产精品麻豆久久久| 美国十次了思思久久精品导航| av一区二区三区在线| 欧美电影免费观看高清完整版| 亚洲狠狠丁香婷婷综合久久久| 国产精品综合久久| 日韩你懂的在线播放| 夜夜精品浪潮av一区二区三区| 国产91丝袜在线播放九色| 日韩欧美亚洲一区二区| 一区二区三区在线不卡| 成人av网站免费| 久久精品这里都是精品| 日本91福利区| 欧美日韩一级二级| 一区二区三区国产精华| jlzzjlzz亚洲日本少妇| 国产日韩欧美a| 精品一区二区三区久久| 欧美激情自拍偷拍| 日韩在线播放一区二区| 日本高清不卡在线观看| 香蕉影视欧美成人| 在线观看一区日韩| 成人欧美一区二区三区黑人麻豆| 国产成人精品综合在线观看| 精品久久99ma| 精品影院一区二区久久久| 日韩午夜电影在线观看| 日韩av成人高清| 91精品国产品国语在线不卡| 日本成人在线视频网站| 欧美精品自拍偷拍动漫精品| 午夜成人免费电影| 日韩亚洲欧美中文三级| 日韩综合在线视频| 日韩色视频在线观看| 免费成人av资源网| 日韩欧美资源站| 国产一区二区三区免费播放| www精品美女久久久tv| 国产米奇在线777精品观看| 久久久欧美精品sm网站| 国产精品69久久久久水密桃| 欧美激情一区二区三区| av亚洲精华国产精华精| 亚洲欧美一区二区三区国产精品| 91久久精品一区二区三区| 午夜久久久久久久久久一区二区| 69堂成人精品免费视频| 在线精品视频小说1| 欧美视频一区在线观看| 亚洲国产一区二区a毛片| 精品视频全国免费看| 天天色综合成人网| 欧美videofree性高清杂交| 国产69精品久久久久毛片| 国产精品日日摸夜夜摸av| 一本一道久久a久久精品| 亚瑟在线精品视频| 久久精子c满五个校花| 91亚洲精品久久久蜜桃网站| 亚洲韩国一区二区三区| 26uuu亚洲婷婷狠狠天堂| www.欧美精品一二区| 天堂久久一区二区三区| 国产视频一区在线播放| 欧美一a一片一级一片|