How to prevent the IDE from generating code in your .designer.vb file?
I'm a relative newbie to .NET developing (9 months) and I've given up figuring out everything on my own :) I need help from the gurus hehe
I was wondering if it's possible to prevent the VB IDE from generating those "default value" entries in the form1.designer.vb. The code below shows a bunch of properties that the IDE keeps generating code for in the form in which I instantiated it. Ex:
Me.btnCancel.GradientBorderPadding = 3.0!
Me.btnCancel.GradientColor1 = System.Drawing.SystemColors.Window
Me.btnCancel.GradientColor1Transparency = CType(128, Byte)
Me.btnCancel.GradientColor2 = System.Drawing.SystemColors.GradientActiveCaption
Me.btnCancel.GradientColor2Transparency = CType(128, Byte)
Me.btnCancel.GradientEnable = False
Me.btnCancel.GradientTextBorderPadding = 5.0!
Me.btnCancel.GradientTextColor = System.Drawing.SystemColors.ControlText
Me.btnCancel.GradientType = System.Drawing.Drawing2D.LinearGradientMode.Vertical
But I DON'T want it to generate the code specially when it's only repeating the default values that I already specified in the base class. Is this possible to disable?
Thanks
Base Class Button code follows:
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows
<Drawing.ToolboxBitmap(GetType(System.Windows.Forms.Button))> _
Public Class Button
Inherits System.Windows.Forms.Button
'MDK 3/29/06 Generic BillManager specific property
Private strBillManagerComment As String = ""
<ComponentModel.Category("BillManager"), _
ComponentModel.Description("Use this property for anything BillManager related or for just notation for fellow developers. Example: BillManager RULES!"), ComponentModel.DefaultValue("")> _
Public Property BillManagerComment() As String
Get
Return strBillManagerComment
End Get
Set(ByVal value As String)
strBillManagerComment = value
End Set
End Property
Sub New()
MyBase.New()
InitializeComponent()
End Sub
Private Sub InitializeComponent()
'MDK 3/29/06
'Empty till a property is set manually via code or via the properties window
End Sub
#Region "Gradient" 'MDK 11/15/2006
Private m_OriginalForeColor As Color = Me.ForeColor
Private m_GradientEnable As Boolean = False
<ComponentModel.Category("BillManager"), _
ComponentModel.Description("Gets or sets if the Gradient is on or off."), ComponentModel.DefaultValue(False)> _
Public Property GradientEnable() As Boolean
Get
Return m_GradientEnable
End Get
Set(ByVal value As Boolean)
m_GradientEnable = value
If value = True Then
m_OriginalForeColor = Me.ForeColor
Me.ForeColor = Color.Transparent
Else
Me.ForeColor = m_OriginalForeColor
End If
Me.Refresh()
End Set
End Property
Private m_GradientType As LinearGradientMode = LinearGradientMode.Vertical
<ComponentModel.Category("BillManager"), _
ComponentModel.Description("Gets or sets the direction of the Gradient")> _
Public Property GradientType() As LinearGradientMode
Get
Return m_GradientType
End Get
Set(ByVal value As LinearGradientMode)
m_GradientType = value
Me.Refresh()
End Set
End Property
Private m_GradientBorderPadding As Single = 3
<ComponentModel.Category("BillManager"), _
ComponentModel.Description("Gets or sets the number of pixels between the gradient boundary and the control client area")> _
Public Property GradientBorderPadding() As Single
Get
Return m_GradientBorderPadding
End Get
Set(ByVal value As Single)
m_GradientBorderPadding = value
Me.Refresh()
End Set
End Property
Private m_GradientColor1 As Color = SystemColors.Window
<ComponentModel.Category("BillManager"), _
ComponentModel.Description("Gets or sets the color of one end of the gradient.")> _
Public Property GradientColor1() As Color
Get
Return m_GradientColor1
End Get
Set(ByVal value As Color)
m_GradientColor1 = value
Me.Refresh()
End Set
End Property
Private m_GradientColor2 As Color = SystemColors.GradientActiveCaption
<ComponentModel.Category("BillManager"), _
ComponentModel.Description("Gets or sets the color of one end of the gradient.")> _
Public Property GradientColor2() As Color
Get
Return m_GradientColor2
End Get
Set(ByVal value As Color)
m_GradientColor2 = value
Me.Refresh()
End Set
End Property
Private m_GradientColor1Transparency As Byte = 128
<ComponentModel.Category("BillManager"), _
ComponentModel.Description("Gets or sets the amount of visibility of the first color. (0=transparent, 255=opaque)")> _
Public Property GradientColor1Transparency() As Byte
Get
Return m_GradientColor1Transparency
End Get
Set(ByVal value As Byte)
m_GradientColor1Transparency = value
Me.Refresh()
End Set
End Property
Private m_GradientColor2Transparency As Byte = 128
<ComponentModel.Category("BillManager"), _
ComponentModel.Description("Gets or sets the amount of visibility of the second color. (0=transparent, 255=opaque)")> _
Public Property GradientColor2Transparency() As Byte
Get
Return m_GradientColor2Transparency
End Get
Set(ByVal value As Byte)
m_GradientColor2Transparency = value
Me.Refresh()
End Set
End Property
Private m_GradientTextBorderPadding As Single = 5
<ComponentModel.Category("BillManager"), _
ComponentModel.Description("Gets or sets the number of pixels between the text boundary and the control client area")> _
Public Property GradientTextBorderPadding() As Single
Get
Return m_GradientTextBorderPadding
End Get
Set(ByVal value As Single)
m_GradientTextBorderPadding = value
Me.Refresh()
End Set
End Property
Private m_GradientTextColor As Color = Me.ForeColor
<ComponentModel.Category("BillManager"), _
ComponentModel.Description("Gets or sets the color of the text inside the control.")> _
Public Property GradientTextColor() As Color
Get
Return m_GradientTextColor
End Get
Set(ByVal value As Color)
m_GradientTextColor = value
Me.Refresh()
End Set
End Property

