如何绘图制一个图象标记对象?
VB开发|黄洪辉|2018-05-30 10:08
-
回答:
Private Sub DrawImageMarkImp() 'Dim mxUtility As MxDrawXLib.MxDrawUtility 'Set mxUtility = New MxDrawXLib.MxDrawUtility 'Dim getPt1 As MxDrawXLib.MxDrawPoint 'Set getPt1 = mxUtility.GetPoint(, Chr(13) + Chr(10) + "点取插入点:") 'If (getPt1 Is Nothing) Then ' MsgBox "用户取消.." ' Exit Sub 'End If ' 定义调用动态取点的函数参数 Dim getParam As MxDrawXLib.MxDrawResbuf Set getParam = New MxDrawXLib.MxDrawResbuf '动态拖放时显示的图片 getParam.AddString MxDrawX1.GetOcxAppPath + "\mxdraw.png" '图片显示缩放比例 getParam.AddDouble 0.4 Dim retParam As MxDrawXLib.MxDrawResbuf '开始态拖放取点 Set retParam = MxDrawX1.CallEx("ExApp_GetImageMarkPosition", getParam) If retParam.AtString(0) <> "Ok" Then Exit Sub End If Dim param As MxDrawXLib.MxDrawResbuf Set param = New MxDrawXLib.MxDrawResbuf '第一个参数,图形的文件名 param.AddString MxDrawX1.GetOcxAppPath + "\mxdraw.png" '第二个参数,插入点的x坐标 param.AddDouble retParam.AtDouble(1) '第三个参数,插入点的x坐标 param.AddDouble retParam.AtDouble(2) '第四个参数,图形缩放比例 param.AddDouble 0.4 '第五个参数,图片在绘图时,是否参于打印,出图 param.AddLong 1 '第6个参数,图片显示时,是否绘制它的在文档中的外框标记 param.AddLong 0 '第7个参数,图片在数据库中的宽度 param.AddDouble 30 '第8个参数,图片在数据库中的高度 param.AddDouble 30 '第9个参数,闪烁时使用的image param.AddString MxDrawX1.GetOcxAppPath + "\mxdrawt.png" '第10个参数,标文字内容 param.AddString "Text" '第11个参数,标文字高度 param.AddDouble 20 '第12个参数,标文字的CAD颜色索引,颜色1为红色,具体颜色索引为多少是什么颜色,可以参数AutoCAD说明 param.AddLong 1 '调用插入图形标记函数 MxDrawX1.CallEx "Mx_DrawImageMark", param End Sub