This is a HowTo to make a concentric centres PushButton:
create a new project “Centres Push Button”
add a new Class
rename the class to “CentresPushButton”
set the class super to “PushButton”
add a property “PlacedWindow” with type “Window” to the “CentresPushButton”
add a methode “Center” to the “CentresPushButton”
add this in the methode “Center”
[i]Sub Center()
dim Xwidth as integer
dim XLeft as integer
Xwidth = PlacedWindow.Width
XLeft = ( Xwidth - me.Width ) / 2
me.Left = XLeft
End Sub[/i]
add “CentresPushButton” to Window1
change the text from “Untitled” to any text that you want
place the button at the left bottom corner on Window1
set the locking to left, bottom
add an Open event to “CentresPushButton1” and enter this:
Sub Open()
me.PlacedWindow = self
End Sub
add an Open event to Window1 and enter this:
Sub Open()
CenteresPushButton1.Center
End Sub
add a Resizing event to Window1 and enter this:
Sub Resizing()
CenteresPushButton1.Center
End Sub
If you run the project, the “CentresPushButton” is concentric centres on Window1. If you resized Window1 the button is always concentric centres.
Later today I will share a example project for this.