Form.OnResize
imports System
imports System.Drawing
imports System.Windows.Forms
public class ControlDynamicSizeLocation : inherits Form
private WithEvents btnShow as Button
public sub New()
btnShow = new Button()
btnShow.Parent = me
Size = new Size(350,400)
btnShow.Size = new Size(20, 20)
OnResize(EventArgs.Empty)
end sub
protected overrides sub OnResize(ByVal e as EventArgs)
MyBase.OnResize(e)
btnShow.Location = new Point(me.ClientSize.Width/10, me.ClientSize.Height/10)
end sub
public shared sub Main()
Application.Run(new ControlDynamicSizeLocation())
end sub
end class
Related examples in the same category