Hide a property that isn't overridable...
-
I'm creating a control and don't want it to be resizable. Most people say to hide it from the designer and throw an error when it's called, but I can't do that because the Size property isn't overrideable! Right now I set the size back the the default height and width in the resize event, but this may be confusing to the user as it looks resizable. Thanks, Nick
Fluent in VB, Attempts to speak C#, Python, English ;)
---
File Association in VB.Net -
I'm creating a control and don't want it to be resizable. Most people say to hide it from the designer and throw an error when it's called, but I can't do that because the Size property isn't overrideable! Right now I set the size back the the default height and width in the resize event, but this may be confusing to the user as it looks resizable. Thanks, Nick
Fluent in VB, Attempts to speak C#, Python, English ;)
---
File Association in VB.Net -
In c# it's the 'new' modifier. http://msdn2.microsoft.com/en-us/library/435f1dw2(VS.80).aspx[^] Not sure about VB.Net though.
Thanks! I ran the example code there through a translator and found out you use the
shadows
keyword.
Fluent in VB, Attempts to speak C#, Python, English ;)
---
File Association in VB.Net -
Thanks! I ran the example code there through a translator and found out you use the
shadows
keyword.
Fluent in VB, Attempts to speak C#, Python, English ;)
---
File Association in VB.Net -
not great, but shadows !
Luc Pattyn [My Articles] [Forum Guidelines]
-
I'm creating a control and don't want it to be resizable. Most people say to hide it from the designer and throw an error when it's called, but I can't do that because the Size property isn't overrideable! Right now I set the size back the the default height and width in the resize event, but this may be confusing to the user as it looks resizable. Thanks, Nick
Fluent in VB, Attempts to speak C#, Python, English ;)
---
File Association in VB.NetYou can easily fix a controls size by overriding SetBoundsCore. It looks like this.
Protected Overrides Sub SetBoundsCore(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal specified As System.Windows.Forms.BoundsSpecified) Const fixedWidth As Integer = 50 Const fixedHeight As Integer = 50 MyBase.SetBoundsCore(x, y, fixedWidth, fixedHeight, specified) End Sub
I know changing the size back in the resize event will also work, but doing it that way actually allows the control's size to be changed and then it quickly changes it back. Overriding SetBoundsCore will prevent the change from ever occurring.
-
not great, but shadows !
Luc Pattyn [My Articles] [Forum Guidelines]