buanhui 发表于 2003-5-26 11:09:00

AutoCAD R14上的图层选择栏即object propertiers是工具栏还是?

R14上的图层选择栏即object propertiers是栏还是对话框?我们怎样才能制做出这样的工具栏或对话框

zfbj 发表于 2003-5-30 13:43:00

具体的细节记不清了,回头查一下告诉你。

buanhui 发表于 2003-5-31 15:35:00


各位大虾!下面为本人写的求自定义实体相交的交点,
但运行时报错,请问如何才能让求自定义实体相交的交点不报错
myEntity::intersectWith(
    const AcDbEntity* ent,
    AcDb::Intersect intType,
    AcGePoint3dArray& points,
    int /*thisGsMarker*/,
    int /*otherGsMarker*/) const
{
    assertReadEnabled();
   if(intType==AcDb::kOnBothOperands)
   {
       AcGeLineSeg3d thisseg;
       thisseg.set(m_leftPoint,m_rightPoint);//m_leftPoint,m_rightPoint为得到自定义实体上的两点
       if(ent->isKindOf(myEntity::desc()))
      {
               AcGeLine3d otherseg;
               AcGePoint3dArray entpoints;
               AcGePoint3d pt1,startpt,endpt;
            AcDbVoidPtrArray entitySet;
            myEntity::cast(ent)->getRLpoints(entpoints);//得到自定义实体上的两点
               startpt=entpoints;
                endpt=entpoints;
            otherseg.set(startpt,endpt);
            thisseg.intersectWith(otherseg, pt1);
                points.append(pt1);
      }
   }
    return Acad::eOk;
}

buanhui 发表于 2003-6-2 20:20:00

AutoCAD R14上的图层选择栏即object propertiers是工具栏还是对话框?我们怎样才能制做出这样的工具栏或对话框
下面为本人写的求自定义实体相交的交点,
但运行时报错,请问如何才能让求自定义实体相交的交点而不报错
myEntity::intersectWith(
    const AcDbEntity* ent,
    AcDb::Intersect intType,
    AcGePoint3dArray& points,
    int /*thisGsMarker*/,
    int /*otherGsMarker*/) const
{
    assertReadEnabled();
   if(intType==AcDb::kOnBothOperands)
   {
       AcGeLineSeg3d thisseg;
       thisseg.set(m_leftPoint,m_rightPoint);//m_leftPoint,m_rightPoint为得到自定义实体上的两点
       if(ent->isKindOf(myEntity::desc()))
{
AcGeLine3d otherseg;
AcGePoint3dArray entpoints;
AcGePoint3d pt1,startpt,endpt;
            AcDbVoidPtrArray entitySet;
            myEntity::cast(ent)->getRLpoints(entpoints);//得到自定义实体上的两点
       startpt=entpoints;
endpt=entpoints;
            otherseg.set(startpt,endpt);
            thisseg.intersectWith(otherseg, pt1);
points.append(pt1);
}
   }
    return Acad::eOk;
}

zfbj 发表于 2003-6-3 10:56:00

我的总结:
    1.在工具栏中需要添加组合框的位置添加一个按钮,分配一个ID,例如IDC_COMBOX。
    2.使用VC的类向导,创建一个以CToolBar为基类的新类CComboToolBar。然后在文件编辑器中打开
ComboToolBar.h和ComboToolBar.cpp文件,把CComboToolBar基类改为CToolBar。(这是由于类向导不支持
以CToolBar为基类创建新类)
    3.在新类中加入公有的成员变量CComboBox m_combox。
    4.将CMainFrame类中的工具栏成员变量m_wndToolBar的类型由CToolBar改为CComboToolBar。编辑应
用程序向导已经生成好的函数int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct),这个函数
通常用来产生工具条和状态条,在创建工具条的函数后加入以下代码:
    CRect rect;
    //设置组合框的宽度,四个参数依次为控件在工具条中的索引号、ID号、风格、宽度
    m_wndToolBar.SetButtonInfo(4, IDC_COMBOX, TBBS_SEPARATOR, 160 );
    //得到组合框的位置
    m_wndToolBar.GetItemRect(4, &rect);
    //设置组合框的高度
    rect.bottom += 100; //COMBO HEIGHT;
    //创建组合框,四个参数依次为窗口风格、组合框位置、父窗口、ID号
if(!m_wndToolBar.m_combobox.Create(CBS_DROPDOWN|WS_VISIBLE|WS_TABSTOP|CBS_AUTOHSCROLL,rect,
&m_wndToolBar, IDC_COMBOX))
      return -1;
    //在组合框中加入字符串
    m_wndToolBar.m_combobox.AddString("VC++6.0");
    m_wndToolBar.m_combobox.AddString("Hello World!");
    至此就可以编译运行这个单文档程序了,运行结果就会产生带有组合框的工具条。
    5.手工添加消息映射。在视图类头(.h)文件中加入消息响应函数的定义:
    afx_msg void OnSelchangeCombo();//响应CBN_SELCHANGE消息的函数
    afx_msg void OnEditchangeCombo();//响应CBN_EDITCHANGE消息的函数
    6.在实现(.cpp)文件中加入消息映射宏:
    BEGIN_MESSAGE_MAP(CToolComboView, CFormView)
            //{{AFX_MSG_MAP(CToolComboView)
      ON_CBN_SELCHANGE(IDC_COMBOX, OnSelchangeCombo)
            ON_CBN_EDITCHANGE(IDC_COMBOX, OnEditchangeCombo)
            //}}AFX_MSG_MAP
    END_MESSAGE_MAP()
    7.在实现(.cpp)文件中加入函数实体:
    void CCboToolView::OnSelchangeCombo()
{
      CMainFrame *pFrame = (CMainFrame*)AfxGetMainWnd();
      CString cs;
      pFrame->m_wndToolBar.m_cobobox.GetWindowText(cs);
      
      CClientDC dc(this);
      dc.TextOut(100, 100, cs);
}
void CCboToolView::OnEditchangeCombo()
{
      CMainFrame *pFrame = (CMainFrame*)AfxGetMainWnd();
      CString cs;
      pFrame->m_wndToolBar.m_cobobox.GetWindowText(cs);
      
      CClientDC dc(this);
      dc.TextOut(100, 100, cs);
}
    不要忘记,在视图类的头文件中包含框架类的实现文件(MainFrm.h)。
    这样,就完成了。这种方法还适用于向工具栏中添加编辑控件。
页: [1]
查看完整版本: AutoCAD R14上的图层选择栏即object propertiers是工具栏还是?