gpt4 book ai didi

vb.net - Winforms表单vb.net中对象的起始属性

转载 作者:行者123 更新时间:2023-12-04 05:43:33 25 4
gpt4 key购买 nike

在我的软件类(class)中,每次提交作业时,我们都必须在表单中包含一个文档,其中包含每个对象的起始属性。

例如。

TextBox1
Location: 241, 115
Name: TextBox1
Size: 100, 20
TabIndex: 0

滚动浏览属性查看器并在表单上复制并粘贴 30 多个对象的每个自定义值真的很痛苦......我想知道是否有一段简单的代码或获取(至少部分)的方法自动打印/查看对象的所有属性。

是否正在考虑某种私有(private)子我可以进入程序底部并在加载时运行,它获取所有对象,并将非默认属性输出到报告或其他东西?基本上关于我如何做到这一点的任何想法?

任何帮助都会很棒!

最佳答案

为什么不查看 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

关于vb.net - Winforms表单vb.net中对象的起始属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10973801/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com