Element.Top



Top() As Long
ED
avaliable
RT
read only

Remarks

Returns the position of the top window border of the dynamic element in pixel. The value defines the distance from the top border of the screen.

Sample

The following example moves a Bitmap-Button down by the height of the element. If the bottom border of the picture is reached, the element is moved to the top border.

'*** Move element BITMAP_BTN_1
Public Sub LeftClickUp_Element_Move(obElem As Element)

	Dim obElement As Element
	Dim obPicture As DynPicture
	Dim nHeight As Long
	Dim nOldTop As Long

	Set obPicture = obElem.Parent.Parent
	If (obPicture Is Nothing) Then
		MsgBox "Error: Picture-object is invalid..."
		Exit Sub
	End If

	Set obElement = obPicture.Elements.Item("BITMAP_BTN_1")
	If (obElement Is Nothing) Then
		MsgBox "Error: element BITMAP_BTN_1 doesn't exists..."
		Exit Sub
	End If

	nHeight = (obElement.Bottom - obElement.Top)
	nOldTop = obElement.Top

	'*** moves element
	If (obElement.Bottom > obPicture.Height) Then
		obElement.Move obElement.Left, 0, obElement.Right, (nHeight)
	Else
		obElement.Move obElement.Left, obElement.Bottom, obElement.Right, 
(obElement.Bottom + nHeight)
	End If

	'*** update picture
	obElement.Update
	obPicture.Update obElement.Left, nOldTop, obElement.Right, 
(obElement.Bottom + nHeight)
	obElem.LeftClickUp
End Sub

See Also

Element