VB.NET WINDOWS FORM(流程布局面板) [英] VB.NET WINDOWS FORM (Flow Layout Panel)

查看:278
本文介绍了VB.NET WINDOWS FORM(流程布局面板)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何在运行程序时生成标签。现在我的问题是如何将生成的标签放在流布局面板中,这样就不会影响其他工具。只能在一个列中

,当我创建一个新标签时,创建的最后一个标签必须向下移动,新创建的标签将在其上面。请帮帮我。





这是我的代码到目前为止



I know how to generate label while running the program. now my question is how to put the generated labels in flow lay out panel so it will not affect other tools. JUST only in one collumn
and when i created a new label, the last label created must be move down and the new created label will go on top of it. pls do help me.


this is my code so far

Public Class Form1
    Dim counter As Integer = 1
    Dim FontName As String = "Tw Cen MT"
    Dim FontSize As Integer = 8
    Dim FS As New Font(FontName, FontSize, FontStyle.Regular)
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim lblTask As New Label
        lblTask.Name = "Label" & counter
        lblTask.Location = New Point(804, counter * 40)
        lblTask.Text = "You Just been Saved a name of" & TextBox1.Text
        lblTask.ForeColor = Color.White
        lblTask.BackColor = Color.FromArgb(95, 117, 146)
        lblTask.Width = 136
        lblTask.Height = 38
        lblTask.Font = FS
        Me.Controls.Add(lblTask)
        counter += 1
        lblTask.BringToFront()
    End Sub
End Class

推荐答案

您需要将标签添加到flowLayoutPanel的控件集合而不是表单 - Me.Controls.Add添加它到形式。其中flp.Controls.Add()将其添加到名为flp的flowlayoutPanel中,作为示例。
You need to add the label to the flowLayoutPanel's control collection not the form's - Me.Controls.Add adds it to the form. Where flp.Controls.Add() adds it to a flowlayoutPanel named flp, as an example.


这篇关于VB.NET WINDOWS FORM(流程布局面板)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