GetSectionFromPoint

Returns the section name at a specified point and converts the point coordinates to section relative coordinates. Returns empty when the specified point is not within a section area.

Syntax

[sectionName = ]object.GetSectionFromPoint(x As Single, y As Single)

The GetSectionFromPoint method syntax has the following parts:

Part Description
object A valid ARDesigner object.
x, y Single - Specifies the point coordinates of which to retrieve the section name. The values are converted to section relative coordinates on return from the method.
sectionName String - Returns the section name that is at the specified point coordinates.

Returns

String

Example

Private deltax As Single, deltay As Single
' This code implements a label Drag Drop on the designer control.
' It adds a new control at the dropped location.
Private Sub ard_DragDrop(Source As Control, X As Single, Y As Single)
Dim sSec As String
Dim secTarget As Object
Dim ctl As Object
 
X = X - deltax
Y = Y - deltay
 
sSec = ard.GetSectionFromPoint(X, Y)
If sSec <> "" Then
Set secTarget = ard.Report.Sections(sSec)
Set ctl = secTarget.Controls.Add("DDActiveReports2.Label")
ctl.Left = X
ctl.Top = Y
ctl.Width = lblDrag.Width
ctl.Height = lblDrag.Height
ctl.BackStyle = 1
ctl.BackColor = &HC0C0FF
If (ctl.Left + ctl.Width) > ard.Report.PrintWidth Then
ard.Report.PrintWidth = ctl.Left + ctl.Width
End If
If (ctl.Top + ctl.Height) > secTarget.Height Then
secTarget.Height = ctl.Top + ctl.Height
End If
End If
End Sub
 
Private Sub ard_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
Dim sSec As String
X = X - deltax
Y = Y - deltay
 
sSec = ard.GetSectionFromPoint(X, Y)
lstState.AddItem sSec & " : " & Str$(X) & "," & Str$(Y)
End Sub

Remarks

This method is used when adding controls into specific sections using drag and drop events.