![]() |
#1
|
||||
|
||||
![]()
I don’t like rulers (they eat up workspace) so I always keep them off, and if I need new guide, I press “h” or “v” (horizontal/vertical) and new guide appears in cursor position. Magic!
Public Type lpPoint x As Long y As Long End Type Public Declare Function GetCursorPos Lib "user32" (ByRef pos As lpPoint) As Boolean Sub DrawGuideHorizontal() Dim p As lpPoint, x As Double, y As Double, l As Layer GetCursorPos p ActiveDocument.ActiveWindow.ScreenToDocument p.x, p.y, x, y Set l = ActiveLayer ActiveDocument.ActivePage.Layers("Guides").CreateGuide x, y, x + 1, y l.Activate End Sub Sub DrawGuideVertical() Dim p As lpPoint, x As Double, y As Double, l As Layer GetCursorPos p ActiveDocument.ActiveWindow.ScreenToDocument p.x, p.y, x, y Set l = ActiveLayer ActiveDocument.ActivePage.Layers("Guides").CreateGuide x, y, x, y + 1 l.Activate End Sub |
#2
|
||||
|
||||
![]()
Very good! And handy. I'm sure other people would find these macros useful.
I would suggest to put your code in the "CODE" tags for better readability. Like that: Code:
Public Type lpPoint x As Long y As Long End Type Public Declare Function GetCursorPos Lib "user32" (ByRef pos As lpPoint) As Boolean Sub DrawGuideHorizontal() Dim p As lpPoint, x As Double, y As Double, l As Layer GetCursorPos p ActiveDocument.ActiveWindow.ScreenToDocument p.x, p.y, x, y Set l = ActiveLayer ActiveDocument.ActivePage.Layers("Guides").CreateGuide x, y, x + 1, y l.Activate End Sub Sub DrawGuideVertical() Dim p As lpPoint, x As Double, y As Double, l As Layer GetCursorPos p ActiveDocument.ActiveWindow.ScreenToDocument p.x, p.y, x, y Set l = ActiveLayer ActiveDocument.ActivePage.Layers("Guides").CreateGuide x, y, x, y + 1 l.Activate End Sub Code:
ActivePage.Layers("Guides").CreateGuide x, y, 0 ' Horizontal ActivePage.Layers("Guides").CreateGuide x, y, 90 ' Vertical ![]() Last edited by Alex; 16-06-2005 at 11:10. |
#3
|
||||
|
||||
![]()
That is a great idea. I think it will come in handy. I use guides a ton. So here is some code in return, although i am sure you have allready thought of it.
This is an easy way to delete all the guidelines on your page: Code:
Sub DeleteAllGuides() ActiveDocument.MasterPage.Guides(cdrAllGuides).Delete End Sub Shelby |
#4
|
||||
|
||||
![]()
Is there a typo here Alex?
Quote:
Code:
ActivePage.Layers("Guides").CreateGuideAngle x, y, 0 ' Horizontal ActivePage.Layers("Guides").CreateGuideAngle x, y, 90 ' Vertical
__________________
Sean Waiting for a ride in the T.A.R.D.I.S. |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Delete All Guides | shelbym | CorelDRAW/Corel DESIGNER VBA | 3 | 22-10-2004 18:36 |
Deleting Shapes on the Guides Layer | Rick Randall | CorelDRAW/Corel DESIGNER VBA | 2 | 28-09-2004 12:07 |
Bounding Guides, with & without Outlines | Hernán | New product ideas | 0 | 21-01-2004 11:59 |
Bounding Guides for CorelDRAW 11 | Hernán | Macros/Add-ons | 1 | 15-07-2003 00:56 |