{"id":1415,"date":"2023-08-06T11:48:12","date_gmt":"2023-08-06T03:48:12","guid":{"rendered":"https:\/\/lyvba.com\/?p=1415"},"modified":"2023-08-06T11:48:12","modified_gmt":"2023-08-06T03:48:12","slug":"vbabox-01","status":"publish","type":"post","link":"https:\/\/lyvba.com\/index.php\/2023\/08\/06\/vbabox-01\/","title":{"rendered":"CorelDRAW VBA \u7b80\u5355\u4ee3\u7801\u5b9e\u73b0\u7ed8\u5236\u76d2\u5b50-\u4e0a\u7bc7"},"content":{"rendered":"<h3>\u524d\u4e24\u5929\u5728\u672c\u8bba\u575b\u770b\u5230\u7f51\u53cb\uff0c\u95ee\u600e\u4e48\u7ed8\u5236\u5982\u4e0b\u56fe\u7b80\u5355\u7684\u5c01\u5957\u76d2\u5b50\u3002\u6240\u4ee5\u6709\u4e86\u601d\u8def\uff0c\u5c31\u52a8\u624b\u5199\u4e86\u4ee3\u7801<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2023\/08\/box1.png\" alt=\"\" \/><\/p>\n<pre><code class=\"language-bas\">Public Function Simple_box_one()\n  ActiveDocument.Unit = cdrMillimeter\n  l = 100: w = 50: h = 70: b = 15\n  boxL = 2 * l + 2 * w + b\n  boxH = h\n  l1x = w\n  l2x = w + l\n  l3x = 2 * w + l\n  l4x = 2 * (w + l)\n\n  Set Rect = ActiveLayer.CreateRectangle(0, 0, boxL, boxH)\n  Set sl1 = DrawLine(l1x, 0, l1x, h)\n  Set sl2 = DrawLine(l2x, 0, l2x, h)\n  Set sl3 = DrawLine(l3x, 0, l3x, h)\n  Set sl4 = DrawLine(l4x, 0, l4x, h)\nEnd Function<\/code><\/pre>\n<h3>\u4ee3\u7801\u4e2d\u7684\u516c\u5f0f\uff0c\u4e0d\u7528\u521d\u4e2d\u77e5\u8bc6\u5e94\u8be5\u5c31\u53ef\u4ee5\u7406\u89e3\u7684\u3002\u5c31\u662f\u8ba1\u7b97\u77e9\u5f62\u591a\u5927\uff0c\u7ed8\u52364\u6761\u7ebf\uff0c\u628a\u7ebf\u79fb\u52a8\u5230\u6b63\u786e\u7684\u4f4d\u7f6e<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2023\/08\/box2.png\" alt=\"\" \/><\/p>\n<pre><code>Public Function Simple_box_two()\n  ActiveDocument.Unit = cdrMillimeter\n  l = 100: w = 50: h = 70: b = 15\n  boxL = 2 * l + 2 * w + b: boxH = h\n  l1x = w: l2x = w + l: l3x = 2 * w + l: l4x = 2 * (w + l)\n\n  Set mainRect = ActiveLayer.CreateRectangle(0, 0, boxL, boxH)\n\n  Set topRect = ActiveLayer.CreateRectangle(0, 0, l, w)\n  topRect.Move l1x, h\n  Set bottomRect = ActiveLayer.CreateRectangle(0, 0, l, w)\n  bottomRect.Move l3x, -w\n\n  Set sl1 = DrawLine(l1x, 0, l1x, h)\n  Set sl2 = DrawLine(l2x, 0, l2x, h)\n  Set sl3 = DrawLine(l3x, 0, l3x, h)\n  Set sl4 = DrawLine(l4x, 0, l4x, h)\nEnd Function<\/code><\/pre>\n<h3>\u7ed8\u5236\u7ebf\u6761\u7684\u4ee3\u7801\u5199\u6210\u51fd\u6570\u8c03\u7528\uff0c\u53ef\u4ee5\u8bbe\u7f6e\u989c\u8272\u6216\u8005\u7c97\u7ec6<\/h3>\n<pre><code>&#039;\/\/ \u753b\u4e00\u6761\u7ebf\uff0c\u8bbe\u7f6e\u8f6e\u5ed3\u8272 M100\nPrivate Function DrawLine(X1, Y1, X2, Y2) As Shape\n  Set DrawLine = ActiveLayer.CreateLineSegment(X1, Y1, X2, Y2)\n  DrawLine.Outline.SetProperties Color:=CreateCMYKColor(0, 100, 0, 0)\nEnd Function<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u4e24\u5929\u5728\u672c\u8bba\u575b\u770b\u5230\u7f51\u53cb\uff0c\u95ee\u600e\u4e48\u7ed8\u5236\u5982\u4e0b\u56fe\u7b80\u5355\u7684\u5c01\u5957\u76d2\u5b50\u3002\u6240\u4ee5\u6709\u4e86\u601d\u8def\uff0c\u5c31\u52a8\u624b\u5199\u4e86\u4ee3\u7801 Public  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1412,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[74,67],"class_list":["post-1415","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-learn","tag-coreldraw","tag-vba"],"_links":{"self":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1415","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/comments?post=1415"}],"version-history":[{"count":1,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1415\/revisions"}],"predecessor-version":[{"id":1418,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1415\/revisions\/1418"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/media\/1412"}],"wp:attachment":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/media?parent=1415"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/categories?post=1415"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/tags?post=1415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}