用AddShape方法插入的巧数长方形图形的方法怎么在上面添加文字

Word中插入自选图形后,如何让添加的文字布满自选图形?_百度知道
Word中插入自选图形后,如何让添加的文字布满自选图形?
我有更好的答案
  可根据图形的形状来添加文字。  如果是较胖的图形:方形、圆形,可以直接右击图形--添加文字;  如果是较瘦的图形:可以再叠加一个文本框的方法,以下详细说明:在文档中插入一个自选图形;设置自选图形的大小、形状、填充效果;在文档中插入一个文本框,改变其大小和图形相当;在文本框中输入需要的文字;双击文本框框线,打开“设置文本框格式”对话框;在“颜色的线条”选项卡下,进行如下设置:透明度:100%;线条颜色:无线条颜色拖动文本框到自选图形上,必要时可对它们进行组合。
采纳率:52%
来自团队:
这个就有点麻烦了
不要直接选择在自选图形内添加文字
而是插入一个文本框
然后再摆位置。
为您推荐:
其他类似问题
自选图形的相关知识
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。当前位置: >
WPS文字给插入的图形添加文字说明的方法步骤分享
WPS文字给插入的图形添加文字说明的方法步骤分享
来源:互联网
作者:未知
[我要评论]
友情提示:点此进去下载
&  我们在使用WPS编辑文档时,经常会给它插入图形,为了让图形更加的具有解释和说服力,往往需要给插入的图形注入文字,图形上有了说明文字不仅起到美化作用,还可以让读者对于所表达的主题意思一目了然。在插入的图形中再插入文字,这一操作并不难,简单几步便可做到,今天小编就给大家带来WPS文字给插入的图形添加文字说明的方法,一起来看看吧。
  首先切换到&插入&选项卡,单击&形状&选项组,并选择插入一个图形,本节以&心形&为例,接着在空白部分单击鼠标绘制图形,右击选择&添加文字&命令,然后输入文字,其他图形雷同。
  首先打开WPS文字中的一篇文档,把鼠标切入到功能区的&插入&选项卡,单击&形状&选项组,在出现的下拉菜单中选择插入一个图形,例如&心形&;
  此时鼠标的光标会转化为&十字&形,然后再文本的空白部分单击鼠标绘制图形,如下图所示;
  用鼠标选中绘制出的图形,点击右键,在弹出的任务菜单中,选择&添加文字&命令;
  然后等到光标定位好以后,在选中的图形中输入文字,如下图;
  依照上述步骤,依次将其他的图形插入文字,效果图如下所示;
  在插入的图形中插入文字其实是很简单的,只要你看明白了以上的步骤,相信你很快就会学会的,如果想取消插入的文字,只需用鼠标选中图形,光标定位到输入的文字的后面,按键盘上的&退格&键即可。
近期更新资讯
5321M / 客户端
2302MB / 客户端
3.71 MB / 客户端
7.3GB / 客户端
10650M / 客户端
4.87GB / 客户端
4.66 G / 客户端
4085.76M / 客户端
4.0G / 客户端
3.08 GB / 客户端
3.68 GB / 赛车竞速
282M / 射击飞行
1.95 GB / 策略战棋
11.5G / 动作冒险
169M / 赛车竞速
175 MB / 射击飞行
3.78 MB / 策略战棋
60GB / 动作冒险
5.86G / 动作冒险
568M / 动作冒险
3.25MB / 游戏辅助
11 MB / 图像处理
2.24 MB / 游戏辅助
64.72 MB / 图像处理
678 kb / 光驱工具
60.29 MB / 系统安全
227.91 MB / 系统辅助
1.33 GB / 视频处理
791 MB / 办公应用
30.4 MB / 游戏辅助word如何在插入的图形中书写文字
  有时候我们需要在WORD中画出某个图形,其实在WORD强大功能中有插入图形的功能,为此,我们一起来了解一下,并且分享一下如何在插入的图形中书写文字!PS:以2003版为例,实际上2007版的会更方便。  步骤  1、打开WORD  方法一:点击菜单里面的【 插入 】找到【 图片 】,选择【 自选图形 】  方法二:直接点击页面中的【 自选图形 】  选择自己需要的图形,然后在页面中点击,并且通过拖拉图形边框来改变大小和位置  双击图形,可以改变样式,如线条、颜色等。  如何在图形里面编辑文字?  在图形边缘点击【 右键 】选择【 编辑文字 】就可以在图形中显示光标了,然后可以输入需要的文字,全选文字还可以更改字体、颜色、位置等。  注意事项  2007版的插入自选图形的样式更加丰富。  编辑后不要忘记保存。  以上就是word如何在插入的图形中书写文字方法介绍,操作很简单的,大家按照上面步骤进行操作即可,希望这篇文章能对大家有所帮助!
