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

  • 相关阅读:
    转化磁盘格式 FATS > NTFS
    hzgb2312 转码工具
    关于南空调,北暖气
    BSTR、_bstr_t与CComBSTR
    string 转化为其他类型
    VARIANT 、_variant_t 与 COleVariant
    恐怖级算法题目一【据说是百度的面试题】
    谈论下各大公司的网络游戏
    chinacloud,记录自己的云计算体会
    回文数的判断
  • 原文地址:https://www.cnblogs.com/mjgw/p/12348140.html
Copyright © 2011-2022 走看看