智能终端定制开发 ad
MTK/瑞芯微/高通-Android,智能模块/智能终端方案商

深度定制各类智能终端和智能硬件产品,提供硬件选型咨询、参考设计、元器件推荐、驱动开发、行业模块集成、操作系统定制与算法集成等软硬件定制服务。
contact.aspx

Android核心板产品覆盖2G、3G、4G通讯,双核、四核、八核CPU,可选的平台有MTK6580、MTK6737、MTK6750等,Android版本有5.1 6.0 7.0等。
contact.aspx

可广泛应用于低端智能POS、安防监控、车载设备、低端智能机器人、智能家居、智能硬件、工业智能手持设备、低端智能对讲设备、低端警务或执法设备、智能穿戴、贩卖机、物流柜、智能门禁系统等行业和设备。
contact.aspx

可提供以太网转串口透传,WIFI转串口透传,蓝牙转串口透传,CAN总线模拟量控制输出模块等。
contact.aspx

带3G或4G通讯功能,运行android系统,有多个串口,可以外挂各种模块:条码扫描、RFID、指纹识别、身份证识别、磁条卡、ID卡、GPS/北斗模块等。
contact.aspx

具有4G通讯功能,多个RS232或RS485接口,以太网接口,USB接口,CAN接口,多个AD输入。基于Android系统智能平台,方便APP应用开发。器件严格选型,运行稳定,质量可靠。
contact.aspx

MFC 停泊CDialogBar , docking效果
[VC 编程] 2008-04-07

为什么派生自CDialogBar的对话框条不显示

楼主orcx(半兽人)2003-06-18 19:31:55 在 VC/MFC / 基础类 提问

在资源编译器里画一对话框条IDD_DIALOGBAR1,然后用CLASSWIDZAD加类,基类用的是CWnd,后手动改为CDialogBar,class   CMyDialogBar:public   CdialogBar  
   
  MainFrm.h下定义  
  CMyDialogBar       m_DialogBar;  
   
  MainFrm.cpp下  
   
  if   (!m_DialogBar.Create(this,IDD_DIALOGBAR1,CBRS_LEFT|CBRS_TOOLTIPS|CBRS_FLYBY|WS_VISIBLE|WS_CHILD,IDD_DIALOGBAR1))  
  {  
  TRACE0("Failed   to   create   toolbar\n");  
  return   -1;             //   fail   to   create  
  }  
  问题:  
  1、运行后不显示对话框条;  
  2、不能写停泊EnableDocking,写了就有断言错误;  
  3、想在对话框条上画图,  
     
  问题点数:100、回复次数:11Top

1 楼psusong(栀子花开)回复于 2003-06-18 19:42:13 得分 0

不要派生CDialogBar,自己直接用就行了  
  不行的话,我给你个小例子  
  Top

2 楼mahatma_cn(研究硕士生)回复于 2003-06-18 19:44:28 得分 0

不用派生就可以用的啊,直接用CDialogBar,然后create并指定idTop

3 楼psusong(栀子花开)回复于 2003-06-18 19:56:42 得分 0

可能用CDialogBar实现不了docking!,没有试过  
  你要想docking,用CReBar好了  
   
  Top

4 楼psusong(栀子花开)回复于 2003-06-18 20:11:53 得分 0

int   CMainFrame::OnCreate(LPCREATESTRUCT   lpCreateStruct)  
  {  
  if   (CFrameWnd::OnCreate(lpCreateStruct)   ==   -1)  
  return   -1;  
   
  if   (!m_wndToolBar.CreateEx(this,   TBSTYLE_FLAT,   WS_CHILD   |   WS_VISIBLE   |   CBRS_TOP  
  |   CBRS_GRIPPER   |   CBRS_TOOLTIPS   |   CBRS_FLYBY   |   CBRS_SIZE_DYNAMIC)   ||  
  !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))  
  {  
  TRACE0("Failed   to   create   toolbar\n");  
  return   -1;             //   fail   to   create  
  }  
   
  if   (!m_wndStatusBar.Create(this)   ||  
  !m_wndStatusBar.SetIndicators(indicators,  
      sizeof(indicators)/sizeof(UINT)))  
  {  
  TRACE0("Failed   to   create   status   bar\n");  
  return   -1;             //   fail   to   create  
  }  
   
  //Create   the   user   command   bar   in   the   CMainFrames   bottom!  
        if   (!m_wndDlgBar.Create(this,   IDD_COMMAND_BAR,  
              CBRS_BOTTOM|CBRS_TOOLTIPS|CBRS_FLYBY,   IDD_COMMAND_BAR))  
        {  
              TRACE0("Failed   to   create   DlgBar\n");  
              return   -1;             //   Fail   to   create.  
        }  
   
   
  //   TODO:   Delete   these   three   lines   if   you   dont   want   the   toolbar   to  
  //     be   dockable  
  m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);  
  EnableDocking(CBRS_ALIGN_ANY);  
  DockControlBar(&m_wndToolBar);  
   
  CStatic   *pStatic=(CStatic*)this->m_wndDlgBar.GetDlgItem(IDC_STATIC_MOVE);  
  if(pStatic!=NULL)  
  {  
  pStatic->SetTimer(1,100L,NULL);  
  this->m_StaticMove.SubclassDlgItem(IDC_STATIC_MOVE,&this->m_wndDlgBar);  
  }  
  return   0;  
  }  
  Top

