Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Here is the code


VB
Class MainWindow

    Protected Overrides Sub OnContentRendered(e As System.EventArgs)
        MyBase.OnContentRendered(e)

        Dim sp As New StackPanel
        Dim sc As New ScrollViewer

        Dim btn As New Button
        btn.Content = "Hoi-1"
        btn.Tag = "25"
        btn.Height = 50
        btn.Width = 100
        sp.Children.Add(btn)

        AddHandler btn.Click, AddressOf btnClick

        CV.Children.Add(sp)

        btn = New Button
        btn.Content = "Hoi-2"
        btn.Tag = "35"
        btn.Height = 50
        btn.Width = 100
        sp.Children.Add(btn)

        AddHandler btn.Click, AddressOf btnClick


    End Sub

    Private Sub btnClick(sender As Object, e As RoutedEventArgs)
        Dim item As Button = DirectCast(sender, Button)

        Debug.Print(item.Tag)
        Debug.Print(item.Height)
        Debug.Print(item.Width)


    End Sub

End Class





SQL
If I press a button I end up in the event BtnClick.
I want toknow what the top and left value is of the button.

Thank you.
Posted
Updated 22-Apr-13 0:23am
v2
Comments
quator 22-Apr-13 6:35am    
Behind the button that I have pressed I want to show one or more other controls. Therefor I needed the top value of the button.

Quator

1 solution

top and left property of button relates with positioning of control on form...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900