![]() |
#11
|
||||
|
||||
![]()
Well, control arrays are not supported by VBA and there is nothing Corel can do about it. It's the VBA's limitation and not the host application's. And I really doubt that Microsoft would do anything about it either because in VB.NET control arrays are not supported either...
|
#12
|
|||
|
|||
![]()
Maybe set or, at least, query the Options/Edit/Constrain angle from VBA? Which is the similar doc or app (workspace?) property?
|
#13
|
|||
|
|||
![]() Quote:
|
#14
|
||||
|
||||
![]() Quote:
Code:
?ActiveDocument.ToUnits(10, cdrMillimeter) 0.393700787401575 ?ActiveDocument.FromUnits(10, cdrMillimeter) 254 |
#15
|
|||
|
|||
![]()
Well, thanks. That was ambiguous for me just because I confused with CorelScriptTools.ToCentimeter etc.
|
#16
|
|||
|
|||
![]()
Uh, oh! Just a one more quick question! What are the limits of Draw even in vba for size and position (in tenthmicron), what a user may input on a form, such the sizing and positioning happens exactly by that values? Are they depends on the position of the rulers zeropoint (think so, but I'm not sure) or the rulers units, pagesize or any else? Shortly: has the desktop a limited size?
|
#18
|
|||
|
|||
![]()
Thanks for the quick answer!
|
#19
|
|||
|
|||
![]()
For that reason there is an example forms code to nudge. It will warning and stop the action, if you try move any shape or its detail out of desktop with macro (like the user interface). For try, insert the codes to a User form what has two textboxes named InputXNudge and InputYNudge, and a commandbutton named OKButton. If the last function TooLargeValue inserted as public to another codemodul, then usable from any macros. Works only in CDR.12 (or higher) because the Document.FromUnit not in lower.
Code:
Private Sub InputXNudge_Exit(ByVal Cancel As MSForms.ReturnBoolean) Cancel = ValidateInput(InputXNudge, 0) End Sub Private Sub InputYNudge_Exit(ByVal Cancel As MSForms.ReturnBoolean) Cancel = ValidateInput(InputYNudge, 1) End Sub Private Sub OKButton_Click() Dim sr As ShapeRange, XNudge As Double, YNudge As Double If ActiveSelection Is Nothing Then MsgBox "First you must select some shape to nudge...", vbCritical Exit Sub End If Set sr = ActiveSelectionRange If Not IsNumeric(InputXNudge) Then InputXNudge = "0" XNudge = CDbl(InputXNudge) If Not IsNumeric(InputYNudge) Then InputYNudge = "0" YNudge = CDbl(InputYNudge) If XNudge < 0 Then If YNudge < 0 Then ActiveDocument.ReferencePoint = cdrBottomLeft Else ActiveDocument.ReferencePoint = cdrTopLeft End If Else If YNudge < 0 Then ActiveDocument.ReferencePoint = cdrBottomRight Else ActiveDocument.ReferencePoint = cdrTopRight End If End If If TooLargeValue(sr.PositionX + XNudge, 0) Then MsgBox "Horizontal nudge not allowed, because to out of desktop.", vbCritical, "Input error" Exit Sub ElseIf TooLargeValue(sr.PositionY + YNudge, 1) Then MsgBox "Vertical nudge not allowed, because to out of desktop.", vbCritical, "Input error" Exit Sub End If sr.Move XNudge, YNudge End Sub Private Function ValidateInput(cInput As TextBox, Direction As Integer) As Boolean If Trim(cInput) = "" Then cInput = 0 ElseIf Not IsNumeric(cInput) Then MsgBox "Mistyped...", vbExclamation + vbMsgBoxSetForeground, "Input error" ValidateInput = True ElseIf TooLargeValue(cInput, Direction) Then MsgBox "Ssshh... to much!", vbCritical + vbMsgBoxSetForeground, "Input error" ValidateInput = True End If End Function Private Function TooLargeValue(cInput As Variant, Direction As Integer) As Boolean Dim LowLimit As Double, HighLimit As Double, cValue As Double If Direction = 0 Then 'Horizontal HighLimit = -1 * ActiveDocument.FromUnit(ActiveDocument.DrawingOriginX, cdrTenthMicron) Else 'Vertical HighLimit = -1 * ActiveDocument.FromUnit(ActiveDocument.DrawingOriginY, cdrTenthMicron) End If LowLimit = HighLimit - 228600000# HighLimit = HighLimit + 228600000# cValue = ActiveDocument.FromUnit(CDbl(cInput), cdrTenthMicron) If LowLimit > cValue Or cValue > HighLimit Then TooLargeValue = True End Function Last edited by petig; 29-10-2005 at 07:58. Reason: A little mistype... |
![]() |
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 |
Where to begin with CorelDRAW and VBA | shelbym | CorelDRAW/Corel DESIGNER VBA | 2 | 03-04-2007 10:15 |
delete vba project from cdr file | hotairballoon | CorelDRAW/Corel DESIGNER VBA | 1 | 18-05-2005 10:08 |
CD 10, VBA not returning true outline width | Webster | CorelDRAW/Corel DESIGNER VBA | 1 | 24-11-2004 18:09 |
VBA does not work with my CD 10 ! | jobar | CorelDRAW/Corel DESIGNER VBA | 1 | 24-08-2003 13:38 |
Detect if VBA is installed (an answer and a question) | reanan | CorelDRAW/Corel DESIGNER VBA | 3 | 04-12-2002 15:35 |