5 楼syl08341(沈阳老零)回复于 2003-06-18 20:13:20 得分 0

lookTop

6 楼psusong(栀子花开)回复于 2003-06-18 20:21:54 得分 0

试了一下,CDialogBar可以实现docking,用法和CToolBar一个样子!  
  例如  
   
  int   CMainFrame::OnCreate(LPCREATESTRUCT   lpCreateStruct)  
  {  
  if   (CFrameWnd::OnCreate(lpCreateStruct)   ==   -1)  
  return   -1;  
   
  if   (!m_wndToolBar.CreateEx(this,   TBSTYLE_FLAT,   WS_CHILD   |   WS_VISIBLE   |   CBRS_TOP  
  |   CBRS_GRIPPER   |   CBRS_TOOLTIPS   |   CBRS_FLYBY   |   CBRS_SIZE_DYNAMIC)   ||  
  !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))  
  {  
  TRACE0("Failed   to   create   toolbar\n");  
  return   -1;             //   fail   to   create  
  }  
   
  if   (!m_wndStatusBar.Create(this)   ||  
  !m_wndStatusBar.SetIndicators(indicators,  
      sizeof(indicators)/sizeof(UINT)))  
  {  
  TRACE0("Failed   to   create   status   bar\n");  
  return   -1;             //   fail   to   create  
  }  
   
  //Create   the   user   command   bar   in   the   CMainFrames   bottom!  
        if   (!m_wndDlgBar.Create(this,   IDD_COMMAND_BAR,  
              CBRS_GRIPPER   |   CBRS_TOOLTIPS   |   CBRS_FLYBY   |    
      CBRS_SIZE_DYNAMIC|CBRS_BOTTOM,   IDD_COMMAND_BAR))  
        {  
              TRACE0("Failed   to   create   DlgBar\n");  
              return   -1;             //   Fail   to   create.  
        }  
   
   
  //   TODO:   Delete   these   three   lines   if   you   dont   want   the   toolbar   to  
  //     be   dockable  
   
   
  CStatic   *pStatic=(CStatic*)this->m_wndDlgBar.GetDlgItem(IDC_STATIC_MOVE);  
  if(pStatic!=NULL)  
  {  
  pStatic->SetTimer(1,100L,NULL);  
  this->m_StaticMove.SubclassDlgItem(IDC_STATIC_MOVE,&this->m_wndDlgBar);  
  }  
   
  this->m_wndDlgBar.EnableDocking(CBRS_ALIGN_ANY);  
  m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);  
  EnableDocking(CBRS_ALIGN_ANY);  
  DockControlBar(&m_wndToolBar);  
  DockControlBar(&this->m_wndDlgBar);  
  return   0;  
  }  
  Top

7 楼orcx(半兽人)回复于 2003-06-18 20:22:45 得分 0

谢谢各位!我是想在它上面画图,如果不生成对象可以实现画图吗?Top

8 楼psusong(栀子花开)回复于 2003-06-18 20:48:42 得分 0

可以的!  
  我上面的代码就是在CDialogBar上了画了一个动态的园,很easy的!  
  CStatic   *pStatic=(CStatic*)this->m_wndDlgBar.GetDlgItem(IDC_STATIC_MOVE);  
  if(pStatic!=NULL)  
  {  
  pStatic->SetTimer(1,100L,NULL);  
  this->m_StaticMove.SubclassDlgItem(IDC_STATIC_MOVE,&this->m_wndDlgBar);  
  }  
   
  给你个demo工程吧!  
  你可以到我得ftp下载去:  
   
  ftp://csdn:csdn@itanynj.dns0755.net:10766  
  里面有个文件UseEditLogin.rar  
   
  今天心情很不错!帮人帮到底了Top

9 楼psusong(栀子花开)回复于 2003-06-18 20:51:13 得分 100

