当前位置: 首页 > news >正文

CoreDraw的几个VBA代码

Sub SaveTextOnly() '备份文本
    Dim p As Page
    Dim nPos As Long
    Dim strName As String
    Dim srAllShapes As New ShapeRange
   
    For Each p In ActiveDocument.Pages
        srAllShapes.AddRange p.Shapes.FindShapes() 'Add each shape to our ShapeRange
    Next p
   
    srAllShapes.RemoveRange srAllShapes.FindAnyOfType(cdrGroupShape, cdrTextShape) 'Remove any groups and Text Objects
    srAllShapes.Delete 'Delete the ShapeRange now contaning all shapes but Text
   
    'Get the FileName of the ActiveDocument
    strName = ActiveDocument.FileName
    nPos = InStrRev(strName, ".")
    If nPos > 0 Then strName = Left(strName, nPos - 1)
    strName = ActiveDocument.FilePath & strName & " - Text Backup.cdr" 'New name for Document
   
    ActiveDocument.SaveAs strName 'Save the Document with new name
End Sub

Sub s删外框改尺寸()
Dim d As Document
Dim p As Page
Dim s As Shape
For Each d In Documents
d.Unit = cdrMillimeter
d.ReferencePoint = cdrCenter
d.MasterPage.GuidesLayer.Shapes.All.Delete
    For Each p In d.Pages
      For Each s In p.Shapes.FindShapes(, cdrCurveShape)
      If s.SizeHeight > 235 Then
      s.Delete
      End If
      Next s
p.Shapes.All.SetSize 170, 240
p.Shapes.All.Group
p.Shapes.All.AlignToPageCenter cdrAlignVCenter + cdrAlignHCenter
p.Shapes.All.Ungroup
   Next p
Next d
End Sub
Sub fgym() '分割页面中所有图像
    On Error GoTo 10
    Dim s1 As Shape, s2 As Shape, p As Page
    For Each p In ActiveDocument.Pages
        Set s1 = p.Shapes.FindShapes(, cdrBitmapShape).Group
        '设置一个容器
        Set s2 = p.ActiveLayer.CreateGridBoxes(0, p.SizeHeight, p.SizeWidth, 0, 2, 1)
        s2.Fill.ApplyNoFill
        s2.Outline.Width = 0
        s1.AddToPowerClip s2, cdrFalse
        s2.OrderToBack
        s2.Ungroup
    Next p
10 End Sub
Sub tr选框删物()
Dim x1 As Double, y1 As Double, x2 As Double, y2 As Double
Dim Shift As Long
Dim b As Boolean
Dim s As Shape, os As Shape, ts As Shape, s1 As Shape
Dim cr As Long, cg As Long, cb As Long
ActiveDocument.BeginCommandGroup "置入容器做修剪" '设定还原步骤

b = ActiveDocument.GetUserArea(x1, y1, x2, y2, Shift, 10, False, 428)
    If Not b Then
        ActivePage.SelectShapesFromRectangle x1, y1, x2, y2, True
        Set s = ActiveSelection.Group
        Set os = ActiveSelection.CustomCommand("Boundary", "CreateBoundary")
            os.Outline.Width = 0
        Set ts = ActiveDocument.ActiveLayer.CreateRectangle(x1, y1, x2, y2)
        Set s1 = ts.Trim(os, True, True)
            ts.Delete
            os.Delete
            s.AddToPowerClip s1, cdrFalse
            SendKeys "{ESC}", True
   End If
ActiveDocument.EndCommandGroup
End Sub
Sub bmptrace把图片转成矢量图()
Dim b As Bitmap
Dim trace As TraceSettings
On Error Resume Next
If ActiveShape.Type <> cdrBitmapShape Or ActiveSelection.Shapes.Count <> 1 Then
MsgBox "请先选择一个要转成矢量的点阵图": Exit Sub
End If
Set b = ActiveShape.Bitmap
Set trace = b.trace(cdrTraceClipart, RemoveBackground:=False)

        trace.Finish
End Sub

相关文章:

  • 在Powerpoint中插入FLV视频
  • Windows 7/Vista/XP简明测试数据
  • PowerDesigner使用教程 —— 概念数据模型
  • 《ASP.NET夜话》一书勘错表及本人工作情况汇报
  • Silverlight子窗口(ChildWindow)传递参数到父窗口演示
  • 中小型企业监控方案之分析
  • BGP/MPLS ×××配置实验
  • {$POINTERMATH ON} 方便指针操作的编译指令
  • SMS系列之九:SMS实现软件计数
  • 转Linux 终端中文乱码解决方法
  • VISTA 系统无法被PING通
  • Disk2vhd
  • HP SIM 5.2 安装和初步配置
  • 一个平凡女人的内心独白
  • NA-NP-IE系列实验53:帧中继环境下BMA 模式
  • Angular 2 DI - IoC DI - 1
  • input的行数自动增减
  • Java多态
  • orm2 中文文档 3.1 模型属性
  • Python打包系统简单入门
  • Quartz初级教程
  • use Google search engine
  • vue2.0项目引入element-ui
  • WePY 在小程序性能调优上做出的探究
  • 大主子表关联的性能优化方法
  • 数组大概知多少
  • 在weex里面使用chart图表
  • Unity3D - 异步加载游戏场景与异步加载游戏资源进度条 ...
  • 如何用纯 CSS 创作一个货车 loader
  • 如何在招聘中考核.NET架构师
  • ​TypeScript都不会用,也敢说会前端?
  • $.type 怎么精确判断对象类型的 --(源码学习2)
  • (4)事件处理——(6)给.ready()回调函数传递一个参数(Passing an argument to the .ready() callback)...
  • (solr系列:一)使用tomcat部署solr服务
  • (三维重建学习)已有位姿放入colmap和3D Gaussian Splatting训练
  • (转) SpringBoot:使用spring-boot-devtools进行热部署以及不生效的问题解决
  • .Mobi域名介绍
  • .net 4.0发布后不能正常显示图片问题
  • .NET I/O 学习笔记:对文件和目录进行解压缩操作
  • .Net下使用 Geb.Video.FFMPEG 操作视频文件
  • .sh文件怎么运行_创建优化的Go镜像文件以及踩过的坑
  • @NestedConfigurationProperty 注解用法
  • [ CTF ] WriteUp- 2022年第三届“网鼎杯”网络安全大赛(朱雀组)
  • [20170728]oracle保留字.txt
  • [2019.3.5]BZOJ1934 [Shoi2007]Vote 善意的投票
  • [23] GaussianAvatars: Photorealistic Head Avatars with Rigged 3D Gaussians
  • [2669]2-2 Time类的定义
  • [BT]BUUCTF刷题第8天(3.26)
  • [bug总结]: Feign调用GET请求找不到请求体实体类
  • [c#基础]DataTable的Select方法
  • [FTP]pureftp部署和优化
  • [HJ73 计算日期到天数转换]
  • [NKCTF 2024]web解析
  • [PAT] 1041 Be Unique (20 分)Java
  • [SAP ABAP开发技术总结]面向对象OO