zoukankan      html  css  js  c++  java
  • ObjectARX创建文字

    头文件

    #pragma once
    #include "StdAfx.h"
    #include "StdArx.h"
    class CDrawTexter
    {
    public:
    CDrawTexter(void);
    ~CDrawTexter(void);
    AcDbObjectId AddText(const AcGePoint3d& ptInsert, const TCHAR* text, AcDbObjectId style =
    AcDbObjectId::kNull, double height = 25, double rotation = 0);//单行文字
    AcDbObjectId AddMText(const AcGePoint3d& ptInsert, const TCHAR* text, AcDbObjectId style =
    AcDbObjectId::kNull, double height = 25, double width = 10);//多行文字
    void Draw();
    };
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    CPP文件

    #include "stdafx.h"
    #include "DrawTexter.h"


    CDrawTexter::CDrawTexter(void)
    {
    }


    CDrawTexter::~CDrawTexter(void)
    {
    }

    AcDbObjectId CDrawTexter::AddText(const AcGePoint3d& ptInsert, const TCHAR* text, AcDbObjectId style,
    double height, double rotation)
    {
    AcDbText *pText = new AcDbText(ptInsert, text, style, height, rotation);
    return AddToModelSpace(pText);
    }

    AcDbObjectId CDrawTexter::AddMText(const AcGePoint3d& ptInsert, const TCHAR* text, AcDbObjectId style,
    double height, double width)
    {
    AcDbMText *pMText = new AcDbMText;
    pMText->setTextStyle(style);
    pMText->setContents(text);
    pMText->setLocation( ptInsert);
    pMText->setTextHeight(height);
    pMText->setWidth(width);
    pMText->setAttachment(AcDbMText::kTopMid);
    return AddToModelSpace(pMText);
    }

    void CDrawTexter::Draw()
    {
    AcGePoint3d ptTemp;
    ads_getpoint(asDblArray(ptTemp),_T(" 插入文字"),asDblArray(ptTemp));
    AddText(ptTemp, _T("阿斯蒂芬斯蒂芬"));
    ptTemp.set(ptTemp.x+300, ptTemp.y+300,ptTemp.z);
    AddMText(ptTemp,_T("试试事实上事实上事实上事实上事实上事实上事实上事实上事实上事实上事实上"));
    }

    原文链接:https://blog.csdn.net/sky79/article/details/47401225

  • 相关阅读:
    Merge k Sorted Lists
    N-Queens
    N-Queens II
    Reorder List
    使用AJAX实现文件上传时Illegal invocation错误
    php页面开启错误提示
    php分割最后一个逗号后面的字符
    微信卡券添加(微擎系统)
    php请求php
    Navicat MySQL连接Linux下MySQL的问题解决方案
  • 原文地址:https://www.cnblogs.com/mjgw/p/12348140.html
Copyright © 2011-2022 走看看