Windows資源管理員Web視圖介面

來源:互聯網
上載者:User

當我們使用Windows資源管理員(Exporlor)時,看到左邊的視圖能夠顯示所選目標的相關資訊,比較好用。

本例是一個簡單的Web視圖介面樣本,不過左邊不是一個Web視圖,而是一個FormView。介面如下圖所示:

圖一 程式運行畫面

本例是最簡單的SDI工程,在View中建立了兩個View:

int CXindowView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
  if (CView::OnCreate(lpCreateStruct) == -1)
    return -1;
  /* 建立左右兩個視圖 */
  m_pForm = (CXindowForm *) okCreateView(RUNTIME_CLASS(CXindowForm), 1001);
  m_pList = (CXindowList *) okCreateView(RUNTIME_CLASS(CXindowList), 1002);
  m_pForm->m_pParent = this;
  return 0;
}

當視窗寬度<400時,會隱藏左邊的CXindowForm視圖:

void CXindowView::OnSize(UINT nType, int cx, int cy)
{
  CView::OnSize(nType, cx, cy);
  int nFormWidth = 200;
  /* 如果視窗寬度<400, 就隱藏左視圖 */
  if(cx>400)
  {
    if(m_pForm->GetSafeHwnd()) m_pForm->ShowWindow(SW_SHOW);
    if(m_pForm->GetSafeHwnd()) m_pForm->MoveWindow(0,0,nFormWidth,cy);
    if(m_pList->GetSafeHwnd()) m_pList->ShowWindow(SW_SHOW);
    if(m_pList->GetSafeHwnd()) m_pList->MoveWindow(nFormWidth,0,cx-nFormWidth,cy);
  }
  else
  {
    if(m_pForm->GetSafeHwnd()) m_pForm->ShowWindow(SW_HIDE);
    if(m_pList->GetSafeHwnd()) m_pList->ShowWindow(SW_SHOW);
    if(m_pList->GetSafeHwnd()) m_pList->MoveWindow(0,0,cx,cy);
  }
}

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.