API Documentation > CorelDRAW > 2025-v26 > Document > IVGDocument
Document.GetUserArea method
Allows a user to specify a rectangular area by dragging. Returns top left and bottom right x,y coordinatesa and information about the state of the modifier keys, CTRL, ALT and SHIFT keys at the moment of click
Syntax:
Function GetUserArea(ByRef x1 As Double, ByRef y1 As Double, ByRef x2 As Double, ByRef y2 As Double, ByRef ShiftState As Long, ByVal TimeOut As Long, ByVal Snap As Boolean, ByVal CursorShape As cdrCursorShape) As Long
Parameters:
Name Type Description
x1
Double
y1
Double
x2
Double
y2
Double
ShiftState
Long
TimeOut
Long
Snap
Boolean
CursorShape
Remarks:
The GetUserArea method allows the user to specify a rectangular area in the document window (marquee selection). It also retrieves information about the state of the Ctrl, Shift, and Alt keys at the time of the selection.
Examples:
The following VBA example allows the user to select a rectangular area and then creates a rectangle with dimensions specified by the selection. If the user pressed Shift while making the selection, the rectangle receives round corners
Sub Test()
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
Dim cr As Long, cg As Long, cb As Long
b = ActiveDocument.GetUserArea(x1, y1, x2, y2, Shift, 10, False, cdrCursorEyeDrop)
If Not b Then
  Set s = ActiveDocument.ActiveLayer.CreateRectangle(x1, y1, x2, y2)
  If (Shift And 1) <> 0 Then ' Shift pressed

 s.Rectangle.SetRoundness 50
  End If
End If 
End Sub