最新更新栏目
您可能喜欢
大家都在搜如何在WORD绘图里添加字_百度知道
如何在WORD绘图里添加字
在word里用绘图工具画好一流程图,图中含有若干个小圆圈,想在圈内编辑文字,但是由于圆圈太小,怎么调小字体也添加不上文字,请问有什么办法?谢谢了
我有更好的答案
例如上面效果的绘制方法:1、单击插入---形状----星与旗帜----爆炸图片工具;2、拖动鼠标,在页面上绘制一个图片;3、选中图片,单击鼠标右键,在弹出的快捷菜单上选择添加文字;4、此时输入相应的文字即可。
采纳率:90%
来自团队:
方法一,直接在圆圈中输入文字。在圆圈上右击,添加文字,可以输入文字,这时,你的圆圈实际已经变成了圆形的文本框。选中该圆,格式→自选图形,文本框,将上、下、左、右值都设为0(注这是文本框文字的边界,类似于页边距,边距大,可编辑区就会小)。方法二,在文本框中输入。在文本框中输入相应的文字,将文本框设置为透明,无边框。将这个文本框套在那个圆圈上。这样做的好处,在圆圈实在太小的情况下,可以将文字显示在圆圈旁边。另外,在文本框或自选图形中输入文字,最好在格式→段落中,将“如果定义了文档网格,则对齐网格”前面的勾去掉,可使文本框或自选图形中的文字行距变窄,而且将你做的流程图拷贝到其他文档中时,不会受到该文档的网格限制而发生变化。==========================在绘图工具栏上,有一个“绘图”菜单,里面有一个命令按钮“绘图网格”,将垂直间距和水平间距都调到最小。或者将“对象与网格对齐”前的勾去掉。
本回答被提问者采纳
楼上说的非常好 我来回答问题补充。文本框如果用鼠标调整确实不精确,但是你可以这样。就是单击文本框出现框后在页面标尺上你会看到横向和竖向上都会有出现没有文本框的地方是灰色,文本框的地方是白色的,你将光标放到文本框内通过拖动标尺来调整文本框的位置会更精确,调整时还可以用ALT键来进行微调。你应该可以做好。
为您推荐:
其他类似问题
您可能关注的内容
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。03-07 创建和编辑AutoCAD实体(七) 向图形中添加文字(1)使用文字样式
Add Text to Drawings向图形中添加文字
Text conveys important information in yourdrawing. Use text objects for title blocks, to label parts of the drawing, togive specifications, or to make annotations.
图形中的文字可以表达重要信息。文字对象可以用于标题栏、标注图形部件、技术要求,或者注释等。
AutoCAD provides various ways to createtext. For short, simple entries, use single line text. For longer entries withinternal formatting, use multiline text (MText). Although all entered text usesthe current text style,
which establishes the default font and format settings,you can use several methods to customize the text appearance.
AutoCAD提供了多种创建文字的方式。对短小简单的实体,可以使用单行文字。对于具有内部格式的较长的实体,可以使用多行文字(MText)。尽管所有键入的文字都使用规定了默认字体和格式的当前文字式样,我们仍可以用好几种方法来定制文字的外观。
For more information about working withtext, see “Create Text” in theAutoCAD User's Guide.
更多关于使用文字的内容,参见AutoCAD用户指南中的“创建文字”。
Topics in this section本节主题:
Work with Text Styles使用文字样式
Use Single-Line Text (Text)使用单行文字
Use Multiline Text (MText)使用多行文字
Use Unicode Characters, Control Codes, and SpecialCharacters使用Unicode字符、控制码、特殊字符
Substitute Fonts替换字体
Check Spelling拼写检查
1、Workwith Text Styles使用文字样式
All text in an AutoCAD drawing has a styleassociated with it. When you enter text, AutoCAD uses the current text style,which sets the font, size, angle, orientation, and other text characteristics.You can use or modify
the default style or create and load a new style. Onceyou've created a style, you can modify its attributes or delete it when you nolonger need it.
AutoCAD图形中的所有文字都具有与之关联的样式。我们输入文字时,AutoCAD使用当前文字样式,该样式设置了文字的字体、大小、角度、方向,及其他文字特性。我们可以对默认样式进行修改,或创建并加载新样式。一旦创建了文字样式,我们就可以修改其属性,不再需要时可以将其删除。
Topics in this section本小节内容:
Createand Modify
Text Styles创建和修改文字样式
AssignFonts指定字体
UseTrueType Fonts使用TrueType字体
UseUnicode and
Big Fonts使用Unicode字体和大字体
SetText Height设置文字高度
SetObliquing Angle设置文字倾角
SetText Generation
Flag设置文字生成标志
1.1、Createand Modify Text Styles 创建和修改文字样式
New text inherits height, width factor,obliquing angle, and text generation properties from the current text style. Tocreate a text style, create a new instance of a TextStyleTableRecord object.Assign the new text style
a name using the Name property. Then open the TextStyleTableobject for write and use theAdd method to create the new text style.
新建文字从当前文字样式继承高度/宽度系数、倾斜角度、文字生成属性等。创建文字样式的步骤,首先新建一个TextStyleTableRecord对象的实例,用Name属性给新文字样式命名,然后以写方式打开TextStyleTable对象,用Add方法创建新文字样式。
Style names can contain letters, numbers,and the special characters dollar sign ($), underscore (_), and hyphen (-).AutoCAD converts the characters to uppercase. If you do not enter a style name,the new style will not
have a name.
样式名可以包含字母、数字和美元符号($)、下划线(_)、连字符(-)等特殊字符。AutoCAD会将字符均转换成大写。要是不输入样式名,新样式将没有名字。
You can modify an existing style bychanging the properties of the TextStyleTableRecord object. If you want to workwith the current text style, use theTextStyle
property of the Database object which holds the object id of the current text style.
我们可以通过修改TextStyleTableRecord对象的属性来修改现有样式。如果要使用当前文字样式,引用Database对象的TextStyle属性即可,该属性含有当前文字样式的ObjectId。
You can also update existing text of thatstyle type to reflect the changes. Use the following properties to modify aTextStyleTableRecord object:
我们还可以更新现有文字以反映出对样式的修改。使用下列属性来修改TextStyleTableRecord对象:
BigFontFileName
Specifies the special shape definition file used for anon-ASCII character set.指定用于非ASCII字符集的特殊形定义文件;
Specifies the file associated with a font (characterstyle).指定与字体关联的文件;
Specifies backward text, upside-down text, or both.指定反向文字、颠倒文字,或两者;
Specifies the typeface, bold, italic,character set, and pitch and family settings of the text style.指定字样、粗细、倾斜、字符集、间距,及文字样式的公共设置;
IsVertical
Specifies vertical or horizontal text.指定文字方向;
ObliquingAngle
Specifies the slant of the characters.
指定字符的倾斜角度;
Specifies the character height.
指定字符高度;
Specifies the expansion or compression of the characters.指定字符的缩放比例;
If you change an existing style's font ororientation, all text using that style is changed to use the new font ororientation. Changing text height, width factor, and oblique angle does notchange existing text but does
change subsequently created text objects.
如果修改了现有样式的字体或方向,使用该样式的所有文字都会更改为新的字体或方向。修改文字高/宽系数、倾角等不会更新现有文字,但会在随后创建的文字上体现所作的样式修改。
NoteThe drawing must be regenerated to see any changes to theabove properties.
注意:重新生成图形才会看到对上述属性所做的修改。
1.2、AssignFonts 指定字体
Fonts define the shapes of the textcharacters that make up each character set. A single font can be used by morethan one style. Use theFileName property
to set the font file for thetext style. You can assign TrueType or AutoCAD-compiled SHX fonts to a textstyle.
字体定义了构成每个字符集的字符形状。一个字体可以用于多个样式。给文字样式设置字体文件用FileName属性。我们可以给文字样式指定TrueType字体或AutoCAD编译字形字体。
Set text fonts设置文字字体
The following example gets the currentfont values using theFont property for the active text style andthen changes the typeface for the font to “PlayBill”
. To see the effects ofchanging the typeface, add some multiline or single-line text to your currentdrawing before running the example. Note that, if you don't have the PlayBillfont on your system, you need to substitute a font you do have in order forthis
example to work.
下面的例子使用当前文字样式的Font属性获取当前的字体值,然后将字体的字样修改为“PlayBill”。想看看修改字样的效果,可在运行示例代码前往当前图形中添加一些多行文字或单行文字。注意如果你的系统没有PlayBill字体,需要替换一个别的字体以确保代码能正确运行。
ImportsAutodesk.AutoCAD.Runtime
ImportsAutodesk.AutoCAD.ApplicationServices
ImportsAutodesk.AutoCAD.DatabaseServices
&CommandMethod("UpdateTextFont")&_
Public SubUpdateTextFont()
'' Get the current document and database
Dim acDoc As Document =Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
'' Start a transaction
Using acTrans As Transaction =acCurDb.TransactionManager.StartTransaction()
'' Open the current text style for write
Dim acTextStyleTblRec AsTextStyleTableRecord
acTextStyleTblRec =acTrans.GetObject(acCurDb.Textstyle, _
OpenMode.ForWrite)
'' Get the current font settings
Dim acFont AsAutodesk.AutoCAD.GraphicsInterface.FontDescriptor
acFont = acTextStyleTblRec.Font
'' Update the text style's typeface with"PlayBill"
Dim acNewFont AsAutodesk.AutoCAD.GraphicsInterface.FontDescriptor
acNewFont = New
Autodesk.AutoCAD.GraphicsInterface.FontDescriptor("PlayBill",_
acFont.Bold, _
acFont.Italic,_
acFont.CharacterSet, _
acFont.PitchAndFamily)
acTextStyleTblRec.Font = acNewFont
acDoc.Editor.Regen()
'' Save the changes and dispose of thetransaction
acTrans.Commit()
usingAutodesk.AutoCAD.R
usingAutodesk.AutoCAD.ApplicationS
usingAutodesk.AutoCAD.DatabaseS
usingAutodesk.AutoCAD.GraphicsI
[CommandMethod("UpdateTextFont")]
public static voidUpdateTextFont()
// Get the current document and database获取当前文档及数据库
Document acDoc =Application.DocumentManager.MdiActiveD
Database acCurDb = acDoc.D
// Start a transaction启动事务
using (Transaction acTrans =acCurDb.TransactionManager.StartTransaction())
// Open the current text style for write以写打开当前文字样式
TextStyleTableRecord acTextStyleTblR
acTextStyleTblRec =acTrans.GetObject(acCurDb.Textstyle,
OpenMode.ForWrite) as TextStyleTableR
// Get the current font settings获取当前字体设置
FontDescriptor acF
acFont = acTextStyleTblRec.F
// Update the text style's typeface with"PlayBill"更改字样为PlayBill
FontDescriptor acNewF
acNewFont = new FontDescriptor("PlayBill",
acFont.Bold,
acFont.Italic,
acFont.CharacterSet,
acFont.PitchAndFamily);
acTextStyleTblRec.Font = acNewF
acDoc.Editor.Regen();
// Save the changes and dispose of thetransaction保存修改,关闭事务
acTrans.Commit();
VBA/ActiveX CodeReference
Sub UpdateTextFont()
MsgBox ("Look at the textnow...")
Dim typeFace As String
Dim SavetypeFace As String
Dim Bold As Boolean
Dim Italic As Boolean
Dim charSet As Long
Dim PitchandFamily As Long
' Get the current settings to fill in the
' default values for the SetFont method
ThisDrawing.ActiveTextStyle.GetFonttypeFace, _
Bold, Italic, charSet,PitchandFamily
' Change the typeface for the font
SavetypeFace = typeFace
typeFace = "PlayBill"
ThisDrawing.ActiveTextStyle.SetFonttypeFace, _
Bold, Italic, charSet,PitchandFamily
ThisDrawing.Regen acActiveViewport
1.3、UseTrueType Fonts 使用TrueType字体
TrueType fonts always appear f however, when you plot, the TEXTFILL system variable controlswhether the fonts are filled. By default TEXTFILL is set to 1 to plot thefilled-in fonts. When you export
a drawing to PostScript(R) format andprint it on a PostScript device, the font is plotted as designed.
TrueType字体在图形中总是填充的,不过打印时系统变量TEXTFILL控制字体是否填充。默认情况下TEXTFILL变量置为 1,表示打印填充字体。当我们将图形导出为PostScript(R)格式并在PostScript(R)设备上打印时,打印出的字体就会如设计所愿。
1.4、UseUnicode and Big Fonts 使用Unicode字体和大字体
AutoCAD supports the Unicodecharacter-encoding standard. A Unicode font can contain 65,535 characters, withshapes for many languages. All of the AutoCAD SHX shape fonts that are shippedwith the product support Unicode
AutoCAD支持Unicode字符编码标准。Unicode字体包含65535个字符,可以囊括许多语言的字形。随AutoCAD软件安装的所有AutoCAD
SHX字形字体均支持Unicode字体。
The text files for some alphabets containthousands of non-ASCII characters. To accommodate such text, AutoCAD supports aspecial type of shape definition known as a Big Font file. You can set a styleto use both regular
and Big Font files. Specify normal fonts using the FileName property. Specify Big Fonts using theBigFontFileName property.
有些语言的文本文件含有成千的非ASCII字符。为了顺应这些文字,AutoCAD支持一种称为大字体文件的特殊字形定义类型。我们在设置文字样式时,使用常规字体文件和大字体文件都行。指定常规字体使用FileName属性,指定大字体使用BigFontFileName属性。
NoteFont file names cannot contain commas.
注意:字体文件名不能含有逗点。
AutoCAD allows you to specify an alternatefont to use when a specified font file cannot be located. Use the FONTALTsystem variable and theSetSystemVariable
member method of the Application tochange the alternate font used.
当指定的字体文件不能定位时,AutoCAD允许指定一个替换字体。使用系统变量FONTALT或用Application对象的SetSystemVariable成员方法来设置要使用的替换字体。
Change font files改变字体文件
The following example code changes the
FileName and BigFontFileName properties. You need to replace the pathinformation listed in this example with path and file names appropriate
foryour system.
下列示例代码修改FileName属性和BigFontFileName属性。你需要将代码中的路径信息替换成你的系统里相应的路径和文件名。
Imports Autodesk.AutoCAD.Runtime
ImportsAutodesk.AutoCAD.ApplicationServices
ImportsAutodesk.AutoCAD.DatabaseServices
&CommandMethod("ChangeFontFiles")&_
Public SubChangeFontFiles()
'' Get the current document and database
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
'' Start a transaction
Using acTrans As Transaction =acCurDb.TransactionManager.StartTransaction()
'' Open the current text style for write
Dim acTextStyleTblRec AsTextStyleTableRecord
acTextStyleTblRec =acTrans.GetObject(acCurDb.Textstyle, _
OpenMode.ForWrite)
'' Change the font files used for bothBig and Regular fonts
acTextStyleTblRec.BigFontFileName ="C:\AutoCAD\Fonts\bigfont.shx"
acTextStyleTblRec.FileName ="C:\AutoCAD\Fonts\italic.shx"
'' Save the changes and dispose of thetransaction
acTrans.Commit()
usingAutodesk.AutoCAD.R
using Autodesk.AutoCAD.ApplicationS
usingAutodesk.AutoCAD.DatabaseS
[CommandMethod("ChangeFontFiles")]
public static voidChangeFontFiles()
// Get the current document and database
Document acDoc =Application.DocumentManager.MdiActiveD
Database acCurDb = acDoc.D
// Start a transaction
using (Transaction acTrans =acCurDb.TransactionManager.StartTransaction())
// Open the current text style for write
TextStyleTableRecord acTextStyleTblR
acTextStyleTblRec =acTrans.GetObject(acCurDb.Textstyle,
OpenMode.ForWrite) as TextStyleTableR
// Change the font files used for bothBig and Regular fonts
acTextStyleTblRec.BigFontFileName ="C:/AutoCAD/Fonts/bigfont.shx";
acTextStyleTblRec.FileName ="C:/AutoCAD/Fonts/italic.shx";
// Save the changes and dispose of thetransaction
acTrans.Commit();
VBA/ActiveX Code Reference
Sub ChangeFontFiles()
ThisDrawing.ActiveTextStyle.BigFontFile = _
"C:/AutoCAD/Fonts/bigfont.shx"
ThisDrawing.ActiveTextStyle.fontFile = _
"C:/AutoCAD/Fonts/italic.shx"
1.5、SetText Height设置文字高度
Text height determines the size in drawingunits of the letters in the font you are using. The value usually representsthe size of the uppercase letters, with the exception of TrueType fonts.
文字高度确定了所使用字体的字母大小,以图形单位计。该值通常表示大写字母的大小,但 TrueType字体除外。
For TrueType fonts, the value specifiedfor text height might not represent the height of uppercase letters. The heightspecified represents the height of a capital letter plus an accent areareserved for accent marks
and other marks used in non-English languages. Therelative portion of areas assigned to capital letters and accent characters isdetermined by the font designer at the time the font is designed, and,consequently, will vary from font to font.
对于TrueType字体,文字高度值可能不表示大写字母的高度,而是大写字母的高度加上留给重音符号及用于非英语语言的其他标记的标音区域。留给大写字母和重音符号的区域的相对大小是由字体设计者在设计字体时确定的,因而会因不同的字体而异。
In addition to the height of a capitalletter and the ascent area that make up the height specified by the user,TrueType fonts have a descent area for portions of characters that extend belowthe text insertion line.
Examples of such characters are y, j, p, g, and q.
指定的文字高度除了由大写字母高度和重音区域构成外,一部分TrueType字体字符还相对插入线存在一个下沉区域,这样的字符像y、j、p、g及q等。
You specify the text height using the
TextSize property of the text style or theHeight property of a text object. This propertyaccepts positive numbers only.
设置文字高度用文字样式的TextSize属性或文字对象的Height属性。该属性只接受正数。
1.6、SetObliquing Angle设置文字倾角
The obliquing angle determines the forwardor backward slant of the text. The angle represents the offset from itsvertical axis (90 degrees). To set the obliquing angle, use theObliquingAngle
property to change a text style or theOblique property of a text object. The obliquingangle must be provided in radians. A positive angle denotes a lean to theright, a negative value will have2*PI
added to it to convert it to its positiveequivalent.
文字倾角用来确定文字的前向或后向倾斜。该角度为相对垂直轴线(90度)的偏移。设置文字倾角使用文字样式的ObliquingAngle属性或文字对象的Oblique属性。倾角单位必须是弧度,角度为正数表示向右倾斜,负数角度会加上2*PI将其转换成相应的正数角度。
Create oblique text创建倾斜文字
This example creates a single-line textobject then slants it 45 degrees.
本例创建一个单行文字对象,然后将它倾斜45度角。
ImportsAutodesk.AutoCAD.Runtime
ImportsAutodesk.AutoCAD.ApplicationServices
ImportsAutodesk.AutoCAD.DatabaseServices
ImportsAutodesk.AutoCAD.Geometry
&CommandMethod("ObliqueText")&_
Public SubObliqueText()
'' Get the current document and database
Dim acDoc As Document =Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
'' Start a transaction
Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
'' Open the Block table for read
Dim acBlkTbl As BlockTable
acBlkTbl =acTrans.GetObject(acCurDb.BlockTableId, _
OpenMode.ForRead)
'' Open the Block table record Modelspace for write
Dim acBlkTblRec As BlockTableRecord
acBlkTblRec =acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), _
OpenMode.ForWrite)
'' Create a single-line text object
Dim acText As DBText = New DBText()
acText.Position = New Point3d(3, 3, 0)
acText.Height = 0.5
acText.TextString = "Hello,World."
'' Change the oblique angle of the textobject to 45 degrees(0.707 in radians)
acText.Oblique = 0.707
acBlkTblRec.AppendEntity(acText)
acTrans.AddNewlyCreatedDBObject(acText,True)
'' Save the changes and dispose of thetransaction
acTrans.Commit()
usingAutodesk.AutoCAD.R
using Autodesk.AutoCAD.ApplicationS
usingAutodesk.AutoCAD.DatabaseS
usingAutodesk.AutoCAD.G
[CommandMethod("ObliqueText")]
public static voidObliqueText()
// Get the current document and database获取当前文档及数据库
Document acDoc = Application.DocumentManager.MdiActiveD
Database acCurDb = acDoc.D
// Start a transaction启动事务
using (Transaction acTrans =acCurDb.TransactionManager.StartTransaction())
// Open the Block table for read以读打开Block表
BlockTable acBlkT
acBlkTbl =acTrans.GetObject(acCurDb.BlockTableId,
OpenMode.ForRead) as BlockT
// Open the Block table record Modelspace for write以写打开块表记录模型空间
BlockTableRecord acBlkTblR
acBlkTblRec =acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace],
OpenMode.ForWrite) as BlockTableR
// Create a single-line text object创建一个单行文字对象
DBText acText = new DBText();
acText.Position = new Point3d(3, 3, 0);
acText.Height = 0.5;
acText.TextString = "Hello, World!";
// Change the oblique angle of the textobject to 45 degrees(0.707 in radians)修改文字对象的倾角为45度(弧度值为0.707)
acText.Oblique = 0.707;
acBlkTblRec.AppendEntity(acText);
acTrans.AddNewlyCreatedDBObject(acText,true);
// Save the changes and dispose of thetransaction保存修改,关闭事务
acTrans.Commit();
VBA/ActiveX Code Reference
Sub ObliqueText()
Dim textObj As AcadText
Dim textString As String
Dim insertionPoint(0 To 2) As Double
Dim height As Double
' Define the text object
textString = "Hello, World."
insertionPoint(0) = 3
insertionPoint(1) = 3
insertionPoint(2) = 0
height = 0.5
' Create the text object in model space
Set textObj = ThisDrawing.ModelSpace. _
AddText(textString,insertionPoint, height)
' Change the value of the ObliqueAngle
' to 45 degrees (.707 radians)
textObj.ObliqueAngle = 0.707
textObj.Update
1.7、SetText Generation Flag设置文字生成标志
The text generation flag specifies if textis displayed backwards or upside-down. Use theFlagBits property to define if a text stylecontrols the display
of text to be displayed backwards or upside-down, or usetheIsMirroredInX andIsMirroredInY properties of a text object to control
individuallycontrol a text object.
文字生成标志用来表示文字是否反向显示或倒置显示。可以用文字样式的FlagBits属性定义文字样式是否控制文字按反向或倒置显示,或者用文字对象的IsMirroredInX属性和IsMirroredInY属性单独对某个文字对象进行控制。
Set FlagBits to 2 if you want text to be displayedbackwards and 4 if it should be displayed upside-down. Use a value of 6 todisplay text both backwards
and upside-down. If you are modifying a textobject, set IsMirroredInX toTRUE if you want the text to appear backwardsand setIsMirroredInY
to TRUE if you want it to be displayed upside-down.
如果要反向显示文字,设置FlagBits为2;如果要倒置显示文字,设置FlagBits为4。FlagBits为6表示同时反向和倒置显示文字。要修改一个文字对象时,将IsMirroredInX属性置为TRUE表示反向显示文字,将IsMirroredInY属性置为TRUE表示倒置显示文字。
Display text backwards反向显示文字
The following example creates asingle-line text object, then sets it to be displayed backwards using theIsMirroredInX property.
下面的代码先创建一个单行文字对象,然后使用IsMirroredInX属性将其设置为反向显示。
ImportsAutodesk.AutoCAD.Runtime
ImportsAutodesk.AutoCAD.ApplicationServices
ImportsAutodesk.AutoCAD.DatabaseServices
ImportsAutodesk.AutoCAD.Geometry
&CommandMethod("BackwardsText")&_
Public SubBackwardsText()
'' Get the current document and database
Dim acDoc As Document =Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
'' Start a transaction
Using acTrans As Transaction =acCurDb.TransactionManager.StartTransaction()
'' Open the Block table for read
Dim acBlkTbl As BlockTable
acBlkTbl =acTrans.GetObject(acCurDb.BlockTableId, _
OpenMode.ForRead)
'' Open the Block table record Modelspace for write
Dim acBlkTblRec As BlockTableRecord
acBlkTblRec =acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), _
OpenMode.ForWrite)
'' Create a single-line text object
Dim acText As DBText = New DBText()
acText.Position = New Point3d(3, 3, 0)
acText.Height = 0.5
acText.TextString = "Hello,World."
'' Display the text backwards
acText.IsMirroredInX = True
acBlkTblRec.AppendEntity(acText)
acTrans.AddNewlyCreatedDBObject(acText,True)
'' Save the changes and dispose of thetransaction
acTrans.Commit()
using Autodesk.AutoCAD.R
usingAutodesk.AutoCAD.ApplicationS
usingAutodesk.AutoCAD.DatabaseS
usingAutodesk.AutoCAD.G
[CommandMethod("BackwardsText")]
public static voidBackwardsText()
// Get the current document and database获取文档及数据库
Document acDoc =Application.DocumentManager.MdiActiveD
Database acCurDb = acDoc.D
// Start a transaction启动事务
using (Transaction acTrans =acCurDb.TransactionManager.StartTransaction())
// Open the Block table for read以读的方式打开Block表
BlockTable acBlkT
acBlkTbl =acTrans.GetObject(acCurDb.BlockTableId,
OpenMode.ForRead) as BlockT
// Open the Block table record Modelspace for write以写的方式打开Block表的记录模型空间
BlockTableRecord acBlkTblR
acBlkTblRec =acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace],
OpenMode.ForWrite) as BlockTableR
// Create a single-line text object创建一个单行文字对象
DBText acText = new DBText();
acText.Position = new Point3d(3, 3, 0);
acText.Height = 0.5;
acText.TextString = "Hello,World.";
// Display the text backwards反向显示文字
acText.IsMirroredInX =
acBlkTblRec.AppendEntity(acText);
acTrans.AddNewlyCreatedDBObject(acText,true);
// Save the changes and dispose of thetransaction保存修改,关闭事务
acTrans.Commit();
VBA/ActiveX Code Reference
Sub BackwardsText()
Dim textObj As AcadText
Dim textString As String
Dim insertionPoint(0 To 2) As Double
Dim height As Double
'Create the text object
textString = "Hello, World."
insertionPoint(0) = 3
insertionPoint(1) = 3
insertionPoint(2) = 0
height = 0.5
Set textObj = ThisDrawing.ModelSpace. _
AddText(textString,insertionPoint, height)
' Change the value of theTextGenerationFlag
textObj.TextGenerationFlag =acTextFlagBackward
textObj.Update
没有更多推荐了,

我要回帖

更多关于 图形创意方法 的文章

 

随机推荐