绘图的代码是:(我用了子类型化,为了更好的OOP,没有直接在DialgBar上绘制)  
   
  #if   !defined(AFX_STATIC_MOVE_H__23870C90_CA4C_4E8E_85CC_9AD1C608E843__INCLUDED_)  
  #define   AFX_STATIC_MOVE_H__23870C90_CA4C_4E8E_85CC_9AD1C608E843__INCLUDED_  
   
  #if   _MSC_VER   >   1000  
  #pragma   once  
  #endif   //   _MSC_VER   >   1000  
  //   Static_Move.h   :   header   file  
  //  
   
  /////////////////////////////////////////////////////////////////////////////  
  //   CStatic_Move   window  
   
  class   CStatic_Move   :   public   CStatic  
  {  
  //   Construction  
  public:  
  CStatic_Move();  
  private:  
  CPen   m_pen;  
  CBrush   m_brush[3];  
  int   m_index;  
  //   Attributes  
  public:  
   
  //   Operations  
  public:  
   
  //   Overrides  
  //   ClassWizard   generated   virtual   function   overrides  
  //{{AFX_VIRTUAL(CStatic_Move)  
  //}}AFX_VIRTUAL  
   
  //   Implementation  
  public:  
  virtual   ~CStatic_Move();  
   
  //   Generated   message   map   functions  
  protected:  
  //{{AFX_MSG(CStatic_Move)  
  afx_msg   void   OnPaint();  
  afx_msg   void   OnTimer(UINT   nIDEvent);  
  //}}AFX_MSG  
   
  DECLARE_MESSAGE_MAP()  
  };  
   
  /////////////////////////////////////////////////////////////////////////////  
   
  //{{AFX_INSERT_LOCATION}}  
  //   Microsoft   Visual   C++   will   insert   additional   declarations   immediately   before   the   previous   line.  
   
  #endif   //   !defined(AFX_STATIC_MOVE_H__23870C90_CA4C_4E8E_85CC_9AD1C608E843__INCLUDED_)  
   
   
  //------------------------------------------------------  
  //   Static_Move.cpp   :   implementation   file  
  //  
   
  #include   "stdafx.h"  
  #include   "UseEditLogin.h"  
  #include   "Static_Move.h"  
   
  #ifdef   _DEBUG  
  #define   new   DEBUG_NEW  
  #undef   THIS_FILE  
  static   char   THIS_FILE[]   =   __FILE__;  
  #endif  
   
  /////////////////////////////////////////////////////////////////////////////  
  //   CStatic_Move  
   
  CStatic_Move::CStatic_Move()  
  {  
  m_pen.CreateStockObject(NULL_PEN);  
  m_brush[0].CreateSolidBrush(RGB(255,0,0));//red  
  m_brush[1].CreateSolidBrush(RGB(0,255,0));//green  
  m_brush[2].CreateSolidBrush(RGB(0,0,255));//blue  
  m_index=0;  
  }  
   
  CStatic_Move::~CStatic_Move()  
  {  
  }  
   
   
  BEGIN_MESSAGE_MAP(CStatic_Move,   CStatic)  
  //{{AFX_MSG_MAP(CStatic_Move)  
  ON_WM_PAINT()  
  ON_WM_TIMER()  
  //}}AFX_MSG_MAP  
  END_MESSAGE_MAP()  
   
  /////////////////////////////////////////////////////////////////////////////  
  //   CStatic_Move   message   handlers  
   
  void   CStatic_Move::OnPaint()    
  {  
  CPaintDC   dc(this);   //   device   context   for   painting  
   
    //   Get   the   client   area.  
        CRect   rectClient;  
        GetClientRect(rectClient);  
        CPoint   ptCentral=rectClient.CenterPoint();  
        int   dim=rectClient.Width()<rectClient.Height()?rectClient.Width():rectClient.Height();  
   
        //make   sure   the   rectClient   to   be   a   circle!  
        if(dim<rectClient.Width())  
        rectClient.InflateRect(-CSize((rectClient.Width()-dim)/2,0));  
        else  
  rectClient.InflateRect(CSize(0,-(rectClient.Height()-dim)/2));  
   
  CPoint   pt[3];  
  pt[0]=CPoint(0,ptCentral.y);  
  pt[1]=   CPoint(int(dim*3/4),int(ptCentral.y-1.732*dim/4));  
  pt[2]=CPoint(int(dim*3/4),int(ptCentral.y+1.732*dim/4));  
   
        CBrush*   pOldBrush;  
        CPen*   pOldPen;  
        pOldPen   =   dc.SelectObject(&m_pen);  
        pOldBrush   =   dc.SelectObject(&m_brush[m_index]);  
   
        dc.Pie(rectClient,pt[1],pt[0]);  
        dc.SelectObject(&m_brush[(m_index+1)%3]);  
        dc.Pie(rectClient,pt[0],pt[2]);  
        dc.SelectObject(&m_brush[(m_index+2)%3]);  
        dc.Pie(rectClient,pt[2],pt[1]);  
       
        //   Restore   the   previous   pen   and   brush.  
        dc.SelectObject(pOldPen);  
        dc.SelectObject(pOldBrush);  
  //   Do   not   call   CStatic::OnPaint()   for   painting   messages  
  }  
   
  void   CStatic_Move::OnTimer(UINT   nIDEvent)    
  {  
  //   TODO:   Add   your   message   handler   code   here   and/or   call   default  
  //   TODO:   Add   your   message   handler   code   here   and/or   call   default  
  m_index++;  
  if(m_index>2)  
  m_index=0;  
  this->Invalidate();  
  CStatic::OnTimer(nIDEvent);  
  CStatic::OnTimer(nIDEvent);  
  }  
   
   
  //新工作搞定了,心情愉快中。。。。。。。。。。。。。Top

10 楼psusong(栀子花开)回复于 2003-06-18 22:36:55 得分 0

are   you   ok?Top

11 楼orcx(半兽人)回复于 2003-06-21 12:14:55 得分 0

恭喜你!  
  谢谢

[VC 编程添加评论 | 评论/阅读(0/424)
评论
昵称
主页
内容
递交


Copyright @ 我的开发笔记     2008 - 2017         粤ICP备19155526号-1