会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
hbyelang
博客园
首页
新随笔
联系
管理
订阅
文字样式表的管理
Code
1
public
static
ObjectId SetFontStyle(
string
strTextStyleName)
2
{
3
ObjectId objID;
//
文字样式表的样式
4
Database m_db
=
HostApplicationServices.WorkingDatabase;
5
DocumentLock docLock
=
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
6
using
(Transaction m_tr
=
m_db.TransactionManager.StartTransaction())
7
{
8
TextStyleTable tst
=
(TextStyleTable)m_tr.GetObject(m_db.TextStyleTableId, OpenMode.ForWrite);
9
10
if
(tst.Has(strTextStyleName))
11
{
12
objID
=
tst[strTextStyleName];
13
TextStyleTableRecord tstr
=
(TextStyleTableRecord)m_tr.GetObject(objID, OpenMode.ForWrite);
14
string
str1
=
tstr.BigFontFileName;
15
string
str2
=
tstr.FileName;
16
}
17
else
18
{
19
TextStyleTableRecord tstr
=
new
TextStyleTableRecord();
20
tstr.Name
=
strTextStyleName;
21
22
tstr.BigFontFileName
=
"
gbcbig.shx
"
;
23
//
tstr.FileName = "SimSun.ttf";
//
字体名
24
tstr.FileName
=
"
gbenor.shx
"
;
//
字体名
25
//
Returns with file name pointing to a copy of the name of the font file for this text style
26
//
返回一个指向文字文件名称的拷贝的名称,用于文字样式
27
28
tstr.TextSize
=
200
;
29
tst.Add(tstr);
30
m_tr.AddNewlyCreatedDBObject(tstr,
true
);
31
m_tr.Commit();
32
objID
=
tst[strTextStyleName];
33
m_db.Textstyle
=
objID;
34
}
35
36
}
37
docLock.Dispose();
38
return
objID;
39
}
posted @
2009-04-23 08:21
野狼的天空
阅读(
187
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告