|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Setting autosize to falseIn Visual Studio 2005, using Visual Basic, Is there a way to set the
autosize property [such as in a label control] to false as a standard, and change it to true as needed? Or does it always start out as true when a label [or other such control] is brought in to a form? This is probably a very basic question, but I appreciate any help anyone can offer. Thanks Matt Matt,
The control itself (the label in this case) controls what the value defaults to. The only way I know of to change the default would be to inherit from Label, creating a derived label that has the new default. Then using the derived Label instead. Something like: Public Class Label Inherits System.Windows.Forms.Label Public Sub New() AutoSize = False End Sub <System.ComponentModel.DefaultValue(False)> _ Public Overrides Property AutoSize() As Boolean Get Return MyBase.AutoSize End Get Set(ByVal value As Boolean) MyBase.AutoSize = value End Set End Property End Class The System.ComponentModel.DefaultValueAttribute above, is suppose to tell the forms designer that the property defaults to False and not True, so the generated code doesn't include the value... Unfortunately it appears that the above doesn't want to work in VS 2005 (.NET 2.0), I'll need to try it in VS 2003 this evening, as I'm sure I used the above in VS 2002 & VS 2003 (.NET 1.x) -- Show quoteHide quoteHope this helps Jay B. Harlow [MVP - Outlook] ..NET Application Architect, Enthusiast, & Evangelist T.S. Bradley - http://www.tsbradley.net "matthewtech" <nixspam_matt_tap@yahoo.com> wrote in message news:%2367w4NyhGHA.1260@TK2MSFTNGP05.phx.gbl... | In Visual Studio 2005, using Visual Basic, Is there a way to set the | autosize property [such as in a label control] to false as a standard, and | change it to true as needed? | | Or does it always start out as true when a label [or other such control] is | brought in to a form? | | | This is probably a very basic question, but I appreciate any help anyone can | offer. | | Thanks | Matt | |
Adding row to table
Timer Component for VB 2005 .aspx page? XML Encoding woes... XY coordinates on form Attempted to read or write protected memory. dll vs vb 2005 Numeric / Currency control Exposing a .Net assembly to both VB6 and .Net (1 more time) InvalidCastException in DataRow webbrowser control to submit form Read data directly from a textbox and insert into a table |
|||||||||||||||||||||||