首 页文章中心下载中心繁體中文
设为首页
加入收藏
联系我们
您当前的位置:开源盛世-源代码下载网 -> 文章中心 -> VC++专区 -> 文章内容 退出登录 用户管理
投票调查
栏目导航
· VC++专区 · V B 专区
· GIS 专区 · PDA 专区
· 其他编程 · 网站开发类
· 数据库类 · 软件应用
· 网络安全 · 论文专区
· 综合资讯
热门文章
· Tab Control控件使用...
· 学生档案管理系统
· [图文] 排列组合公式
· UTF-8与GB2312之间的...
· DirectShow下载安装...
· Virtual PC 在PAE模...
· Windows2000终端服务...
· MapInfo上的GIS系统...
· kalman filter 卡尔...
· Windows2000终端服务...
相关文章
· 在Windows 2000中配...
· [图文] 基于windows mobile...
· Windows mobile 下读...
· 基于Windows的 TAPI...
· [图文] Windows CE开发之起...
· C# 2.0 匿名方法与 ...
· Visual C#中调用Win...
· Windows2000终端服务...
· Windows2000终端服务...
· 防范入侵!修改Windo...
Windows资源管理器Web视图界面
作者:祝晓斌  来源:开源盛世-源代码下载网  发布时间:2005-8-14 22:15:17  发布人:Polaris

减小字体 增大字体

下载源代码

   
当我们使用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);
    }
}
其中左边的的CXindowForm视图中有个CXLabel控件“增加”,点击会产生WM_NOFITY消息,这样就能够响应了。
void CXindowForm::OnInitialUpdate() 
{
    CFormView::OnInitialUpdate();
    
    /* 相当于CListCtrl::SetItemData(), 用于区别是哪个CXLabel */
    m_add.SetCommand(1);
}

BOOL CXindowForm::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) 
{
    LPNMHDR pnmh = (LPNMHDR) lParam;
    
    if(pnmh->code==NM_LINKCLICK)
    {
        CXLabel* pLabel = (CXLabel *)GetDlgItem(pnmh->idFrom);
        CString str;

        /* GetCommand() */
        str.Format("d",pLabel->GetCommand());
        AfxMessageBox(str);

         if(m_pParent->GetSafeHwnd())
         {
             CListCtrl& listCtrl = ((CXindowView*)m_pParent)->m_pList->GetListCtrl();
             int nCount = listCtrl.GetItemCount();
 
             int nItem = listCtrl.InsertItem(nCount, "2003-8-15");
             listCtrl.SetItemText(nItem, 1, "192.168.3.1");
             listCtrl.SetItemText(nItem, 2, "www.vckbase.com");
             listCtrl.SetItemText(nItem, 3, "编程");
         }
    }
    return CFormView::OnNotify(wParam, lParam, pResult);
}   
注:CXLabel控件来自CLabel类,增加了几个有效函数。

End of《Windows资源管理器Web视图界面》

[] [返回上一页] [打 印] [收 藏]
 
∷相关“Windows资源管理器Web视图界面”文章评论∷
(评论内容只代表网友观点,与本站立场无关!) [更多评论...]
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站目录 鄂ICP备06007162
开源盛世 版权所有Copyright © 2003-2005 VSCodes.Com. All Rights Reserved.