添加按钮以形成布局控制 [英] Add buttons to form layout contrl

查看:91
本文介绍了添加按钮以形成布局控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨大家好



我有以下代码可以在表格上工作

来自列表框控件



但是我需要它来添加按钮到我的formlayout控件

我是笨蛋



Hi Guys

I have the following code which works on a form
from Listbox control

But i need it to add the buttons to my formlayout control
Im being Dumb

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       For Each i As String In ListBox1.Items
           Dim ff As New System.Windows.Forms.Button
           'INCREMENT THE COUNT_CONTROL.
           Count_control += 1
           'CHECKING IF THE BUTTONS HAS REACHED TO 12 OR NOT
           If Count_control <= 12 Then
               'SET A NEW BUTTON
               Dim new_Button As New Button

               'ADD THE PROPERTIES OF THE BUTTON
               new_Button.Name = "Button" + (i)
               new_Button.Text = "Button" + (i)
               new_Button.Location = New Point(Location_control.X + 10, _
                                               Location_control.Y)
               new_Button.Width = 180
               Location_control.Y += (new_Button.Height + 10)
               'CREATE THE EVENT HANDLER
               AddHandler new_Button.Click, AddressOf Button1_Click
               'ADD THE NEW BUTTON TO THE COLLECTION OF CONTROLS
               Controls.Add(new_Button)
           Else




           End If

       Next

   End Sub





我的尝试:



我找到了一些代码,但都在c#

或基于网络。

我厌倦了寻找..

正在lazy。



What I have tried:

I have found some code but all in c#
or web based.
Im tired of looking..
Being lazy.

推荐答案

排序......对我来说太傻了

需要更多咖啡



谢谢你们



Sorted..So silly of me
Need more coffee

thanks guys

Me.FlowLayoutPanel1.Controls.Add(new_Button)


这篇关于添加按钮以形成布局控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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