Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom button. Set width and height 1

Status
Not open for further replies.

RBSTR

Programmer
Nov 10, 2005
71
0
0
GB
Hi
I want to create a custom button control that is always the same size and height.
I have created a componet class called MyButton and so far my code is

Public Class MyButton
Inherits System.Windows.Forms.Button
End Class

How do I expand this to force my button control to be a hardcoded width and height.

Thanks
 
Protected Overrides Sub SetBoundsCore(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal specified As BoundsSpecified)
MyBase.SetBoundsCore(x, y, FixedWidth, FixedHeight, specified)
End Sub

-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
 
That might not be 100% clear at first glance. If you notice x, y, and specified are passed by the controls default event of SetBoundsCore. FixedWidth and FixedHeight are either replaced with actual number or you create variables so you can use them in multiple places but change only once.

-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top