在我的软件课程中,每次我们提交作业时,我们都必须在表单中包含每个对象的起始属性的文档。
例如
TextBox1
Location: 241, 115
Name: TextBox1
Size: 100, 20
TabIndex: 0
滚动浏览属性查看器并将 30+ 对象的每个自定义值复制并粘贴到表单上真的很痛苦......我想知道是否有一段简单的代码或方法来获取对象所有属性的(至少部分)自动打印输出/视图。
是否在想某种私人子,我可以进入程序的底部并在加载时运行,获取所有对象,并将非默认属性输出到报告或其他东西?基本上关于我如何做到这一点的任何想法?
任何帮助都会很棒!
为什么不查看InitializeComponent
方法,您应该能够从那里剪切和粘贴所需的内容。
Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label()
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(0, 0)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(75, 23)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
Me.Button1.UseVisualStyleBackColor = True
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(12, 46)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(51, 17)
Me.Label1.TabIndex = 1
Me.Label1.Text = "Label1"
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(282, 255)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub