明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2175|回复: 4

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

[复制链接]
发表于 2003-5-26 11:09 | 显示全部楼层 |阅读模式
AutoCAD R14上的图层选择栏即object propertiers是工具栏还是对话框?我们怎样才能制做出这样的工具栏或对话框
发表于 2003-5-30 13:43 | 显示全部楼层

是工具栏,在工具栏中添加了复合框,好像是重写了Create函数。

具体的细节记不清了,回头查一下告诉你。
 楼主| 发表于 2003-5-31 15:35 | 显示全部楼层

谢过版主!各位大虾!下面为本人写的求自定义实体相交的交点,

本帖最后由 作者 于 2003-5-31 15:35:47 编辑

各位大虾!下面为本人写的求自定义实体相交的交点,
但运行时报错,请问如何才能让求自定义实体相交的交点不报错
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[0];
                endpt=entpoints[0];
              otherseg.set(startpt,endpt);
              thisseg.intersectWith(otherseg, pt1);
                points.append(pt1);
        }
   }
    return Acad::eOk;
}


 楼主| 发表于 2003-6-2 20:20 | 显示全部楼层

亲爱的版主,求求你救救我把,好可怜噢?

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[0];
endpt=entpoints[0];
              otherseg.set(startpt,endpt);
              thisseg.intersectWith(otherseg, pt1);
points.append(pt1);
}
   }
    return Acad::eOk;
}
发表于 2003-6-3 10:56 | 显示全部楼层

这样在工具栏中创建组合框(改写)

我的总结:
    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)。
    这样,就完成了。这种方法还适用于向工具栏中添加编辑控件。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-19 06:12 , Processed in 0.225287 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表